[llvm] [WebAssembly] Fix unwind mismatches in new EH (PR #114361)

Derek Schuff via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 4 14:51:08 PST 2024


================
@@ -1215,7 +1286,291 @@ void WebAssemblyCFGStackify::addNestedTryDelegate(
   registerTryScope(Try, Delegate, nullptr);
 }
 
+// Given an unwind destination, return a trampoline BB. A trampoline BB is a
+// destination of a nested try_table inserted to fix an unwind mismatch. It
+// contains an end_block, which is the target of the try_table, and a throw_ref,
+// to rethrow the exception to the right try_table.
+// try_table (catch ... )
+//   block exnref
+//     ...
+//     try_table (catch_all_ref N)
+//       some code
+//     end_try_table
+//     ...
+//   end_block                      ;; Trampoline BB
+//   throw_fef
+// end_try_table
+MachineBasicBlock *
+WebAssemblyCFGStackify::getTrampolineBlock(MachineBasicBlock *UnwindDest) {
+  // We need one trampoline BB per an unwind destination, even though there are
----------------
dschuff wrote:

```suggestion
  // We need one trampoline BB per unwind destination, even though there are
```

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


More information about the llvm-commits mailing list