summaryrefslogtreecommitdiff
path: root/src/passes/RemoveUnusedBrs.cpp
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2018-05-01 16:10:38 -0700
committerGitHub <noreply@github.com>2018-05-01 16:10:38 -0700
commitdba8e94c423d555086f8233935558c0853835e64 (patch)
tree8d77a11f884bd4ed38b5091b082dd7d7c2905e2b /src/passes/RemoveUnusedBrs.cpp
parent16d3174db2f3b8c56600633156f9765bc3ad96b1 (diff)
downloadbinaryen-dba8e94c423d555086f8233935558c0853835e64.tar.gz
binaryen-dba8e94c423d555086f8233935558c0853835e64.tar.bz2
binaryen-dba8e94c423d555086f8233935558c0853835e64.zip
Fix some fuzz bugs (#1528)
* remove-unused-brs: handle an if declared as returning a value despite having an unreachable condition * simplify-locals: don't work on loops while the main pass is making changes, as set_locals are being tracked and modified.
Diffstat (limited to 'src/passes/RemoveUnusedBrs.cpp')
-rw-r--r--src/passes/RemoveUnusedBrs.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/passes/RemoveUnusedBrs.cpp b/src/passes/RemoveUnusedBrs.cpp
index c8c2277dc..87f53a652 100644
--- a/src/passes/RemoveUnusedBrs.cpp
+++ b/src/passes/RemoveUnusedBrs.cpp
@@ -683,7 +683,7 @@ struct RemoveUnusedBrs : public WalkerPass<PostWalker<RemoveUnusedBrs>> {
// TODO: handle a condition in the br? need to watch for side effects
auto* iff = curr->value->dynCast<If>();
if (!iff) return;
- if (!isConcreteType(iff->type)) return;
+ if (!isConcreteType(iff->type) || !isConcreteType(iff->condition->type)) return;
auto tryToOptimize = [&](Expression* one, Expression* two, bool flipCondition) {
if (one->type == unreachable && two->type != unreachable) {
if (auto* br = one->dynCast<Break>()) {