[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
================
@@ -362,9 +362,13 @@ class ModuleImport {
/// Converts the callee's function type. For direct calls, it converts the
/// actual function type, which may differ from the called operand type in
/// variadic functions. For indirect calls, it converts the function type
- /// associated with the call instruction. Returns failure when the call and
- /// the callee are not compatible or when nested type conversions failed.
- FailureOr<LLVMFunctionType> convertFunctionType(llvm::CallBase *callInst);
+ /// associated with the call instruction. When the call and the callee are not
+ /// compatible (or when nested type conversions failed), emit a warning but
+ /// attempt translation using an indirect call (in order to represent valid
+ /// and verified LLVM IR). The `indirectCallVal` is updated to hold the
+ /// address for the indirect call.
+ FailureOr<LLVMFunctionType> convertFunctionType(llvm::CallBase *callInst,
+ Value &indirectCallVal);
----------------
Dinistro wrote:
Nit: This signature is very odd. The function's name give no indication that this would deal with indirect calls/produce addressOf operations. I suggest to re-group this first check compatibility and only afterwards go down the indirect call route, if necessary.
To simplify this change, just returning a bool that indicates incompatibility and producing the AddressOf operation outside might already be better.
https://github.com/llvm/llvm-project/pull/135895
More information about the Mlir-commits
mailing list