[llvm-branch-commits] [WebAssembly] Port WebAssemblyOptimizeLiveIntervalsPass (PR #209958)
Aiden Grossman via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Jul 22 07:18:16 PDT 2026
================
@@ -121,3 +124,21 @@ bool WebAssemblyOptimizeLiveIntervals::runOnMachineFunction(
return true;
}
+
+bool WebAssemblyOptimizeLiveIntervalsLegacy::runOnMachineFunction(
+ MachineFunction &MF) {
+ return optimizeLiveIntervals(
+ MF, getAnalysis<LiveIntervalsWrapperPass>().getLIS());
+}
+
+PreservedAnalyses WebAssemblyOptimizeLiveIntervalsPass::run(
+ MachineFunction &MF, MachineFunctionAnalysisManager &MFAM) {
+ bool Changed =
+ optimizeLiveIntervals(MF, MFAM.getResult<LiveIntervalsAnalysis>(MF));
+ if (!Changed)
+ return PreservedAnalyses::all();
+ return getMachineFunctionPassPreservedAnalyses()
+ .preserveSet<CFGAnalyses>()
+ .preserve<LiveIntervalsAnalysis>()
+ .preserve<SlotIndexesAnalysis>();
----------------
boomanaiden154 wrote:
`MachineBlockFrequencyInfo` and `MachineDominatorTree` are both preserved by marking the CFG as preserved.
I don't really understand why `LiveVariables` is preserved in the Legacy version. We don't do anything to maintain it, and it also isn't computed/invalidated anywhere around this pass in the pipeline, so I've left it omitted.
https://gist.github.com/boomanaiden154/7155128f498a4275079a6c6d870b60ef is the `-debug-pass-manager` output which shows that preserving `LiveVariablesAnalysis` shouldn't matter.
https://github.com/llvm/llvm-project/pull/209958
More information about the llvm-branch-commits
mailing list