summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2017-08-05 11:53:48 -0700
committerAlon Zakai (kripken) <alonzakai@gmail.com>2017-08-05 13:46:02 -0700
commitcc193a49fa612142fdea016ed8fe8a527be7c835 (patch)
treead3fe7ac6265afd1abfe08e65be69d137b80a639 /src
parent077c531131be9404e97e94147fc5c5af9006ef07 (diff)
downloadbinaryen-cc193a49fa612142fdea016ed8fe8a527be7c835.tar.gz
binaryen-cc193a49fa612142fdea016ed8fe8a527be7c835.tar.bz2
binaryen-cc193a49fa612142fdea016ed8fe8a527be7c835.zip
don't turn untaken br_ifs into ifs in remove-unused-brs
Diffstat (limited to 'src')
-rw-r--r--src/passes/RemoveUnusedBrs.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/passes/RemoveUnusedBrs.cpp b/src/passes/RemoveUnusedBrs.cpp
index 9fed3e4a5..8994c7fe2 100644
--- a/src/passes/RemoveUnusedBrs.cpp
+++ b/src/passes/RemoveUnusedBrs.cpp
@@ -481,7 +481,9 @@ struct RemoveUnusedBrs : public WalkerPass<PostWalker<RemoveUnusedBrs>> {
// format. We need to flip the condition, which at worst adds 1.
if (curr->name.is()) {
auto* br = list[0]->dynCast<Break>();
- if (br && br->condition && br->name == curr->name) {
+ // we seek a regular br_if; if the type is unreachable that means it is not
+ // actually taken, so ignore
+ if (br && br->condition && br->name == curr->name && br->type != unreachable) {
assert(!br->value); // can't, it would be dropped or last in the block
if (BranchUtils::BranchSeeker::countNamed(curr, curr->name) == 1) {
// no other breaks to that name, so we can do this