[llvm] [ProfileData] Avoid repeated hash lookups (NFC) (PR #129194)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 27 21:45:17 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-pgo
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/129194.diff
1 Files Affected:
- (modified) llvm/lib/ProfileData/InstrProfWriter.cpp (+3-2)
``````````diff
diff --git a/llvm/lib/ProfileData/InstrProfWriter.cpp b/llvm/lib/ProfileData/InstrProfWriter.cpp
index f112ea2efcaa9..18aa76c865bc8 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) =
``````````
</details>
https://github.com/llvm/llvm-project/pull/129194
More information about the llvm-commits
mailing list