[llvm-branch-commits] [WebAssembly] Port WebAssemblyLowerEmscriptenEHSjLjImpl (PR #209040)

Aiden Grossman via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Jul 15 06:57:11 PDT 2026


================
@@ -1859,3 +1868,24 @@ void WebAssemblyLowerEmscriptenEHSjLj::handleLongjmpableCallsForWasmSjLj(
     }
   }
 }
+
+bool WebAssemblyLowerEmscriptenEHSjLjLegacy::runOnModule(Module &M) {
+  WebAssemblyLowerEmscriptenEHSjLjImpl Impl(
+      [&](Function &F) -> DominatorTree & {
+        return getAnalysis<DominatorTreeWrapperPass>(F).getDomTree();
+      });
+  return Impl.runOnModule(M);
+}
+
+PreservedAnalyses
+WebAssemblyLowerEmscriptenEHSjLjPass::run(Module &M,
+                                          ModuleAnalysisManager &MAM) {
+  WebAssemblyLowerEmscriptenEHSjLjImpl Impl(
+      [&](Function &F) -> DominatorTree & {
+        return MAM.getResult<FunctionAnalysisManagerModuleProxy>(M)
+            .getManager()
+            .getResult<DominatorTreeAnalysis>(F);
----------------
boomanaiden154 wrote:

You only need to go through this to get a module analysis from a Function/MachineFunction pass and vice versa. In the normal case where we need something like a DominatorTree in a function pass, it becomes `FAM.getResult<DominatorTreeAnalysis>(F)`.

The explicit nesting here is an intentional part of the design and helps to enforce things like F/MF passes only being able to request cached module analyses.

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


More information about the llvm-branch-commits mailing list