aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Function.cpp
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2023-11-22 11:18:43 +0100
committerGitHub <noreply@github.com>2023-11-22 11:18:43 +0100
commit510fb8711e9ad68afdf2b9ef0f2bbf312bf9ccf5 (patch)
tree0318f9d62070977b90d42f0a5f6929bb34b9b6bb /llvm/lib/IR/Function.cpp
parent74cdb8e6f8c88b97204f540601a553b412d1cd56 (diff)
downloadllvm-510fb8711e9ad68afdf2b9ef0f2bbf312bf9ccf5.zip
llvm-510fb8711e9ad68afdf2b9ef0f2bbf312bf9ccf5.tar.gz
llvm-510fb8711e9ad68afdf2b9ef0f2bbf312bf9ccf5.tar.bz2
[IR][TLI] Cache getLibFunc() result on Function (NFC) (#72867)
Cache the result of the TLI libfunc lookup in the Function object. This only caches the actual lookup of the LibFunc in the TLI map, but not the prototype validation, as that might differ between different TLI instances. This uses the existing mechanism for invalidating the intrinsic ID when the function name changes. The libfunc will be invalidated in that case as well. I don't believe this increases the size of Function on 64bit (which currently has a trailing `bool` member), and I don't think we would particularly care if it did, as Functions are uncommon as Values go.
Diffstat (limited to 'llvm/lib/IR/Function.cpp')
-rw-r--r--llvm/lib/IR/Function.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp
index 49e0c1c..c3706dc 100644
--- a/llvm/lib/IR/Function.cpp
+++ b/llvm/lib/IR/Function.cpp
@@ -912,7 +912,8 @@ Intrinsic::ID Function::lookupIntrinsicID(StringRef Name) {
: Intrinsic::not_intrinsic;
}
-void Function::recalculateIntrinsicID() {
+void Function::updateAfterNameChange() {
+ LibFuncCache = UnknownLibFunc;
StringRef Name = getName();
if (!Name.startswith("llvm.")) {
HasLLVMReservedName = false;