Commit 7189a02c authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

cmd/compile: remove haslabelgoto

As of CL 39998, it is no longer necessary.

Fixes #19699

Change-Id: Ie1c49c8468073c6ddeb96c03668705cf81d40c98
Reviewed-on: https://go-review.googlesource.com/41051
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
parent d728be70
......@@ -3957,16 +3957,10 @@ func deadcodeslice(nn Nodes) {
continue
}
if n.Op == OIF && Isconst(n.Left, CTBOOL) {
var dead *Nodes
if n.Left.Bool() {
dead = &n.Rlist
n.Rlist = Nodes{}
} else {
dead = &n.Nbody
}
// TODO(mdempsky/josharian): eliminate need for haslabelgoto
// by checking labels and gotos earlier. See issue 19699.
if !(*dead).haslabelgoto() {
*dead = Nodes{}
n.Nbody = Nodes{}
}
}
deadcodeslice(n.Ninit)
......@@ -3975,19 +3969,3 @@ func deadcodeslice(nn Nodes) {
deadcodeslice(n.Rlist)
}
}
// haslabelgoto reports whether the Nodes list contains any label or goto statements.
func (l Nodes) haslabelgoto() bool {
for _, n := range l.Slice() {
if n == nil {
continue
}
if n.Op == OLABEL || n.Op == OGOTO {
return true
}
if n.Ninit.haslabelgoto() || n.Nbody.haslabelgoto() || n.List.haslabelgoto() || n.Rlist.haslabelgoto() {
return true
}
}
return false
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment