diff options
author | Alon Zakai <azakai@google.com> | 2021-11-05 16:05:35 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-05 23:05:35 +0000 |
commit | b604ad935d1adc8498872e8afdb18df2f9b3b572 (patch) | |
tree | 773002bf5cd2428e7b97a69b77c98ab2f842aa0d /src | |
parent | 993ebb35dbd499bf36cd37bb79d695cd63767765 (diff) | |
download | binaryen-b604ad935d1adc8498872e8afdb18df2f9b3b572.tar.gz binaryen-b604ad935d1adc8498872e8afdb18df2f9b3b572.tar.bz2 binaryen-b604ad935d1adc8498872e8afdb18df2f9b3b572.zip |
[Wasm GC] Enable GlobalTypeOptimization (#4305)
Now that all known issues with that pass are fixed, enable it by
default. This adds it in a place that seems to make sense on j2wasm,
but in general multiple cycles of optimization will be needed.
This adds a test showing that we run this pass and that it helps
ConstantFieldPropagation by running before it.
Diffstat (limited to 'src')
-rw-r--r-- | src/passes/pass.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/passes/pass.cpp b/src/passes/pass.cpp index fd31dada8..3b0faa6c3 100644 --- a/src/passes/pass.cpp +++ b/src/passes/pass.cpp @@ -524,7 +524,12 @@ void PassRunner::addDefaultGlobalOptimizationPrePasses() { } if (wasm->features.hasGC() && getTypeSystem() == TypeSystem::Nominal && options.optimizeLevel >= 2) { - // TODO: investigate enabling --gto and --remove-module-elements before cfp + // Global type optimization can remove fields that are not needed, which can + // remove ref.funcs that were once assigned to vtables but are no longer + // needed, which can allow more code to be removed globally. After those, + // constant field propagation can be more effective. + addIfNoDWARFIssues("gto"); + addIfNoDWARFIssues("remove-unused-module-elements"); addIfNoDWARFIssues("cfp"); } } |