Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile/internal/ssa: more location lists could be merged #65005

Open
ajwerner opened this issue Jan 8, 2024 · 2 comments · May be fixed by #65006
Open

cmd/compile/internal/ssa: more location lists could be merged #65005

ajwerner opened this issue Jan 8, 2024 · 2 comments · May be fixed by #65006
Labels
binary-size compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@ajwerner
Copy link

ajwerner commented Jan 8, 2024

Go version

go version go1.21.5 linux/amd64

`go env` output
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/ajwerner/.cache/go-build'
GOENV='/home/ajwerner/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/ajwerner/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/ajwerner/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/ajwerner/sdk/go1.21.5'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/ajwerner/sdk/go1.21.5/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.21.5'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/dev/null'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2531477809=/tmp/go-build -gno-record-gcc-switches'

What did you do?

I compiled so go programs and looked at their location lists. I have a fix for this but wanted to create an issue to reference and track it.

What did you see happen?

Sometimes I'd see location lists with adjacent PC ranges and the same locations for variables.

What did you expect to see?

I expected to see these location lists merged.

@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jan 8, 2024
ajwerner added a commit to ajwerner/go that referenced this issue Jan 8, 2024
Before this change, the logic to merge location lists would choose not
to merge if the old and new entries were both on the stack, but the new
entry was in fewer registers than old one or if both locations were in
registers but the new one is no longer in a register that was not going
to be output.

Fixes golang#65005
@ajwerner ajwerner linked a pull request Jan 8, 2024 that will close this issue
@gopherbot
Copy link

Change https://go.dev/cl/554515 mentions this issue: cmd/compile/internal/ssa: merge more loc lists

@ajwerner
Copy link
Author

ajwerner commented Jan 8, 2024

This bug has a substantial impact on the size of location lists. For example, for cockroach this change reduces the size of the .debug_loc section by 848164 bytes or 7.1%.

ajwerner added a commit to ajwerner/go that referenced this issue Jan 8, 2024
Before this change, the logic to merge location lists would choose not
to merge if the old and new entries were both on the stack, but the new
entry was in fewer registers than old one or if both locations were in
registers but the new one is no longer in a register that was not going
to be output.

Fixes golang#65005
@dmitshur dmitshur added this to the Backlog milestone Jan 9, 2024
@dmitshur dmitshur added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. binary-size labels Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
binary-size compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

3 participants