[clang] [CIR] Add support for indirect calls (PR #139748)
Sirui Mu via cfe-commits
cfe-commits at lists.llvm.org
Sat May 17 08:42:56 PDT 2025
================
@@ -1500,6 +1507,14 @@ static void prepareTypeConverter(mlir::LLVMTypeConverter &converter,
converter.addConversion([&](cir::BF16Type type) -> mlir::Type {
return mlir::BFloat16Type::get(type.getContext());
});
+ converter.addConversion([&](cir::FuncType type) -> mlir::Type {
+ auto result = converter.convertType(type.getReturnType());
+ llvm::SmallVector<mlir::Type> arguments;
+ if (converter.convertTypes(type.getInputs(), arguments).failed())
+ llvm_unreachable("Failed to convert function type parameters");
----------------
Lancern wrote:
I just realized that we could indicate failure by returning an empty `std::optional` from the converter function, see https://github.com/llvm/llvm-project/blob/252ba8e3fb361772003c38566c99233c07adc4bd/mlir/include/mlir/Transforms/DialectConversion.h#L144-L148 . Maybe we could return an `std::nullopt` here instead?
https://github.com/llvm/llvm-project/pull/139748
More information about the cfe-commits
mailing list