From 40bfec0022c027545f8b3e68050e7778dec7f7ce Mon Sep 17 00:00:00 2001 From: Todd Neal Date: Fri, 11 Mar 2016 20:03:17 -0600 Subject: [PATCH] cmd/compile: reuse auto symbols during ssa construction 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 TryBot-Result: Gobot Gobot Reviewed-by: Keith Randall --- src/cmd/compile/internal/gc/ssa.go | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/cmd/compile/internal/gc/ssa.go b/src/cmd/compile/internal/gc/ssa.go index 87d2374216..b6d15c4a7e 100644 --- a/src/cmd/compile/internal/gc/ssa.go +++ b/src/cmd/compile/internal/gc/ssa.go @@ -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 -- 2.48.1