]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: don't SSA any variables when -N
authorKeith Randall <khr@golang.org>
Fri, 29 Apr 2016 19:09:32 +0000 (12:09 -0700)
committerKeith Randall <khr@golang.org>
Mon, 2 May 2016 04:16:45 +0000 (04:16 +0000)
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>
src/cmd/compile/internal/gc/ssa.go

index 9d03f239a8d84ba52635bbfc184126008bc0aad0..b05dedcfa92ef793c409969b2a8de6e9a5be37e9 100644 (file)
@@ -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
        }