summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2017-08-25 10:40:57 -0700
committerAlon Zakai <alonzakai@gmail.com>2017-08-25 16:04:36 -0700
commite88e1f1cdfd3807ca4f6cafe84d35083a92eddb1 (patch)
treebb448bfdc87851d5f00901f9f40031619f295117 /src
parent4367194dc08e981b85effc2127564f53ecbc0af1 (diff)
downloadbinaryen-e88e1f1cdfd3807ca4f6cafe84d35083a92eddb1.tar.gz
binaryen-e88e1f1cdfd3807ca4f6cafe84d35083a92eddb1.tar.bz2
binaryen-e88e1f1cdfd3807ca4f6cafe84d35083a92eddb1.zip
don't turn unreachable ifs into br_ifs, they are dead anyhow, and would need special handling to emit valid code
Diffstat (limited to 'src')
-rw-r--r--src/passes/RemoveUnusedBrs.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/passes/RemoveUnusedBrs.cpp b/src/passes/RemoveUnusedBrs.cpp
index 8994c7fe2..f0db1eee6 100644
--- a/src/passes/RemoveUnusedBrs.cpp
+++ b/src/passes/RemoveUnusedBrs.cpp
@@ -31,6 +31,8 @@ namespace wasm {
// condition and possible value, and the possible value must
// not have side effects (as they would run unconditionally)
static bool canTurnIfIntoBrIf(Expression* ifCondition, Expression* brValue, PassOptions& options) {
+ // if the if isn't even taken, this is all dead code anyhow
+ if (ifCondition->type == unreachable) return false;
if (!brValue) return true;
EffectAnalyzer value(options, brValue);
if (value.hasSideEffects()) return false;