[llvm-branch-commits] [WebAssembly] Port WebAssemblyCFGSortPass (PR #210247)

Aiden Grossman via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Jul 22 07:35:59 PDT 2026


================
@@ -395,3 +396,24 @@ bool WebAssemblyCFGSort::runOnMachineFunction(MachineFunction &MF) {
 
   return true;
 }
+
+bool WebAssemblyCFGSortLegacy::runOnMachineFunction(MachineFunction &MF) {
+  MachineLoopInfo &MLI = getAnalysis<MachineLoopInfoWrapperPass>().getLI();
+  WebAssemblyExceptionInfo &WEI =
+      getAnalysis<WebAssemblyExceptionInfoWrapperPass>().getWEI();
+  MachineDominatorTree &MDT =
+      getAnalysis<MachineDominatorTreeWrapperPass>().getDomTree();
+  return sortCFG(MF, MLI, WEI, MDT);
+}
+
+PreservedAnalyses
+WebAssemblyCFGSortPass::run(MachineFunction &MF,
+                            MachineFunctionAnalysisManager &MFAM) {
+  MachineLoopInfo &MLI = MFAM.getResult<MachineLoopAnalysis>(MF);
+  WebAssemblyExceptionInfo &WEI =
+      MFAM.getResult<WebAssemblyExceptionAnalysis>(MF);
+  MachineDominatorTree &MDT = MFAM.getResult<MachineDominatorTreeAnalysis>(MF);
+  return sortCFG(MF, MLI, WEI, MDT) ? getMachineFunctionPassPreservedAnalyses()
+                                          .preserveSet<CFGAnalyses>()
+                                    : PreservedAnalyses::all();
----------------
boomanaiden154 wrote:

Yes, they are both preserved by setting that we preserve CFG analyses.

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


More information about the llvm-branch-commits mailing list