mirror of
https://github.com/golang/go
synced 2024-11-19 13:44:52 -07:00
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: Keith Randall <khr@golang.org>
This commit is contained in:
parent
eb57a1dd75
commit
40bfec0022
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user