Simplify OpPhi instructions referencing unreachable continues
authorSteven Perron <stevenperron@google.com>
Wed, 14 Feb 2018 02:08:43 +0000 (21:08 -0500)
committerSteven Perron <31666470+s-perron@users.noreply.github.com>
Fri, 16 Feb 2018 23:58:03 +0000 (18:58 -0500)
commit50f307f88978180add62087ebc5172cf739f647d
tree5f448afeec52687d84376c32995268094328a3b6
parent3756b387f3c5c5e56d3c0d5983082f294f652eb0
Simplify OpPhi instructions referencing unreachable continues

In dead branch elimination, we already recognize unreachable continue
blocks, and update OpPhi instruction accordingly.  This change adds an
extra check: if the head block has exactly 1 other incoming edge, then
replace the OpPhi with the value from that edge.

Fixes #1314.
source/opt/dead_branch_elim_pass.cpp
test/opt/dead_branch_elim_test.cpp