[dev.ssa] cmd/compile/internal/gc: Small fixes

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>
This commit is contained in:
Keith Randall 2015-06-12 16:24:33 -07:00
parent d5ad9ced1c
commit 0ad9c8c720
1 changed files with 6 additions and 2 deletions

View 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: