From ac1f664811c3c5a84d2e890802651ab8f3923f76 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 3 Feb 2022 15:55:40 -0800 Subject: 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. --- src/tools/wasm-reduce.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') 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"}; -- cgit v1.2.3