aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/LLVMContext.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2024-09-12 22:40:55 -0700
committerGitHub <noreply@github.com>2024-09-12 22:40:55 -0700
commita4d74644ba716d8c404720ccda90d42acee91917 (patch)
tree3f02949135e39ae25053a8d1f07aedf291dfe38e /llvm/lib/IR/LLVMContext.cpp
parent04f45aa7a7874ee6686fad267e44ed6c9b4de19c (diff)
downloadllvm-a4d74644ba716d8c404720ccda90d42acee91917.zip
llvm-a4d74644ba716d8c404720ccda90d42acee91917.tar.gz
llvm-a4d74644ba716d8c404720ccda90d42acee91917.tar.bz2
[IR] Avoid repeated hash lookups (NFC) (#108485)
Diffstat (limited to 'llvm/lib/IR/LLVMContext.cpp')
-rw-r--r--llvm/lib/IR/LLVMContext.cpp8
1 files changed, 1 insertions, 7 deletions
diff --git a/llvm/lib/IR/LLVMContext.cpp b/llvm/lib/IR/LLVMContext.cpp
index 194c7e7..c0fee93 100644
--- a/llvm/lib/IR/LLVMContext.cpp
+++ b/llvm/lib/IR/LLVMContext.cpp
@@ -331,13 +331,7 @@ void LLVMContext::getSyncScopeNames(SmallVectorImpl<StringRef> &SSNs) const {
}
void LLVMContext::setGC(const Function &Fn, std::string GCName) {
- auto It = pImpl->GCNames.find(&Fn);
-
- if (It == pImpl->GCNames.end()) {
- pImpl->GCNames.insert(std::make_pair(&Fn, std::move(GCName)));
- return;
- }
- It->second = std::move(GCName);
+ pImpl->GCNames[&Fn] = std::move(GCName);
}
const std::string &LLVMContext::getGC(const Function &Fn) {