Skip to content

Commit 192b13b

Browse files
[ProfileData] Avoid repeated hash lookups (NFC) (#129194)
1 parent 50064db commit 192b13b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

llvm/lib/ProfileData/InstrProfWriter.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,15 +230,16 @@ void InstrProfWriter::overlapRecord(NamedInstrProfRecord &&Other,
230230
auto Name = Other.Name;
231231
auto Hash = Other.Hash;
232232
Other.accumulateCounts(FuncLevelOverlap.Test);
233-
if (!FunctionData.contains(Name)) {
233+
auto It = FunctionData.find(Name);
234+
if (It == FunctionData.end()) {
234235
Overlap.addOneUnique(FuncLevelOverlap.Test);
235236
return;
236237
}
237238
if (FuncLevelOverlap.Test.CountSum < 1.0f) {
238239
Overlap.Overlap.NumEntries += 1;
239240
return;
240241
}
241-
auto &ProfileDataMap = FunctionData[Name];
242+
auto &ProfileDataMap = It->second;
242243
bool NewFunc;
243244
ProfilingData::iterator Where;
244245
std::tie(Where, NewFunc) =

0 commit comments

Comments
 (0)