]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.ssa] cmd/compile/internal/ssa: Use Ninit from expressions
authorKeith Randall <khr@golang.org>
Sat, 11 Jul 2015 18:39:12 +0000 (11:39 -0700)
committerKeith Randall <khr@golang.org>
Sat, 11 Jul 2015 19:32:35 +0000 (19:32 +0000)
If an expression has an Ninit list, generate code for it.
Required for (at least) OANDAND.

Change-Id: I94c9e22e2a76955736f4a8e574d92711419c5e5c
Reviewed-on: https://go-review.googlesource.com/12072
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/cmd/compile/internal/gc/ssa.go

index 96ae49a1796974106724a78099305f43de17a253..ab16a3351005ee04188a883770f1c214ad054952 100644 (file)
@@ -393,7 +393,6 @@ func (s *state) stmt(n *Node) {
                s.startBlock(bCond)
                var cond *ssa.Value
                if n.Left != nil {
-                       s.stmtList(n.Left.Ninit)
                        cond = s.expr(n.Left)
                } else {
                        cond = s.entryNewValue0A(ssa.OpConst, Types[TBOOL], true)
@@ -453,6 +452,7 @@ func (s *state) expr(n *Node) *ssa.Value {
        s.pushLine(n.Lineno)
        defer s.popLine()
 
+       s.stmtList(n.Ninit)
        switch n.Op {
        case ONAME:
                if n.Class == PFUNC {