From b604ad935d1adc8498872e8afdb18df2f9b3b572 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Fri, 5 Nov 2021 16:05:35 -0700 Subject: [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. --- src/passes/pass.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') 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"); } } -- cgit v1.2.3