From c327fce6963d885518bb97003ee17e933607dfea Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Sat, 22 Aug 2020 08:09:41 -0700 Subject: [PATCH] Only run --low-memory-unused when optimizing --- emcc.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/emcc.py b/emcc.py index 673b06e5cba82..4044903b7571f 100755 --- a/emcc.py +++ b/emcc.py @@ -603,7 +603,9 @@ def backend_binaryen_passes(): # even if not optimizing, make an effort to remove all unused imports and # exports, to make the wasm as standalone as possible passes += ['--remove-unused-module-elements'] - if shared.Settings.GLOBAL_BASE >= 1024: # hardcoded value in the binaryen pass + # when optimizing, use the fact that low memory is never used (1024 is a + # hardcoded value in the binaryen pass) + if shared.Settings.OPT_LEVEL > 0 and shared.Settings.GLOBAL_BASE >= 1024: passes += ['--low-memory-unused'] if shared.Settings.DEBUG_LEVEL < 3: passes += ['--strip-debug']