[llvm-branch-commits] [llvm] [WebAssembly] Port WebAssemblyExceptionAnalysis (PR #210246)

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


================
@@ -34,23 +37,52 @@ INITIALIZE_PASS_DEPENDENCY(MachineDominanceFrontierWrapperPass)
 INITIALIZE_PASS_END(WebAssemblyExceptionInfoWrapperPass, DEBUG_TYPE,
                     "WebAssembly Exception Information", true, true)
 
-bool WebAssemblyExceptionInfoWrapperPass::runOnMachineFunction(
-    MachineFunction &MF) {
+static void computeWEI(WebAssemblyExceptionInfo &WEI, MachineFunction &MF,
+                       function_ref<MachineDominatorTree &()> GetMDT,
+                       function_ref<MachineDominanceFrontier &()> GetMDF) {
   LLVM_DEBUG(dbgs() << "********** Exception Info Calculation **********\n"
                        "********** Function: "
                     << MF.getName() << '\n');
-  releaseMemory();
   if (MF.getTarget().getMCAsmInfo().getExceptionHandlingType() !=
           ExceptionHandling::Wasm ||
       !MF.getFunction().hasPersonalityFn())
-    return false;
-  auto &MDT = getAnalysis<MachineDominatorTreeWrapperPass>().getDomTree();
-  auto &MDF = getAnalysis<MachineDominanceFrontierWrapperPass>().getMDF();
-  WasmExceptionInfo.recalculate(MF, MDT, MDF);
-  LLVM_DEBUG(dump());
+    return;
+  MachineDominatorTree &MDT = GetMDT();
+  MachineDominanceFrontier &MDF = GetMDF();
+  WEI.recalculate(MF, MDT, MDF);
+}
+
+bool WebAssemblyExceptionInfoWrapperPass::runOnMachineFunction(
+    MachineFunction &MF) {
+  releaseMemory();
----------------
boomanaiden154 wrote:

We don't need to. We construct a fresh analysis results inside of `WebAssemblyExceptionAnalysis::run`.

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


More information about the llvm-branch-commits mailing list