[Mlir-commits] [mlir] [MLIR][LLVMIR] Import calls with mismatching signature as indirect call (PR #135895)
Christian Ulmann
llvmlistbot at llvm.org
Sun May 4 22:52:09 PDT 2025
================
@@ -1892,16 +1897,35 @@ LogicalResult ModuleImport::convertInstruction(llvm::Instruction *inst) {
/*operand_attrs=*/nullptr)
.getOperation();
}
- FailureOr<LLVMFunctionType> funcTy = convertFunctionType(callInst);
+ bool isIncompatibleCall;
+ FailureOr<LLVMFunctionType> funcTy =
+ convertFunctionType(callInst, isIncompatibleCall);
if (failed(funcTy))
return failure();
- FlatSymbolRefAttr callee = convertCalleeName(callInst);
- auto callOp = builder.create<CallOp>(loc, *funcTy, callee, *operands);
+ FlatSymbolRefAttr callee = nullptr;
+ if (isIncompatibleCall) {
+ // Use an indirect call (in order to represent valid and verifiable LLVM
+ // IR). Build the indirect call by passing an empty `callee` operand and
+ // insert into `operands` to include the indirect call target.
+ FlatSymbolRefAttr calleeSym = convertCalleeName(callInst);
+ Value indirectCallVal = builder.create<LLVM::AddressOfOp>(
+ translateLoc(callInst->getDebugLoc()),
----------------
Dinistro wrote:
```suggestion
loc,
```
Nit: Wasn't this already translated before?
https://github.com/llvm/llvm-project/pull/135895
More information about the Mlir-commits
mailing list