diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-05-05 15:47:42 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-05-05 15:47:42 -0700 |
commit | 1d267ad1ecf7e9fd5ea6b22679beeb82585723f0 (patch) | |
tree | 2beb58d695e6b0bd381d7b2874818eb93805f3e8 /src | |
parent | fae63cb6a26ab5a9cc2fdaa56d778215d1a1fc35 (diff) | |
parent | f81355b2750717584e309699dfcae3c814167578 (diff) | |
download | binaryen-1d267ad1ecf7e9fd5ea6b22679beeb82585723f0.tar.gz binaryen-1d267ad1ecf7e9fd5ea6b22679beeb82585723f0.tar.bz2 binaryen-1d267ad1ecf7e9fd5ea6b22679beeb82585723f0.zip |
Merge pull request #436 from WebAssembly/fix-switch
Fix switches in simplify-locals
Diffstat (limited to 'src')
-rw-r--r-- | src/passes/SimplifyLocals.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/passes/SimplifyLocals.cpp b/src/passes/SimplifyLocals.cpp index 785bccf06..fbd1e7e57 100644 --- a/src/passes/SimplifyLocals.cpp +++ b/src/passes/SimplifyLocals.cpp @@ -126,6 +126,7 @@ struct SimplifyLocals : public WalkerPass<LinearExecutionWalker<SimplifyLocals, for (auto target : sw->targets) { self->unoptimizableBlocks.insert(target); } + self->unoptimizableBlocks.insert(sw->default_); // TODO: we could use this info to stop gathering data on these blocks } self->sinkables.clear(); @@ -161,12 +162,16 @@ struct SimplifyLocals : public WalkerPass<LinearExecutionWalker<SimplifyLocals, // post-block cleanups if (curr->name.is()) { - unoptimizableBlocks.erase(curr->name); - } - if (hasBreaks) { - // more than one path to here, so nonlinear - sinkables.clear(); - blockBreaks.erase(curr->name); + if (unoptimizableBlocks.count(curr->name)) { + sinkables.clear(); + unoptimizableBlocks.erase(curr->name); + } + + if (hasBreaks) { + // more than one path to here, so nonlinear + sinkables.clear(); + blockBreaks.erase(curr->name); + } } } |