summaryrefslogtreecommitdiff
path: root/src/passes/pass.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/passes/pass.cpp')
-rw-r--r--src/passes/pass.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/passes/pass.cpp b/src/passes/pass.cpp
index 10a688313..d21464c2b 100644
--- a/src/passes/pass.cpp
+++ b/src/passes/pass.cpp
@@ -171,6 +171,9 @@ void PassRegistry::registerPasses() {
registerPass("local-cse",
"common subexpression elimination inside basic blocks",
createLocalCSEPass);
+ registerPass("local-subtyping",
+ "apply more specific subtypes to locals where possible",
+ createLocalSubtypingPass);
registerPass("log-execution",
"instrument the build with logging of where execution goes",
createLogExecutionPass);
@@ -454,6 +457,12 @@ void PassRunner::addDefaultFunctionOptimizationPasses() {
if (options.optimizeLevel >= 3 || options.shrinkLevel >= 2) {
addIfNoDWARFIssues("merge-locals"); // very slow on e.g. sqlite
}
+ if (options.optimizeLevel > 1 && wasm->features.hasGC()) {
+ // Coalescing may prevent subtyping (as a coalesced local must have the
+ // supertype of all those combined into it), so subtype first.
+ // TODO: when optimizing for size, maybe the order should reverse?
+ addIfNoDWARFIssues("local-subtyping");
+ }
addIfNoDWARFIssues("coalesce-locals");
addIfNoDWARFIssues("simplify-locals");
addIfNoDWARFIssues("vacuum");