Skip to content

Commit a42ac55

Browse files
[IPO] Avoid repeated hash lookups (NFC) (#135750)
1 parent f28408f commit a42ac55

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4099,14 +4099,14 @@ bool CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::assignFunctions() {
40994099
assert(FuncClonesToCallMap.count(FuncClone));
41004100
std::map<CallInfo, CallInfo> &CallMap = FuncClonesToCallMap[FuncClone];
41014101
CallInfo CallClone(Call);
4102-
if (CallMap.count(Call))
4103-
CallClone = CallMap[Call];
4102+
if (auto It = CallMap.find(Call); It != CallMap.end())
4103+
CallClone = It->second;
41044104
CallsiteClone->setCall(CallClone);
41054105
// Need to do the same for all matching calls.
41064106
for (auto &MatchingCall : Node->MatchingCalls) {
41074107
CallInfo CallClone(MatchingCall);
4108-
if (CallMap.count(MatchingCall))
4109-
CallClone = CallMap[MatchingCall];
4108+
if (auto It = CallMap.find(MatchingCall); It != CallMap.end())
4109+
CallClone = It->second;
41104110
// Updates the call in the list.
41114111
MatchingCall = CallClone;
41124112
}

0 commit comments

Comments
 (0)