[clang] [libcxxabi] [libunwind] [llvm] [WebAssembly] Call EH personality function instead of `Unwind_CallPersonality` (PR #209282)

Demetrius Kanios via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 17 00:03:21 PDT 2026


================
@@ -367,9 +349,16 @@ void WasmEHPrepareImpl::prepareEHPad(BasicBlock *BB, bool NeedPersonality,
   // Pseudocode: __wasm_lpad_context.lsda = wasm.lsda();
   IRB.CreateStore(IRB.CreateCall(LSDAF), LSDAField);
 
-  // Pseudocode: _Unwind_CallPersonality(exn);
-  CallInst *PersCI = IRB.CreateCall(CallPersonalityF, CatchCI,
-                                    OperandBundleDef("funclet", CPI));
+  // Pseudocode: personality_fn(exn);
+  CallInst *PersCI;
+
+  // Grab direct function when possible to use `call` instead of `call_indirect`
+  if (Function *F = dyn_cast<Function>(PersonalityF.getCallee()))
+    PersCI = IRB.CreateCall(F, CatchCI, OperandBundleDef("funclet", CPI));
+  else
+    PersCI =
+        IRB.CreateCall(PersonalityF, CatchCI, OperandBundleDef("funclet", CPI));
----------------
QuantumSegfault wrote:

Not that I'm aware of.

I'm not sure what would cause this to happen. Aliases maybe?

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


More information about the cfe-commits mailing list