Skip to content

Commit cdf99a4

Browse files
authored
Only run --low-memory-unused when optimizing (#11999)
Helps WebAssembly/binaryen#3043
1 parent e41d9e3 commit cdf99a4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

emcc.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,9 @@ def backend_binaryen_passes():
597597
# even if not optimizing, make an effort to remove all unused imports and
598598
# exports, to make the wasm as standalone as possible
599599
passes += ['--remove-unused-module-elements']
600-
if shared.Settings.GLOBAL_BASE >= 1024: # hardcoded value in the binaryen pass
600+
# when optimizing, use the fact that low memory is never used (1024 is a
601+
# hardcoded value in the binaryen pass)
602+
if shared.Settings.OPT_LEVEL > 0 and shared.Settings.GLOBAL_BASE >= 1024:
601603
passes += ['--low-memory-unused']
602604
if shared.Settings.DEBUG_LEVEL < 3:
603605
passes += ['--strip-debug']

0 commit comments

Comments
 (0)