[llvm-branch-commits] [WebAssembly] Port WebAssemblyRegColoringPass (PR #210225)

Heejin Ahn via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sat Jul 18 12:50:10 PDT 2026


================
@@ -329,3 +329,27 @@ bool WebAssemblyRegColoring::runOnMachineFunction(MachineFunction &MF) {
   }
   return true;
 }
+
+bool WebAssemblyRegColoringLegacy::runOnMachineFunction(MachineFunction &MF) {
+  LiveIntervals *Liveness = &getAnalysis<LiveIntervalsWrapperPass>().getLIS();
+  const MachineBlockFrequencyInfo *MBFI =
+      &getAnalysis<MachineBlockFrequencyInfoWrapperPass>().getMBFI();
+  return regColoring(MF, Liveness, MBFI);
+}
+
+PreservedAnalyses
+WebAssemblyRegColoringPass::run(MachineFunction &MF,
+                                MachineFunctionAnalysisManager &MFAM) {
+  // TODO(boomanaiden154): We duplicate this check from above to avoid computing
+  // analyses if we do not need to. We should remove it when remove support for
+  // the LegacyPM and are able to simplify things.
+  if (MF.exposesReturnsTwice())
+    return PreservedAnalyses::all();
----------------
aheejin wrote:

Can you add this check to `WebAssemblyRegColoringLegacy::runOnMachineFunction` and remove the check from `regColoring` then? Then we don't even need this TODO. We can just remove the legacy part when the time comes.

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


More information about the llvm-branch-commits mailing list