[llvm-branch-commits] [WebAssembly] Port WebAssemblyOptimizeLiveIntervalsPass (PR #209958)

Heejin Ahn via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Jul 17 23:33:00 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>();
----------------
aheejin wrote:

https://github.com/llvm/llvm-project/blob/6a33b69d8bae737e5e1d60c7b7776a0b1f885bfa/llvm/lib/Target/WebAssembly/WebAssemblyOptimizeLiveIntervals.cpp#L41-L50

We seem to also preserve `MachineBlockFrequencyInfo`, `LiveVariables`, and `MachineDominators`. Does the new PM have equivalent analyses?

https://github.com/llvm/llvm-project/pull/209958


More information about the llvm-branch-commits mailing list