Skip to content

Commit 4bda953

Browse files
[llvm-profgen] Avoid repeated hash lookups (NFC) (#127028)
1 parent 9a59145 commit 4bda953

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

llvm/tools/llvm-profgen/MissingFrameInferrer.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,12 +238,13 @@ bool MissingFrameInferrer::inferMissingFrames(
238238
return false;
239239

240240
// Bail out if caller has no known outgoing call edges.
241-
if (!CallEdgesF.count(From))
241+
auto It = CallEdgesF.find(From);
242+
if (It == CallEdgesF.end())
242243
return false;
243244

244245
// Done with the inference if the calle is reachable via a single callsite.
245246
// This may not be accurate but it improves the search throughput.
246-
if (llvm::is_contained(CallEdgesF[From], ToFRange->Func))
247+
if (llvm::is_contained(It->second, ToFRange->Func))
247248
return true;
248249

249250
// Bail out if callee is not tailcall reachable at all.
@@ -253,7 +254,7 @@ bool MissingFrameInferrer::inferMissingFrames(
253254
Visiting.clear();
254255
CurSearchingDepth = 0;
255256
uint64_t NumPaths = 0;
256-
for (auto Target : CallEdgesF[From]) {
257+
for (auto Target : It->second) {
257258
NumPaths +=
258259
computeUniqueTailCallPath(Target, ToFRange->Func, UniquePath);
259260
// Stop analyzing the remaining if we are already seeing more than one

0 commit comments

Comments
 (0)