diff options
author | Kazu Hirata <kazu@google.com> | 2025-02-27 22:41:46 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-27 22:41:46 -0800 |
commit | 192b13bc9fa914d4ca87f2cd43aec40650ed5663 (patch) | |
tree | f892b3c14961cd6391d7a7eb823c2e6caa04e093 /llvm/lib/ProfileData/InstrProfWriter.cpp | |
parent | 50064db174acf672c7e72e10a72d1302c7aecadd (diff) | |
download | llvm-192b13bc9fa914d4ca87f2cd43aec40650ed5663.zip llvm-192b13bc9fa914d4ca87f2cd43aec40650ed5663.tar.gz llvm-192b13bc9fa914d4ca87f2cd43aec40650ed5663.tar.bz2 |
[ProfileData] Avoid repeated hash lookups (NFC) (#129194)
Diffstat (limited to 'llvm/lib/ProfileData/InstrProfWriter.cpp')
-rw-r--r-- | llvm/lib/ProfileData/InstrProfWriter.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/ProfileData/InstrProfWriter.cpp b/llvm/lib/ProfileData/InstrProfWriter.cpp index f112ea2..18aa76c 100644 --- a/llvm/lib/ProfileData/InstrProfWriter.cpp +++ b/llvm/lib/ProfileData/InstrProfWriter.cpp @@ -230,7 +230,8 @@ void InstrProfWriter::overlapRecord(NamedInstrProfRecord &&Other, auto Name = Other.Name; auto Hash = Other.Hash; Other.accumulateCounts(FuncLevelOverlap.Test); - if (!FunctionData.contains(Name)) { + auto It = FunctionData.find(Name); + if (It == FunctionData.end()) { Overlap.addOneUnique(FuncLevelOverlap.Test); return; } @@ -238,7 +239,7 @@ void InstrProfWriter::overlapRecord(NamedInstrProfRecord &&Other, Overlap.Overlap.NumEntries += 1; return; } - auto &ProfileDataMap = FunctionData[Name]; + auto &ProfileDataMap = It->second; bool NewFunc; ProfilingData::iterator Where; std::tie(Where, NewFunc) = |