summaryrefslogtreecommitdiff
path: root/src/passes/CodeFolding.cpp
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2017-09-10 09:29:41 -0700
committerGitHub <noreply@github.com>2017-09-10 09:29:41 -0700
commit9fafcef2c3dfe18b119b11fa527514835a4371ce (patch)
tree33fedffc002bdb1ac0ad057d3e0e7134971f3404 /src/passes/CodeFolding.cpp
parenta9bf3a323837c366b7d467b720495d08e46d2e32 (diff)
parent67133b57486339249f65872b5959873fef390455 (diff)
downloadbinaryen-9fafcef2c3dfe18b119b11fa527514835a4371ce.tar.gz
binaryen-9fafcef2c3dfe18b119b11fa527514835a4371ce.tar.bz2
binaryen-9fafcef2c3dfe18b119b11fa527514835a4371ce.zip
Merge pull request #1175 from WebAssembly/fuzz
Fuzzer improvements + fixes
Diffstat (limited to 'src/passes/CodeFolding.cpp')
-rw-r--r--src/passes/CodeFolding.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/passes/CodeFolding.cpp b/src/passes/CodeFolding.cpp
index ae2f81283..047eee452 100644
--- a/src/passes/CodeFolding.cpp
+++ b/src/passes/CodeFolding.cpp
@@ -226,13 +226,17 @@ struct CodeFolding : public WalkerPass<ControlFlowWalker<CodeFolding>> {
// optimize returns at the end, so we can benefit from a fallthrough if there is a value TODO: separate passes for them?
optimizeTerminatingTails(returnTails);
// TODO add fallthrough for returns
- // TODO optimzier returns not in blocks, a big return value can be worth it
+ // TODO optimize returns not in blocks, a big return value can be worth it
// clean up
breakTails.clear();
unreachableTails.clear();
returnTails.clear();
unoptimizables.clear();
modifieds.clear();
+ // if we did any work, types may need to be propagated
+ if (anotherPass) {
+ ReFinalize().walkFunctionInModule(func, getModule());
+ }
}
}
@@ -371,8 +375,7 @@ private:
if (!tail.isFallthrough()) {
tail.block->list.push_back(last);
}
- // the blocks lose their endings, so any values are gone, and the blocks
- // are now either none or unreachable
+ // the block type may change if we removed final values
tail.block->finalize();
}
// since we managed a merge, then it might open up more opportunities later