]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: reuse auto symbols during ssa construction
authorTodd Neal <todd@tneal.org>
Sat, 12 Mar 2016 02:03:17 +0000 (20:03 -0600)
committerTodd Neal <todd@tneal.org>
Sat, 12 Mar 2016 13:44:49 +0000 (13:44 +0000)
Reuse auto symbols so cse can eliminate OpAddrs that refer to
them.

Change-Id: I69e6a3f77a3a33946459cf8c6eccf223f6125048
Reviewed-on: https://go-review.googlesource.com/20569
Run-TryBot: Todd Neal <todd@tneal.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/gc/ssa.go

index 87d23742161ee64b3cf27c5096fad06b0d545db5..b6d15c4a7ea17810a20d9c717efac6fbf8dd8061 100644 (file)
@@ -2487,15 +2487,7 @@ func (s *state) addr(n *Node, bounded bool) *ssa.Value {
                        s.Fatalf("addr of undeclared ONAME %v. declared: %v", n, s.decladdrs)
                        return nil
                case PAUTO:
-                       // We need to regenerate the address of autos
-                       // at every use. This prevents LEA instructions
-                       // from occurring before the corresponding VarDef
-                       // op and confusing the liveness analysis into thinking
-                       // the variable is live at function entry.
-                       // TODO: I'm not sure if this really works or we're just
-                       // getting lucky. We might need a real dependency edge
-                       // between vardef and addr ops.
-                       aux := &ssa.AutoSymbol{Typ: n.Type, Node: n}
+                       aux := s.lookupSymbol(n, &ssa.AutoSymbol{Typ: n.Type, Node: n})
                        return s.newValue1A(ssa.OpAddr, t, aux, s.sp)
                case PPARAMOUT: // Same as PAUTO -- cannot generate LEA early.
                        // ensure that we reuse symbols for out parameters so