]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.ssa] cmd/compile: minor cleanup
authorJosh Bleecher Snyder <josharian@gmail.com>
Fri, 24 Jul 2015 18:55:52 +0000 (11:55 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Fri, 24 Jul 2015 22:28:43 +0000 (22:28 +0000)
Cull dead code. Add TODOs.

Change-Id: I81d24371de47f5a27d3a3a0ec0ef5baaf6814c06
Reviewed-on: https://go-review.googlesource.com/12659
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/cmd/compile/internal/gc/ssa.go
src/cmd/compile/internal/ssa/TODO
src/cmd/compile/internal/ssa/gen/genericOps.go

index b8831793fc0db20e31c3d132cee485e503f78b92..e9f99b17992a80dbef644ec3eedef879035ef256 100644 (file)
@@ -1114,6 +1114,8 @@ func canSSA(n *Node) bool {
 
 // nilCheck generates nil pointer checking code.
 // Starts a new block on return.
+// Used only for automatically inserted nil checks,
+// not for user code like 'x != nil'.
 func (s *state) nilCheck(ptr *ssa.Value) {
        c := s.newValue1(ssa.OpIsNonNil, ssa.TypeBool, ptr)
        b := s.endBlock()
@@ -1466,7 +1468,6 @@ func genValue(v *ssa.Value) {
                        p.From.Reg = x
                        p.To.Type = obj.TYPE_REG
                        p.To.Reg = r
-                       x = r
                }
                p := Prog(x86.ASUBQ)
                p.From.Type = obj.TYPE_CONST
@@ -1485,7 +1486,6 @@ func genValue(v *ssa.Value) {
                        p.From.Reg = x
                        p.To.Type = obj.TYPE_REG
                        p.To.Reg = r
-                       x = r
                }
                p := Prog(v.Op.Asm())
                p.From.Type = obj.TYPE_REG
@@ -1501,7 +1501,6 @@ func genValue(v *ssa.Value) {
                        p.From.Reg = x
                        p.To.Type = obj.TYPE_REG
                        p.To.Reg = r
-                       x = r
                }
                p := Prog(v.Op.Asm())
                p.From.Type = obj.TYPE_CONST
index 0074ded5d12177a97d0612b0420f2c700ef833dd..225768c73c917e151ce9460827390a6e78a03059 100644 (file)
@@ -52,6 +52,9 @@ Common-Subexpression Elimination
  - Can we move control values out of their basic block?
    This would break nilcheckelim as currently implemented,
    but it could be replaced by a similar CFG simplication pass.
+ - Investigate type equality. During SSA generation, should we use n.Type or (say) TypeBool?
+   Should we get rid of named types in favor of underlying types during SSA generation?
+   Should we introduce a new type equality routine that is less strict than the frontend's?
 
 Other
  - Write barriers
@@ -63,3 +66,4 @@ Other
  - make deadstore work with zeroing.
  - Add a value range propagation optimization pass.
    Use it for bounds check elimination and bitwidth reduction.
+ - Branch prediction: Respect hints from the frontend, add our own.
index 6129849ec66445f4261e86a8f853bf65dca47e31..4014fd50092118527882860dc293780d2f06b367 100644 (file)
@@ -153,7 +153,7 @@ var genericOps = []opData{
        {name: "Convert"}, // convert arg0 to another type
        {name: "ConvNop"}, // interpret arg0 as another type
 
-       // Safety checks
+       // Automatically inserted safety checks
        {name: "IsNonNil"},   // arg0 != nil
        {name: "IsInBounds"}, // 0 <= arg0 < arg1