[llvm] [mlir] [MLIR][LLVM][Intrinsics] Add new MLIR and LLVM APIs to automatically resolve overload types (PR #168188)

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 20 08:29:42 PST 2025


================
@@ -898,6 +898,21 @@ llvm::CallInst *mlir::LLVM::detail::createIntrinsicCall(
   return builder.CreateCall(fn, args);
 }
 
+llvm::CallInst *mlir::LLVM::detail::createIntrinsicCall(
+    llvm::IRBuilderBase &builder, llvm::Intrinsic::ID intrinsic,
+    llvm::Type *retTy, ArrayRef<llvm::Value *> args) {
+  llvm::Module *module = builder.GetInsertBlock()->getModule();
+
+  SmallVector<llvm::Type *> argTys;
----------------
jurahul wrote:

Thanks, I think we should atleast split this PR into two. One is the MLIR side that adds the new createIntrinsicCall() that takes and return types and args and just calls Builder.CreateIntrinsic() (the CreateIntrinsic(Type *RetTy, Intrinsic::ID ID, ArrayRef<Value *> Args) variant as that seems like an independent change. 

If you want, at the same time, we can change the existing `createIntrinsicCall` on MLIR side to also just use the same Builder.CreateIntrinsic API that hides all the overload type deduction inside and remove that code from createIntrinsicCall. It seems that can be done independently of any LLVM side changes.

Then, we can have another PR to add this ability to LLVM's Intrinsic:: API. Does that make sense?

https://github.com/llvm/llvm-project/pull/168188


More information about the llvm-commits mailing list