[llvm] 4bda953 - [llvm-profgen] Avoid repeated hash lookups (NFC) (#127028)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 13 09:12:36 PST 2025
Author: Kazu Hirata
Date: 2025-02-13T09:12:33-08:00
New Revision: 4bda95304ff892d31c3ff7a89f75df25c0fa3bb9
URL: https://github.com/llvm/llvm-project/commit/4bda95304ff892d31c3ff7a89f75df25c0fa3bb9
DIFF: https://github.com/llvm/llvm-project/commit/4bda95304ff892d31c3ff7a89f75df25c0fa3bb9.diff
LOG: [llvm-profgen] Avoid repeated hash lookups (NFC) (#127028)
Added:
Modified:
llvm/tools/llvm-profgen/MissingFrameInferrer.cpp
Removed:
################################################################################
diff --git a/llvm/tools/llvm-profgen/MissingFrameInferrer.cpp b/llvm/tools/llvm-profgen/MissingFrameInferrer.cpp
index eefe38cd3fa00..ac88fced9159c 100644
--- a/llvm/tools/llvm-profgen/MissingFrameInferrer.cpp
+++ b/llvm/tools/llvm-profgen/MissingFrameInferrer.cpp
@@ -238,12 +238,13 @@ bool MissingFrameInferrer::inferMissingFrames(
return false;
// Bail out if caller has no known outgoing call edges.
- if (!CallEdgesF.count(From))
+ auto It = CallEdgesF.find(From);
+ if (It == CallEdgesF.end())
return false;
// Done with the inference if the calle is reachable via a single callsite.
// This may not be accurate but it improves the search throughput.
- if (llvm::is_contained(CallEdgesF[From], ToFRange->Func))
+ if (llvm::is_contained(It->second, ToFRange->Func))
return true;
// Bail out if callee is not tailcall reachable at all.
@@ -253,7 +254,7 @@ bool MissingFrameInferrer::inferMissingFrames(
Visiting.clear();
CurSearchingDepth = 0;
uint64_t NumPaths = 0;
- for (auto Target : CallEdgesF[From]) {
+ for (auto Target : It->second) {
NumPaths +=
computeUniqueTailCallPath(Target, ToFRange->Func, UniquePath);
// Stop analyzing the remaining if we are already seeing more than one
More information about the llvm-commits
mailing list