Skip to content

Commit 738bc3a

Browse files
randall77gopherbot
authored andcommitted
[release-branch.go1.25] cmd/compile: during regalloc, fixedreg values are always available
It is ok to clobber registers that have a copy of a fixedreg value, as that value is always available in its original location later if we need it. (See 14 lines below the change.) This CL will fix the regalloc infinite loop that CL 678620 introduced. That CL requests that the stack pointer value be materialized in a non-stack-pointer register, which is atypical. That condition triggered the infinite loop that this CL fixes. The infinite loop is the compiler trying to reuse that non-stack-pointer register for something else, but then refusing to give it up because it thought that non-stack-pointer register held the last copy of the original SP value. Fixes #75844 Change-Id: Id604d0937fb9d3753ee273bf1917753d3ef2d5d7 Reviewed-on: https://go-review.googlesource.com/c/go/+/696035 Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> (cherry picked from commit 9bbea0f) Reviewed-on: https://go-review.googlesource.com/c/go/+/710875 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
1 parent 69801b2 commit 738bc3a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/cmd/compile/internal/ssa/regalloc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2433,7 +2433,7 @@ func (e *edgeState) processDest(loc Location, vid ID, splice **Value, pos src.XP
24332433
}
24342434

24352435
// Check if we're allowed to clobber the destination location.
2436-
if len(e.cache[occupant.vid]) == 1 && !e.s.values[occupant.vid].rematerializeable {
2436+
if len(e.cache[occupant.vid]) == 1 && !e.s.values[occupant.vid].rematerializeable && !opcodeTable[e.s.orig[occupant.vid].Op].fixedReg {
24372437
// We can't overwrite the last copy
24382438
// of a value that needs to survive.
24392439
return false

0 commit comments

Comments
 (0)