diff options
| author | Keith Randall <khr@golang.org> | 2025-08-18 10:17:27 -0700 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2025-08-18 12:15:08 -0700 |
| commit | 5a56d8848b4ffb79c5ccc11ec6fa01823a91aaf8 (patch) | |
| tree | 527ffe3cd347ccd55c786be68e08d430fa0f0172 /src | |
| parent | c3927a47f092fc7248d973f4d8a64ab410804986 (diff) | |
| download | go-5a56d8848b4ffb79c5ccc11ec6fa01823a91aaf8.tar.xz | |
cmd/compile: ensure we use allowed registers for input-clobbering instructions
For instructions which clobber their input register, we make a second
copy of the input value so it is still available in a register for
future instructions.
That second copy might not respect the register input restrictions
for the instruction. So the second copy we make here can't actually
be used by the instruction - it should use the first copy, the second
copy is the one that will persist beyond the clobber.
Fixes #75063
Change-Id: I99acdc63f0c4e54567a174ff7ada601ae4e796b7
Reviewed-on: https://go-review.googlesource.com/c/go/+/697015
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/cmd/compile/internal/ssa/regalloc.go | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/cmd/compile/internal/ssa/regalloc.go b/src/cmd/compile/internal/ssa/regalloc.go index f3c1d3bd96..43669fd143 100644 --- a/src/cmd/compile/internal/ssa/regalloc.go +++ b/src/cmd/compile/internal/ssa/regalloc.go @@ -1725,10 +1725,9 @@ func (s *regAllocState) regalloc(f *Func) { // spilling the value with the most distant next use. continue } - // Copy input to a new clobberable register. + // Copy input to a different register that won't be clobbered. c := s.allocValToReg(v.Args[i], m, true, v.Pos) s.copies[c] = false - args[i] = c } // Pick a temporary register if needed. |
