================
@@ -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
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to