Skip to content

Commit 8a7a66d

Browse files
kazutakahirataIcohedron
authored andcommitted
[CodeGen] Avoid repeated hash lookups (NFC) (llvm#126672)
1 parent 1c1bc96 commit 8a7a66d

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

clang/lib/CodeGen/CGOpenMPRuntime.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,14 +1457,13 @@ void CGOpenMPRuntime::functionFinished(CodeGenFunction &CGF) {
14571457
clearLocThreadIdInsertPt(CGF);
14581458
OpenMPLocThreadIDMap.erase(CGF.CurFn);
14591459
}
1460-
if (FunctionUDRMap.count(CGF.CurFn) > 0) {
1461-
for(const auto *D : FunctionUDRMap[CGF.CurFn])
1460+
if (auto I = FunctionUDRMap.find(CGF.CurFn); I != FunctionUDRMap.end()) {
1461+
for (const auto *D : I->second)
14621462
UDRMap.erase(D);
1463-
FunctionUDRMap.erase(CGF.CurFn);
1463+
FunctionUDRMap.erase(I);
14641464
}
1465-
auto I = FunctionUDMMap.find(CGF.CurFn);
1466-
if (I != FunctionUDMMap.end()) {
1467-
for(const auto *D : I->second)
1465+
if (auto I = FunctionUDMMap.find(CGF.CurFn); I != FunctionUDMMap.end()) {
1466+
for (const auto *D : I->second)
14681467
UDMMap.erase(D);
14691468
FunctionUDMMap.erase(I);
14701469
}

0 commit comments

Comments
 (0)