[Mlir-commits] [mlir] [MLIR][LLVMIR] Allow llvm.call and llvm.invoke to use llvm.mlir.alias as callee (PR #189154)
Mehdi Amini
llvmlistbot at llvm.org
Sun Mar 29 04:40:51 PDT 2026
================
@@ -639,11 +643,29 @@ convertOperationImpl(Operation &opInst, llvm::IRBuilderBase &builder,
ArrayRef<llvm::Value *> operandsRef(operands);
llvm::InvokeInst *result;
if (auto attr = opInst.getAttrOfType<FlatSymbolRefAttr>("callee")) {
- result = builder.CreateInvoke(
- moduleTranslation.lookupFunction(attr.getValue()),
- moduleTranslation.lookupBlock(invOp.getSuccessor(0)),
- moduleTranslation.lookupBlock(invOp.getSuccessor(1)), operandsRef,
- opBundles);
+ if (llvm::Function *function =
+ moduleTranslation.lookupFunction(attr.getValue())) {
+ result = builder.CreateInvoke(
+ function, moduleTranslation.lookupBlock(invOp.getSuccessor(0)),
+ moduleTranslation.lookupBlock(invOp.getSuccessor(1)), operandsRef,
+ opBundles);
+ } else {
+ Operation *moduleOp = parentLLVMModule(&opInst);
+ Operation *calleeOp =
+ moduleTranslation.symbolTable().lookupSymbolIn(moduleOp, attr);
+ llvm::FunctionType *calleeType = llvm::cast<llvm::FunctionType>(
+ moduleTranslation.convertType(invOp.getCalleeFunctionType()));
+ llvm::GlobalValue *calleeGV;
+ if (isa<LLVM::AliasOp>(calleeOp))
+ calleeGV = moduleTranslation.lookupAlias(calleeOp);
+ else
+ calleeGV = moduleTranslation.lookupIFunc(calleeOp);
----------------
joker-eph wrote:
Good point, done!
https://github.com/llvm/llvm-project/pull/189154
More information about the Mlir-commits
mailing list