mirror of https://github.com/golang/go.git
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>
This commit is contained in:
parent
1cfc87e6db
commit
4237dea5e3
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue