summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2022-02-03 15:55:40 -0800
committerGitHub <noreply@github.com>2022-02-03 15:55:40 -0800
commitac1f664811c3c5a84d2e890802651ab8f3923f76 (patch)
tree058aadb9dec7727efb19b2c0c372579cbef562e4
parent22cf8e143a435fec8b4a6bf75adb673e1f5c9dae (diff)
downloadbinaryen-ac1f664811c3c5a84d2e890802651ab8f3923f76.tar.gz
binaryen-ac1f664811c3c5a84d2e890802651ab8f3923f76.tar.bz2
binaryen-ac1f664811c3c5a84d2e890802651ab8f3923f76.zip
wasm-reduce: Add newer passes (#4502)
These might help reduction. Most newer passes, like say --type-refining, are not going to actually help by themselves without other passes, so those are not added (they get run in the -O2 etc. modes, which at least gives them a chance to help). DeadArgumentElimination: Might help by itself, if just removing arguments reduces code size. In some cases applying constants may increase code size, though, but the -optimizing variant helps there. GlobalTypeOptimization: This can remove type fields which can shrink the type section by a lot. This is the reason I realized I should open this PR, when I happened to notice that running that pass manually after reduction helped a lot more. SimplifyGlobals: Can remove unused globals, merge identical immutable ones, etc., all of which can help code size directly.
-rw-r--r--src/tools/wasm-reduce.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/tools/wasm-reduce.cpp b/src/tools/wasm-reduce.cpp
index a6c195a63..2ca41339e 100644
--- a/src/tools/wasm-reduce.cpp
+++ b/src/tools/wasm-reduce.cpp
@@ -259,8 +259,11 @@ struct Reducer
"--flatten -O3",
"--flatten --simplify-locals-notee-nostructure --local-cse -Os",
"--coalesce-locals --vacuum",
+ "--dae",
+ "--dae-optimizing",
"--dce",
"--duplicate-function-elimination",
+ "--gto",
"--inlining",
"--inlining-optimizing",
"--optimize-level=3 --inlining-optimizing",
@@ -276,6 +279,7 @@ struct Reducer
"--remove-unused-nonfunction-module-elements",
"--reorder-functions",
"--reorder-locals",
+ "--simplify-globals",
"--simplify-locals --vacuum",
"--strip",
"--vacuum"};