[llvm] [NVPTX] Avoid repeated map lookups (NFC) (PR #127169)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 14 01:30:34 PST 2025
================
@@ -128,13 +128,16 @@ static std::optional<unsigned> findOneNVVMAnnotation(const GlobalValue *gv,
auto &AC = getAnnotationCache();
std::lock_guard<sys::Mutex> Guard(AC.Lock);
const Module *m = gv->getParent();
- if (AC.Cache.find(m) == AC.Cache.end())
+ auto ACIt = AC.Cache.find(m);
+ if (ACIt == AC.Cache.end())
cacheAnnotationFromMD(m, gv);
- else if (AC.Cache[m].find(gv) == AC.Cache[m].end())
+ else if (ACIt->second.find(gv) == ACIt->second.end())
cacheAnnotationFromMD(m, gv);
- if (AC.Cache[m][gv].find(prop) == AC.Cache[m][gv].end())
+ auto &KVP = AC.Cache[m][gv];
----------------
kazutakahirata wrote:
Revised. Thanks!
https://github.com/llvm/llvm-project/pull/127169
More information about the llvm-commits
mailing list