diff options
author | Alon Zakai <azakai@google.com> | 2019-05-03 11:26:41 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-03 11:26:41 -0700 |
commit | 909ac3410093c0b35b3181abcd44b9fb9ceb4781 (patch) | |
tree | 99b75f23843e1a435231e76f8e39835999ca9ee9 /src/wasm2js.h | |
parent | 80b509cfb8fa35d229643f35e423e6d049ab8849 (diff) | |
download | binaryen-909ac3410093c0b35b3181abcd44b9fb9ceb4781.tar.gz binaryen-909ac3410093c0b35b3181abcd44b9fb9ceb4781.tar.bz2 binaryen-909ac3410093c0b35b3181abcd44b9fb9ceb4781.zip |
wasm2js: avoid some slow operations when not optimizing (#2082)
Without this PR, wasm2js0.test_printf in emscripten took an extremely long time to compile.
Diffstat (limited to 'src/wasm2js.h')
-rw-r--r-- | src/wasm2js.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/wasm2js.h b/src/wasm2js.h index 731bf0a8c..e721d3d58 100644 --- a/src/wasm2js.h +++ b/src/wasm2js.h @@ -301,12 +301,14 @@ Ref Wasm2JSBuilder::processWasm(Module* wasm, Name funcName) { // Finally, get the code into the flat form we need for wasm2js itself, and // optimize that a little in a way that keeps flat property. runner.add("flatten"); - runner.add("remove-unused-names"); - runner.add("merge-blocks"); + // Regardless of optimization level, run some simple optimizations to undo + // some of the effects of flattening. runner.add("simplify-locals-notee-nostructure"); - // Coalescing is slow if we didn't run full optimizations earlier, so don't - // run it automatically. + // Some operations can be very slow if we didn't run full optimizations + // earlier, so don't run them automatically. if (options.optimizeLevel > 0) { + runner.add("remove-unused-names"); + runner.add("merge-blocks"); runner.add("coalesce-locals"); } runner.add("reorder-locals"); |