[Mlir-commits] [mlir] [MLIR][LLVMIR] Import calls with mismatching signature as indirect call (PR #135895)
Christian Ulmann
llvmlistbot at llvm.org
Thu May 1 22:56:16 PDT 2025
================
@@ -1771,11 +1773,17 @@ ModuleImport::convertFunctionType(llvm::CallBase *callInst) {
if (failed(calleeType))
return failure();
- // Compare the types to avoid constructing illegal call/invoke operations.
- if (failed(verifyFunctionTypeCompatibility(*callType, *calleeType))) {
+ // Compare the types, if they are not compatible, avoid illegal call/invoke
+ // operations by issuing an indirect call. Note that LLVM IR currently
+ // supports this usage.
+ if (failed(checkFunctionTypeCompatibility(*callType, *calleeType))) {
Location loc = translateLoc(callInst->getDebugLoc());
- return emitError(loc) << "incompatible call and callee types: " << *callType
- << " and " << *calleeType;
+ FlatSymbolRefAttr calleeSym = convertCalleeName(callInst);
+ indirectCallVal = builder.create<LLVM::AddressOfOp>(
+ loc, LLVM::LLVMPointerType::get(context), calleeSym);
+ emitWarning(loc) << "incompatible call and callee types: " << *callType
+ << " and " << *calleeType;
----------------
Dinistro wrote:
Might be sensible to add a test for this warning.
https://github.com/llvm/llvm-project/pull/135895
More information about the Mlir-commits
mailing list