summaryrefslogtreecommitdiff
path: root/src/wasm2js.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm2js.h')
-rw-r--r--src/wasm2js.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/wasm2js.h b/src/wasm2js.h
index 5d2f95e94..ad8e32647 100644
--- a/src/wasm2js.h
+++ b/src/wasm2js.h
@@ -341,6 +341,11 @@ Ref Wasm2JSBuilder::processWasm(Module* wasm, Name funcName) {
// TODO: only legalize if necessary - emscripten would already do so, and
// likely other toolchains. but spec test suite needs that.
runner.add("legalize-js-interface");
+ // Before lowering non-JS operations we can optimize some instructions which
+ // may simplify next passes
+ if (options.optimizeLevel > 0) {
+ runner.add("optimize-for-js");
+ }
// First up remove as many non-JS operations we can, including things like
// 64-bit integer multiplication/division, `f32.nearest` instructions, etc.
// This may inject intrinsics which use i64 so it needs to be run before the