Commit 40bfec00 authored by Todd Neal's avatar Todd Neal

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 <todd@tneal.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarKeith Randall <khr@golang.org>
parent eb57a1dd
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment