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

Rajat Bajpai via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 18 02:25:51 PST 2025


================
@@ -104,6 +104,21 @@ namespace Intrinsic {
   LLVM_ABI Function *getOrInsertDeclaration(Module *M, ID id,
                                             ArrayRef<Type *> Tys = {});
 
+  /// Look up the Function declaration of the intrinsic \p IID in the Module
+  /// \p M. If it does not exist, add a declaration and return it. Otherwise,
+  /// return the existing declaration.
+  ///
+  /// This overload automatically resolves overloaded intrinsics based on the
+  /// provided return type and argument types. For non-overloaded intrinsics,
+  /// the return type and argument types are ignored.
+  ///
+  /// \param M - The module to get or insert the intrinsic declaration.
+  /// \param IID - The intrinsic ID.
+  /// \param RetTy - The return type of the intrinsic.
+  /// \param ArgTys - The argument types of the intrinsic.
+  LLVM_ABI Function *getOrInsertDeclaration(Module *M, ID IID, Type *RetTy,
----------------
rajatbajpai wrote:

Sure, updated IRBuilder::CreateIntrinsic to use this API.

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


More information about the llvm-commits mailing list