]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.ssa] cmd/compile/internal/gc: Small fixes
authorKeith Randall <khr@golang.org>
Fri, 12 Jun 2015 23:24:33 +0000 (16:24 -0700)
committerKeith Randall <khr@golang.org>
Sun, 14 Jun 2015 03:56:47 +0000 (03:56 +0000)
Allow labels to be unreachable via fallthrough from above.
Implement OCONVNOP.

Change-Id: I6869993cad8a27ad134dd637de89a40117daf47b
Reviewed-on: https://go-review.googlesource.com/11001
Reviewed-by: Daniel Morsing <daniel.morsing@gmail.com>
src/cmd/compile/internal/gc/ssa.go

index 131e97ff48e604902ccdda50a6ae9742ddb6bbd2..ebb7f44a18b21ac8a4d6276e7c2abc0f3306c936 100644 (file)
@@ -217,8 +217,9 @@ func (s *state) stmt(n *Node) {
                        s.labels[n.Left.Sym.Name] = t
                }
                // go to that label (we pretend "label:" is preceded by "goto label")
-               b := s.endBlock()
-               addEdge(b, t)
+               if b := s.endBlock(); b != nil {
+                       addEdge(b, t)
+               }
 
                if n.Op == OLABEL {
                        // next we work on the label's target block
@@ -358,6 +359,9 @@ func (s *state) expr(n *Node) *ssa.Value {
                        log.Fatalf("unhandled OLITERAL %v", n.Val().Ctype())
                        return nil
                }
+       case OCONVNOP:
+               x := s.expr(n.Left)
+               return s.newValue1(ssa.OpConvNop, n.Type, nil, x)
 
                // binary ops
        case OLT: