Skip to content

cmd/compile: Duplicated sequence of instructions in runtime.adjustframe on AMD64 #49167

Closed
@jake-ciolek

Description

@jake-ciolek

What version of Go are you using (go version)?

go tip

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
Darwin AMD64

What did you do?

Looked at the assembly code of runtime.adjustframe.

What did you expect to see?

movl	$1, %eax
movq	128(%rsp), %rbp
addq	$136, %rsp
retq

I expected to see this once since there's a ret.

What did you see instead?

movl	$1, %eax
movq	128(%rsp), %rbp
addq	$136, %rsp
retq
movl	$1, %eax
movq	128(%rsp), %rbp
addq	$136, %rsp
retq
movl	$1, %eax
movq	128(%rsp), %rbp
addq	$136, %rsp
retq

Perhaps I am missing something and there's a valid reason for this, but it seems to me that we could use this sequence once and save 40+ bytes of instructions. Not sure if it's occuring anywhere else.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions