mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: allow inlining labeled for-statement and switch-statement
After CL 349012 and CL 350911, we can fully handle these labeled statements, so we can allow them when inlining. Updates #14768 Change-Id: I0ab3fd3f8d7436b49b1aedd946516b33c63f5747 Reviewed-on: https://go-review.googlesource.com/c/go/+/355497 Run-TryBot: David Chase <drchase@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Dan Scales <danscales@google.com> Reviewed-by: David Chase <drchase@google.com> Trust: Dan Scales <danscales@google.com>
This commit is contained in:
parent
cf51fb5d68
commit
74acbaf94a
2 changed files with 2 additions and 25 deletions
|
|
@ -390,27 +390,6 @@ func (v *hairyVisitor) doNode(n ir.Node) bool {
|
|||
// These nodes don't produce code; omit from inlining budget.
|
||||
return false
|
||||
|
||||
case ir.OFOR, ir.OFORUNTIL:
|
||||
n := n.(*ir.ForStmt)
|
||||
if n.Label != nil {
|
||||
v.reason = "labeled control"
|
||||
return true
|
||||
}
|
||||
case ir.OSWITCH:
|
||||
n := n.(*ir.SwitchStmt)
|
||||
if n.Label != nil {
|
||||
v.reason = "labeled control"
|
||||
return true
|
||||
}
|
||||
// case ir.ORANGE, ir.OSELECT in "unhandled" above
|
||||
|
||||
case ir.OBREAK, ir.OCONTINUE:
|
||||
n := n.(*ir.BranchStmt)
|
||||
if n.Label != nil {
|
||||
// Should have short-circuited due to labeled control error above.
|
||||
base.Fatalf("unexpected labeled break/continue: %v", n)
|
||||
}
|
||||
|
||||
case ir.OIF:
|
||||
n := n.(*ir.IfStmt)
|
||||
if ir.IsConst(n.Cond, constant.Bool) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue