mirror of
https://github.com/golang/go
synced 2024-11-17 11:04:53 -07:00
cmd/compile: simplify converted SSA form for 'if false'
The goal here is to make it easier for a human to examine the SSA when a function contains lots of dead code. No significant compiler metric or generated code differences. Change-Id: I81915fa4639bc8820cc9a5e45e526687d0d1f57a Reviewed-on: https://go-review.googlesource.com/c/go/+/221791 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
b49d8ce2fa
commit
7b0b6c2f7e
@ -1274,6 +1274,16 @@ func (s *state) stmt(n *Node) {
|
||||
s.assign(n.Left, r, deref, skip)
|
||||
|
||||
case OIF:
|
||||
if Isconst(n.Left, CTBOOL) {
|
||||
s.stmtList(n.Left.Ninit)
|
||||
if n.Left.Bool() {
|
||||
s.stmtList(n.Nbody)
|
||||
} else {
|
||||
s.stmtList(n.Rlist)
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
bEnd := s.f.NewBlock(ssa.BlockPlain)
|
||||
var likely int8
|
||||
if n.Likely() {
|
||||
|
Loading…
Reference in New Issue
Block a user