mirror of
https://github.com/golang/go
synced 2024-11-05 12:06:15 -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
@ -1388,7 +1388,7 @@
|
|||||||
(Zero (Load (OffPtr [c] (SP)) mem) mem)
|
(Zero (Load (OffPtr [c] (SP)) mem) mem)
|
||||||
&& mem.Op == OpStaticCall
|
&& mem.Op == OpStaticCall
|
||||||
&& isSameSym(mem.Aux, "runtime.newobject")
|
&& 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
|
-> mem
|
||||||
// nil checks just need to rewrite to something useless.
|
// nil checks just need to rewrite to something useless.
|
||||||
// they will be deadcode eliminated soon afterwards.
|
// they will be deadcode eliminated soon afterwards.
|
||||||
|
@ -17210,7 +17210,7 @@ func rewriteValuegeneric_OpZero(v *Value, config *Config) bool {
|
|||||||
b := v.Block
|
b := v.Block
|
||||||
_ = b
|
_ = b
|
||||||
// match: (Zero (Load (OffPtr [c] (SP)) mem) mem)
|
// 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
|
// result: mem
|
||||||
for {
|
for {
|
||||||
v_0 := v.Args[0]
|
v_0 := v.Args[0]
|
||||||
@ -17230,7 +17230,7 @@ func rewriteValuegeneric_OpZero(v *Value, config *Config) bool {
|
|||||||
if mem != v.Args[1] {
|
if mem != v.Args[1] {
|
||||||
break
|
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
|
break
|
||||||
}
|
}
|
||||||
v.reset(OpCopy)
|
v.reset(OpCopy)
|
||||||
|
Loading…
Reference in New Issue
Block a user