Skip to content

cmd/compile: duplicate instructions after rewrite func results #74788

@fengyoulin

Description

@fengyoulin

Go version

go version go1.26-devel_b10eb1d042 Mon Jul 28 17:39:26 2025 -0700 linux/amd64

Output of go env in your module/workspace:

AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='0'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE=''
GOAMD64='v1'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/home/kylin/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/home/kylin/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3413711938=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/dev/null'
GOMODCACHE='/home/kylin/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/kylin/go'
GOPRIVATE=''
GOPROXY='https://goproxy.cn,direct'
GOROOT='/home/kylin/go/src/googlesource.com/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/kylin/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/kylin/go/src/googlesource.com/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.26-devel_b10eb1d042 Mon Jul 28 17:39:26 2025 -0700'
GOWORK=''
PKG_CONFIG='pkg-config'

What did you do?

Disassemble the following function:

//go:noinline
func fn(a [2]int) (r [2]int) {
	return a
}

What did you see happen?

  0x4690e0              0f10442408              MOVUPS 0x8(SP), X0
  0x4690e5              0f11442418              MOVUPS X0, 0x18(SP)
  0x4690ea              0f10442408              MOVUPS 0x8(SP), X0
  0x4690ef              0f11442418              MOVUPS X0, 0x18(SP)
  0x4690f4              c3                      RET

What did you expect to see?

  0x4690e0              0f10442408              MOVUPS 0x8(SP), X0
  0x4690e5              0f11442418              MOVUPS X0, 0x18(SP)
  0x4690ea              c3                      RET

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Performancecompiler/runtimeIssues related to the Go compiler and/or runtime.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions