Skip to content

Commit b64c7fc

Browse files
committed
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 <[email protected]> Run-TryBot: Keith Randall <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent 0118242 commit b64c7fc

File tree

3 files changed

+4
-17
lines changed

3 files changed

+4
-17
lines changed

src/cmd/compile/internal/gc/subr.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,10 +1118,6 @@ func syslook(name string) *Node {
11181118
return s.Def
11191119
}
11201120

1121-
func (s *Sym) IsRuntimeCall(name string) bool {
1122-
return s.Pkg == Runtimepkg && s.Name == name
1123-
}
1124-
11251121
// typehash computes a hash value for type t to use in type switch
11261122
// statements.
11271123
func typehash(t *Type) uint32 {

src/cmd/compile/internal/ssa/config.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,6 @@ type GCNode interface {
116116
String() string
117117
}
118118

119-
// GCSym is an interface that *gc.Sym implements.
120-
// Using *gc.Sym directly would lead to import cycles.
121-
type GCSym interface {
122-
IsRuntimeCall(name string) bool
123-
}
124-
125119
// NewConfig returns a new configuration object for the given architecture.
126120
func NewConfig(arch string, fe Frontend, ctxt *obj.Link, optimize bool) *Config {
127121
c := &Config{arch: arch, fe: fe}

src/cmd/compile/internal/ssa/cse.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -257,13 +257,10 @@ func cmpVal(v, w *Value, auxIDs auxmap, depth int) Cmp {
257257
if v.Op == OpPhi && v.Block != w.Block {
258258
return lt2Cmp(v.Block.ID < w.Block.ID)
259259
}
260-
261-
switch v.Op {
262-
case OpStaticCall, OpAMD64CALLstatic, OpARMCALLstatic:
263-
sym := v.Aux.(GCSym)
264-
if sym.IsRuntimeCall("newobject") {
265-
return lt2Cmp(v.ID < w.ID)
266-
}
260+
if v.Type.IsMemory() {
261+
// We will never be able to CSE two values
262+
// that generate memory.
263+
return lt2Cmp(v.ID < w.ID)
267264
}
268265

269266
if tc := v.Type.Compare(w.Type); tc != CMPeq {

0 commit comments

Comments
 (0)