[clang] 8e4e144 - [CodeGen] Avoid repeated hash lookups (NFC) (#126672)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 11 09:06:43 PST 2025
Author: Kazu Hirata
Date: 2025-02-11T09:06:40-08:00
New Revision: 8e4e1449318de0e73192edf0b3c6a0d5b6ec7a31
URL: https://github.com/llvm/llvm-project/commit/8e4e1449318de0e73192edf0b3c6a0d5b6ec7a31
DIFF: https://github.com/llvm/llvm-project/commit/8e4e1449318de0e73192edf0b3c6a0d5b6ec7a31.diff
LOG: [CodeGen] Avoid repeated hash lookups (NFC) (#126672)
Added:
Modified:
clang/lib/CodeGen/CGOpenMPRuntime.cpp
Removed:
################################################################################
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index cafaaa364cb76..b679d63874b3b 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -1457,14 +1457,13 @@ void CGOpenMPRuntime::functionFinished(CodeGenFunction &CGF) {
clearLocThreadIdInsertPt(CGF);
OpenMPLocThreadIDMap.erase(CGF.CurFn);
}
- if (FunctionUDRMap.count(CGF.CurFn) > 0) {
- for(const auto *D : FunctionUDRMap[CGF.CurFn])
+ if (auto I = FunctionUDRMap.find(CGF.CurFn); I != FunctionUDRMap.end()) {
+ for (const auto *D : I->second)
UDRMap.erase(D);
- FunctionUDRMap.erase(CGF.CurFn);
+ FunctionUDRMap.erase(I);
}
- auto I = FunctionUDMMap.find(CGF.CurFn);
- if (I != FunctionUDMMap.end()) {
- for(const auto *D : I->second)
+ if (auto I = FunctionUDMMap.find(CGF.CurFn); I != FunctionUDMMap.end()) {
+ for (const auto *D : I->second)
UDMMap.erase(D);
FunctionUDMMap.erase(I);
}
More information about the cfe-commits
mailing list