aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2016-04-29 12:09:32 -0700
committerKeith Randall <khr@golang.org>2016-05-02 04:16:45 +0000
commit5325fbc7dbab155a88efab0bcd128236e97b3349 (patch)
tree54123610ffb0733e358721b71d2ade17007082e1 /src
parent5776c20164e5852ec13828db10277019db86180b (diff)
downloadgo-5325fbc7dbab155a88efab0bcd128236e97b3349.tar.xz
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>
Diffstat (limited to 'src')
-rw-r--r--src/cmd/compile/internal/gc/ssa.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/gc/ssa.go b/src/cmd/compile/internal/gc/ssa.go
index 9d03f239a8..b05dedcfa9 100644
--- a/src/cmd/compile/internal/gc/ssa.go
+++ b/src/cmd/compile/internal/gc/ssa.go
@@ -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
}