Skip to content

Commit cf3aa06

Browse files
[Utils] Avoid repeated hash lookups (NFC) (#130464)
1 parent 7c7cebf commit cf3aa06

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

llvm/lib/Transforms/Utils/SimplifyCFG.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6883,9 +6883,10 @@ static bool switchToLookupTable(SwitchInst *SI, IRBuilder<> &Builder,
68836883
for (const auto &I : Results) {
68846884
PHINode *PHI = I.first;
68856885
Constant *Value = I.second;
6886-
if (!ResultLists.count(PHI))
6886+
auto [It, Inserted] = ResultLists.try_emplace(PHI);
6887+
if (Inserted)
68876888
PHIs.push_back(PHI);
6888-
ResultLists[PHI].push_back(std::make_pair(CaseVal, Value));
6889+
It->second.push_back(std::make_pair(CaseVal, Value));
68896890
}
68906891
}
68916892

0 commit comments

Comments
 (0)