mirror of https://github.com/golang/go.git
cmd/compile: don't SSA any variables when -N
Turn SSAing of variables off when compiling with optimizations off. This helps keep variable names around that would otherwise be optimized away. Fixes #14744 Change-Id: I31db8cf269c068c7c5851808f13e5955a09810ca Reviewed-on: https://go-review.googlesource.com/22681 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com>
This commit is contained in:
parent
5776c20164
commit
5325fbc7db
|
|
@ -2356,7 +2356,7 @@ func (s *state) assign(left *Node, right *ssa.Value, wb, deref bool, line int32,
|
|||
}
|
||||
// Left is not ssa-able. Compute its address.
|
||||
addr := s.addr(left, false)
|
||||
if left.Op == ONAME {
|
||||
if left.Op == ONAME && skip == 0 {
|
||||
s.vars[&memVar] = s.newValue1A(ssa.OpVarDef, ssa.TypeMem, left, s.mem())
|
||||
}
|
||||
if deref {
|
||||
|
|
@ -2792,6 +2792,9 @@ func (s *state) addr(n *Node, bounded bool) *ssa.Value {
|
|||
// canSSA reports whether n is SSA-able.
|
||||
// n must be an ONAME (or an ODOT sequence with an ONAME base).
|
||||
func (s *state) canSSA(n *Node) bool {
|
||||
if Debug['N'] != 0 {
|
||||
return false
|
||||
}
|
||||
for n.Op == ODOT {
|
||||
n = n.Left
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue