summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai (kripken) <alonzakai@gmail.com>2017-07-11 18:55:13 -0700
committerAlon Zakai (kripken) <alonzakai@gmail.com>2017-07-13 11:54:03 -0700
commit26b2f331a210bf6de22816e2564516a9f59178d0 (patch)
tree010fea245aea7b09f86c398d1e47cc0d55aa4f2f /src
parent485166f4a184543fda936b8c458f0f4b74c0368f (diff)
downloadbinaryen-26b2f331a210bf6de22816e2564516a9f59178d0.tar.gz
binaryen-26b2f331a210bf6de22816e2564516a9f59178d0.tar.bz2
binaryen-26b2f331a210bf6de22816e2564516a9f59178d0.zip
handle an unreachable condition properly in vacuum if simplification
Diffstat (limited to 'src')
-rw-r--r--src/passes/Vacuum.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/passes/Vacuum.cpp b/src/passes/Vacuum.cpp
index 40f4a6e59..0178a794d 100644
--- a/src/passes/Vacuum.cpp
+++ b/src/passes/Vacuum.cpp
@@ -232,6 +232,12 @@ struct Vacuum : public WalkerPass<PostWalker<Vacuum>> {
replaceCurrent(child);
return;
}
+ // if the condition is unreachable, just return it
+ if (curr->condition->type == unreachable) {
+ replaceCurrent(curr->condition);
+ return;
+ }
+ // from here on, we can assume the condition executed
if (curr->ifFalse) {
if (curr->ifFalse->is<Nop>()) {
curr->ifFalse = nullptr;