diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/passes/DeadCodeElimination.cpp | 7 | ||||
-rw-r--r-- | src/passes/pass.cpp | 9 |
2 files changed, 14 insertions, 2 deletions
diff --git a/src/passes/DeadCodeElimination.cpp b/src/passes/DeadCodeElimination.cpp index 9562b2973..de1191131 100644 --- a/src/passes/DeadCodeElimination.cpp +++ b/src/passes/DeadCodeElimination.cpp @@ -40,7 +40,12 @@ struct DeadCodeElimination : public WalkerPass<PostWalker<DeadCodeElimination, V Pass* create() override { return new DeadCodeElimination; } // whether the current code is actually reachable - bool reachable = true; + bool reachable; + + void doWalkFunction(Function* func) { + reachable = true; + walk(func->body); + } std::set<Name> reachableBreaks; diff --git a/src/passes/pass.cpp b/src/passes/pass.cpp index e04033d90..f27eccf6a 100644 --- a/src/passes/pass.cpp +++ b/src/passes/pass.cpp @@ -149,7 +149,14 @@ void PassRunner::run() { std::cerr << ' '; } before = std::chrono::high_resolution_clock::now(); - pass->run(this, wasm); + if (pass->isFunctionParallel()) { + // function-parallel passes should get a new instance per function + for (auto& func : wasm->functions) { + runPassOnFunction(pass, func.get()); + } + } else { + pass->run(this, wasm); + } auto after = std::chrono::high_resolution_clock::now(); std::chrono::duration<double> diff = after - before; std::cerr << diff.count() << " seconds." << std::endl; |