summaryrefslogtreecommitdiff
path: root/src/passes/CoalesceLocals.cpp
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-10-12 11:32:56 -0700
committerGitHub <noreply@github.com>2016-10-12 11:32:56 -0700
commitada5fb540164823f8dab45330a190479afa24120 (patch)
tree68f6741458e21413c3b133041de5638c5d152eeb /src/passes/CoalesceLocals.cpp
parenta08ccc3cdc2e53354f0eaeba419655b641b2b056 (diff)
downloadbinaryen-ada5fb540164823f8dab45330a190479afa24120.tar.gz
binaryen-ada5fb540164823f8dab45330a190479afa24120.tar.bz2
binaryen-ada5fb540164823f8dab45330a190479afa24120.zip
handle unreachable tee_local properly in coalesce-locals (#761)
Diffstat (limited to 'src/passes/CoalesceLocals.cpp')
-rw-r--r--src/passes/CoalesceLocals.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/passes/CoalesceLocals.cpp b/src/passes/CoalesceLocals.cpp
index f2f26f96a..3127b429c 100644
--- a/src/passes/CoalesceLocals.cpp
+++ b/src/passes/CoalesceLocals.cpp
@@ -168,7 +168,11 @@ struct CoalesceLocals : public WalkerPass<CFGWalker<CoalesceLocals, Visitor<Coal
auto* curr = (*currp)->cast<SetLocal>();
// if in unreachable code, ignore
if (!self->currBasicBlock) {
- ExpressionManipulator::nop(curr);
+ if (curr->isTee()) {
+ ExpressionManipulator::convert<SetLocal, Unreachable>(curr);
+ } else {
+ ExpressionManipulator::nop(curr);
+ }
return;
}
self->currBasicBlock->contents.actions.emplace_back(Action::Set, curr->index, currp);