[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
Mon Nov 17 17:56:58 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,
+ ArrayRef<Type *> ArgTys);
+
----------------
jurahul wrote:
Can you add a unit test for this API to llvm/unittest/IR/IntrinsicsTest.cpp ?
https://github.com/llvm/llvm-project/pull/168188
More information about the llvm-commits
mailing list