Commit 5325fbc7 authored by Keith Randall's avatar Keith Randall

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: 's avatarDavid Chase <drchase@google.com>
parent 5776c201
......@@ -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
}
......
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