mirror of
https://github.com/golang/go
synced 2024-11-24 08:50:14 -07:00
cmd/compile: never CSE two memories
It never makes sense to CSE two ops that generate memory. We might as well start those ops off in their own partition. Fixes #15520 Change-Id: I0091ed51640f2c10cd0117f290b034dde7a86721 Reviewed-on: https://go-review.googlesource.com/22741 Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com> Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
01182425f8
commit
b64c7fc683
@ -1118,10 +1118,6 @@ func syslook(name string) *Node {
|
|||||||
return s.Def
|
return s.Def
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Sym) IsRuntimeCall(name string) bool {
|
|
||||||
return s.Pkg == Runtimepkg && s.Name == name
|
|
||||||
}
|
|
||||||
|
|
||||||
// typehash computes a hash value for type t to use in type switch
|
// typehash computes a hash value for type t to use in type switch
|
||||||
// statements.
|
// statements.
|
||||||
func typehash(t *Type) uint32 {
|
func typehash(t *Type) uint32 {
|
||||||
|
@ -116,12 +116,6 @@ type GCNode interface {
|
|||||||
String() string
|
String() string
|
||||||
}
|
}
|
||||||
|
|
||||||
// GCSym is an interface that *gc.Sym implements.
|
|
||||||
// Using *gc.Sym directly would lead to import cycles.
|
|
||||||
type GCSym interface {
|
|
||||||
IsRuntimeCall(name string) bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewConfig returns a new configuration object for the given architecture.
|
// NewConfig returns a new configuration object for the given architecture.
|
||||||
func NewConfig(arch string, fe Frontend, ctxt *obj.Link, optimize bool) *Config {
|
func NewConfig(arch string, fe Frontend, ctxt *obj.Link, optimize bool) *Config {
|
||||||
c := &Config{arch: arch, fe: fe}
|
c := &Config{arch: arch, fe: fe}
|
||||||
|
@ -257,14 +257,11 @@ func cmpVal(v, w *Value, auxIDs auxmap, depth int) Cmp {
|
|||||||
if v.Op == OpPhi && v.Block != w.Block {
|
if v.Op == OpPhi && v.Block != w.Block {
|
||||||
return lt2Cmp(v.Block.ID < w.Block.ID)
|
return lt2Cmp(v.Block.ID < w.Block.ID)
|
||||||
}
|
}
|
||||||
|
if v.Type.IsMemory() {
|
||||||
switch v.Op {
|
// We will never be able to CSE two values
|
||||||
case OpStaticCall, OpAMD64CALLstatic, OpARMCALLstatic:
|
// that generate memory.
|
||||||
sym := v.Aux.(GCSym)
|
|
||||||
if sym.IsRuntimeCall("newobject") {
|
|
||||||
return lt2Cmp(v.ID < w.ID)
|
return lt2Cmp(v.ID < w.ID)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if tc := v.Type.Compare(w.Type); tc != CMPeq {
|
if tc := v.Type.Compare(w.Type); tc != CMPeq {
|
||||||
return tc
|
return tc
|
||||||
|
Loading…
Reference in New Issue
Block a user