aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssa/regalloc.go
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2023-03-28 09:41:46 -0700
committerKeith Randall <khr@golang.org>2023-03-28 17:31:36 +0000
commit4237dea5e36fa4c0900cb6b0850b1871f4e4c404 (patch)
tree25e52cb2ba7871efe637b4f2e457712d7efab3b8 /src/cmd/compile/internal/ssa/regalloc.go
parent1cfc87e6db5896e84472ca356e6344bc7d61a580 (diff)
downloadgo-4237dea5e36fa4c0900cb6b0850b1871f4e4c404.tar.xz
cmd/compile: lower priority of avoiding registers
We avoid allocating registers when we know they may have a fixed use later (arg/return value, or the CX shift argument to SHRQ, etc.) But it isn't worth avoiding that register if it requires moving another register. A move we may have to do later is not worth a move we definitely have to do now. Fixes #59288 Change-Id: Ibbdcbaea9caee0c5f3e0d6956a1a084ba89757a9 Reviewed-on: https://go-review.googlesource.com/c/go/+/479895 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Keith Randall <khr@google.com>
Diffstat (limited to 'src/cmd/compile/internal/ssa/regalloc.go')
-rw-r--r--src/cmd/compile/internal/ssa/regalloc.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/ssa/regalloc.go b/src/cmd/compile/internal/ssa/regalloc.go
index 2e121df3cc..c7cdea261d 100644
--- a/src/cmd/compile/internal/ssa/regalloc.go
+++ b/src/cmd/compile/internal/ssa/regalloc.go
@@ -1688,7 +1688,7 @@ func (s *regAllocState) regalloc(f *Func) {
}
}
// Avoid registers we're saving for other values.
- if mask&^desired.avoid&^s.nospill != 0 {
+ if mask&^desired.avoid&^s.nospill&^s.used != 0 {
mask &^= desired.avoid
}
r := s.allocReg(mask, v)