mirror of
https://github.com/golang/go
synced 2024-11-23 21:40:05 -07:00
cmd/compile: fix optimization of Zero newobject on amd64p32
On amd64p32, PtrSize and RegSize don't agree, and function return value is aligned with RegSize. Fix this rule. Other architectures are not affected, where PtrSize and RegSize are the same. Change-Id: If187d3dfde3dc3b931b8e97db5eeff49a781551b Reviewed-on: https://go-review.googlesource.com/37720 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
d8a0f74801
commit
9b480521d8
@ -1386,9 +1386,9 @@
|
||||
|
||||
// recognize runtime.newobject and don't Zero/Nilcheck it
|
||||
(Zero (Load (OffPtr [c] (SP)) mem) mem)
|
||||
&& mem.Op == OpStaticCall
|
||||
&& mem.Op == OpStaticCall
|
||||
&& isSameSym(mem.Aux, "runtime.newobject")
|
||||
&& c == config.ctxt.FixedFrameSize() + config.PtrSize // offset of return value
|
||||
&& c == config.ctxt.FixedFrameSize() + config.RegSize // offset of return value
|
||||
-> mem
|
||||
// nil checks just need to rewrite to something useless.
|
||||
// they will be deadcode eliminated soon afterwards.
|
||||
|
@ -17210,7 +17210,7 @@ func rewriteValuegeneric_OpZero(v *Value, config *Config) bool {
|
||||
b := v.Block
|
||||
_ = b
|
||||
// match: (Zero (Load (OffPtr [c] (SP)) mem) mem)
|
||||
// cond: mem.Op == OpStaticCall && isSameSym(mem.Aux, "runtime.newobject") && c == config.ctxt.FixedFrameSize() + config.PtrSize
|
||||
// cond: mem.Op == OpStaticCall && isSameSym(mem.Aux, "runtime.newobject") && c == config.ctxt.FixedFrameSize() + config.RegSize
|
||||
// result: mem
|
||||
for {
|
||||
v_0 := v.Args[0]
|
||||
@ -17230,7 +17230,7 @@ func rewriteValuegeneric_OpZero(v *Value, config *Config) bool {
|
||||
if mem != v.Args[1] {
|
||||
break
|
||||
}
|
||||
if !(mem.Op == OpStaticCall && isSameSym(mem.Aux, "runtime.newobject") && c == config.ctxt.FixedFrameSize()+config.PtrSize) {
|
||||
if !(mem.Op == OpStaticCall && isSameSym(mem.Aux, "runtime.newobject") && c == config.ctxt.FixedFrameSize()+config.RegSize) {
|
||||
break
|
||||
}
|
||||
v.reset(OpCopy)
|
||||
|
Loading…
Reference in New Issue
Block a user