diff options
Diffstat (limited to 'src/passes/pass.cpp')
-rw-r--r-- | src/passes/pass.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/passes/pass.cpp b/src/passes/pass.cpp index 0b7d3426b..057642ea2 100644 --- a/src/passes/pass.cpp +++ b/src/passes/pass.cpp @@ -475,6 +475,9 @@ void PassRegistry::registerPasses() { "ssa-nomerge", "ssa-ify variables so that they have a single assignment, ignoring merges", createSSAifyNoMergePass); + registerPass("string-gathering", + "gathers wasm strings to globals", + createStringGatheringPass); registerPass( "strip", "deprecated; same as strip-debug", createStripDebugPass); registerPass("stack-check", @@ -710,6 +713,11 @@ void PassRunner::addDefaultGlobalOptimizationPostPasses() { addIfNoDWARFIssues("simplify-globals"); } addIfNoDWARFIssues("remove-unused-module-elements"); + if (options.optimizeLevel >= 2 && wasm->features.hasStrings()) { + // Gather strings to globals right before reorder-globals, which will then + // sort them properly. + addIfNoDWARFIssues("string-gathering"); + } if (options.optimizeLevel >= 2 || options.shrinkLevel >= 1) { addIfNoDWARFIssues("reorder-globals"); } |