Repository navigation
cmd/compile: avoid revisiting shared OR expressions - #82672
JakeNesler wants to merge 1 commit into
Conversation
Treat shared OR values as separate roots in memcombineLoads and descend only into single-use arguments. combineLoads already refuses to combine through shared internal values, so expanding them cannot help find a load combination. Add a benchmark for repeated diamond-shaped expressions and code-generation checks for a combined load shared by two OR expressions. In six alternating comparison pairs at 9929116 on 27 October, a 22-level input with 67 OR values compiled in about 13 ms instead of 1.867 s, with identical assembly. Real application builds showed no statistically clear speedup or regression. Tests passed on linux/arm64 at 63313a0 with the candidate source overlay and, for code-generation checks, the rebuilt compiler: go test -count=3 -overlay=/work/memcombine-arm64.json cmd/compile/internal/ssa cmd/compile/internal/ssacompile go test -count=1 cmd/internal/testdir '-run=^Test/codegen/memcombine.go$' -args -all_codegen go test -count=1 cmd/internal/testdir '-run=^Test/prove.go$' The package tests also passed on linux/amd64. Full all.bash was not run. CartoGopher tooling for source navigation; reproduction, implementation and testing with Codex. Fixes golang#82671
|
This PR (HEAD: 6dae9ba) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/855621. Important tips:
|
|
Message from Gopher Robot: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/855621. |
|
Message from Jacob Nesler (Jake Nesler): Patch Set 3: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/855621. |
|
Message from David Chase: Patch Set 3: Code-Review+2 Commit-Queue+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/855621. |
|
Message from golang-scoped@luci-project-accounts.iam.gserviceaccount.com: Patch Set 3: Dry run: CV is trying the patch. Bot data: {"action":"start","triggered_at":"2026-10-30T01:19:46Z","revision":"a41389368b1b31afb1cd39b9a293a74343a63c02"} Please don’t reply on this GitHub thread. Visit golang.org/cl/855621. |
|
Message from Cuong Manh Le: Patch Set 3: Code-Review+2 Please don’t reply on this GitHub thread. Visit golang.org/cl/855621. |
|
Message from David Chase: Patch Set 3: -Commit-Queue (Performed by <GERRIT_ACCOUNT_60063> on behalf of <GERRIT_ACCOUNT_7061>) Please don’t reply on this GitHub thread. Visit golang.org/cl/855621. |
|
Message from golang-scoped@luci-project-accounts.iam.gserviceaccount.com: Patch Set 3: This CL has passed the run Please don’t reply on this GitHub thread. Visit golang.org/cl/855621. |
|
Message from golang-scoped@luci-project-accounts.iam.gserviceaccount.com: Patch Set 3: LUCI-TryBot-Result+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/855621. |
Treat shared OR values as separate roots in memcombineLoads and descend
only into single-use arguments. combineLoads cannot combine through
shared internal values, so revisiting them adds work without finding
more load combinations.
A 22-level input with 67 OR values compiled in about 13 ms instead of
1.867 s, with identical assembly. Real application builds showed no
statistically clear speedup or regression.
Fixes #82671