summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2019-05-01 17:18:04 -0700
committerGitHub <noreply@github.com>2019-05-01 17:18:04 -0700
commitaf459403bc6e1bb99468ad05f351665143193082 (patch)
treefd6b0c2e0bd14822c3e3bb1e0f4a3b42c78bb56c /src
parent2bd3758a22131cfd6925b3fd995657b211095c90 (diff)
downloadbinaryen-af459403bc6e1bb99468ad05f351665143193082.tar.gz
binaryen-af459403bc6e1bb99468ad05f351665143193082.tar.bz2
binaryen-af459403bc6e1bb99468ad05f351665143193082.zip
wasm2js: don't run coalesce-locals if not optimizing (#2076)
That pass is very slow on unoptimized code (super-linear on the number of locals, which if unoptimized can be massive due to flatten).
Diffstat (limited to 'src')
-rw-r--r--src/wasm2js.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/wasm2js.h b/src/wasm2js.h
index 4e5bebb4c..1a5050af4 100644
--- a/src/wasm2js.h
+++ b/src/wasm2js.h
@@ -295,7 +295,11 @@ Ref Wasm2JSBuilder::processWasm(Module* wasm, Name funcName) {
runner.add("remove-unused-names");
runner.add("merge-blocks");
runner.add("simplify-locals-notee-nostructure");
- runner.add("coalesce-locals");
+ // Coalescing is slow if we didn't run full optimizations earlier, so don't
+ // run it automatically.
+ if (options.optimizeLevel > 0) {
+ runner.add("coalesce-locals");
+ }
runner.add("reorder-locals");
runner.add("vacuum");
runner.add("remove-unused-module-elements");