[llvm-profgen] Avoid repeated hash lookups (NFC) (#130466)

This commit is contained in:
Kazu Hirata 2025-03-09 00:49:37 -08:00 committed by GitHub
parent 573df34ea0
commit 99d2b3b0aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -165,14 +165,14 @@ uint64_t MissingFrameInferrer::computeUniqueTailCallPath(
if (CurSearchingDepth == MaximumSearchDepth)
return 0;
if (!FuncToTailCallMap.count(From))
auto It = FuncToTailCallMap.find(From);
if (It == FuncToTailCallMap.end())
return 0;
CurSearchingDepth++;
Visiting.insert(From);
uint64_t NumPaths = 0;
for (auto TailCall : FuncToTailCallMap[From]) {
for (auto TailCall : It->second) {
NumPaths += computeUniqueTailCallPath(TailCall, To, Path);
// Stop analyzing the remaining if we are already seeing more than one
// reachable paths.