]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: never CSE two memories
authorKeith Randall <khr@golang.org>
Tue, 3 May 2016 20:58:28 +0000 (13:58 -0700)
committerKeith Randall <khr@golang.org>
Tue, 3 May 2016 22:45:53 +0000 (22:45 +0000)
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>

src/cmd/compile/internal/gc/subr.go
src/cmd/compile/internal/ssa/config.go
src/cmd/compile/internal/ssa/cse.go

index 6f2ed6a839aef15e98de6d5963b02c856a1ab62c..3ce8bd16d2d5eb6751e99a293b99b663344d2b43 100644 (file)
@@ -1118,10 +1118,6 @@ func syslook(name string) *Node {
        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
 // statements.
 func typehash(t *Type) uint32 {
index a60291ea53906cb59e5f19986d7a05dd3f818882..2a676e39b3a1f7031581c76df91b5cabe5cc25ec 100644 (file)
@@ -116,12 +116,6 @@ type GCNode interface {
        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.
 func NewConfig(arch string, fe Frontend, ctxt *obj.Link, optimize bool) *Config {
        c := &Config{arch: arch, fe: fe}
index d501f75e02ac2d63716a7e8c6bd5c3551d348429..8cc0db1d17266eabdfbe40d8a98b9da26a173857 100644 (file)
@@ -257,13 +257,10 @@ func cmpVal(v, w *Value, auxIDs auxmap, depth int) Cmp {
        if v.Op == OpPhi && v.Block != w.Block {
                return lt2Cmp(v.Block.ID < w.Block.ID)
        }
-
-       switch v.Op {
-       case OpStaticCall, OpAMD64CALLstatic, OpARMCALLstatic:
-               sym := v.Aux.(GCSym)
-               if sym.IsRuntimeCall("newobject") {
-                       return lt2Cmp(v.ID < w.ID)
-               }
+       if v.Type.IsMemory() {
+               // We will never be able to CSE two values
+               // that generate memory.
+               return lt2Cmp(v.ID < w.ID)
        }
 
        if tc := v.Type.Compare(w.Type); tc != CMPeq {