[llvm] 2a67c28 - [IR] Update getOrInsertFunction() docs for opaque pointers (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 1 01:14:57 PST 2024
Author: Nikita Popov
Date: 2024-03-01T10:14:49+01:00
New Revision: 2a67c28abe8cfde47c5058abbeb4b5ff9a393192
URL: https://github.com/llvm/llvm-project/commit/2a67c28abe8cfde47c5058abbeb4b5ff9a393192
DIFF: https://github.com/llvm/llvm-project/commit/2a67c28abe8cfde47c5058abbeb4b5ff9a393192.diff
LOG: [IR] Update getOrInsertFunction() docs for opaque pointers (NFC)
This can no longer return a bitcast, but the function type in
FunctionCallee may differ from the function type of the function.
Added:
Modified:
llvm/include/llvm/IR/Module.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/IR/Module.h b/llvm/include/llvm/IR/Module.h
index e41a5940540b4d..bb2e667ef6f410 100644
--- a/llvm/include/llvm/IR/Module.h
+++ b/llvm/include/llvm/IR/Module.h
@@ -385,17 +385,14 @@ class LLVM_EXTERNAL_VISIBILITY Module {
/// @name Function Accessors
/// @{
- /// Look up the specified function in the module symbol table. Four
- /// possibilities:
- /// 1. If it does not exist, add a prototype for the function and return it.
- /// 2. Otherwise, if the existing function has the correct prototype, return
- /// the existing function.
- /// 3. Finally, the function exists but has the wrong prototype: return the
- /// function with a constantexpr cast to the right prototype.
+ /// Look up the specified function in the module symbol table. If it does not
+ /// exist, add a prototype for the function and return it. Otherwise, return
+ /// the existing function.
///
/// In all cases, the returned value is a FunctionCallee wrapper around the
- /// 'FunctionType *T' passed in, as well as a 'Value*' either of the Function or
- /// the bitcast to the function.
+ /// 'FunctionType *T' passed in, as well as the 'Value*' of the Function. The
+ /// function type of the function may
diff er from the function type stored in
+ /// FunctionCallee if it was previously created with a
diff erent type.
///
/// Note: For library calls getOrInsertLibFunc() should be used instead.
FunctionCallee getOrInsertFunction(StringRef Name, FunctionType *T,
@@ -403,12 +400,8 @@ class LLVM_EXTERNAL_VISIBILITY Module {
FunctionCallee getOrInsertFunction(StringRef Name, FunctionType *T);
- /// Look up the specified function in the module symbol table. If it does not
- /// exist, add a prototype for the function and return it. This function
- /// guarantees to return a constant of pointer to the specified function type
- /// or a ConstantExpr BitCast of that type if the named function has a
- ///
diff erent type. This version of the method takes a list of
- /// function arguments, which makes it easier for clients to use.
+ /// Same as above, but takes a list of function arguments, which makes it
+ /// easier for clients to use.
template <typename... ArgsTy>
FunctionCallee getOrInsertFunction(StringRef Name,
AttributeList AttributeList, Type *RetTy,
More information about the llvm-commits
mailing list