Skip to content

Commit

Permalink
[llvm-profgen] Fix to use getUntrackedCallsites outside the loop
Browse files Browse the repository at this point in the history
Unwinder is hoisted out in https://reviews.llvm.org/D115550, so fix the useage of getUntrackedCallsites.

Reviewed By: hoy, wenlei

Differential Revision: https://reviews.llvm.org/D115760
  • Loading branch information
wlei-llvm committed Dec 15, 2021
1 parent 3dcb60d commit 30c3aba
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions llvm/tools/llvm-profgen/PerfReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,25 +435,22 @@ static std::string getContextKeyStr(ContextKey *K,
void HybridPerfReader::unwindSamples() {
if (Binary->useFSDiscriminator())
exitWithError("FS discriminator is not supported in CS profile.");
std::set<uint64_t> AllUntrackedCallsites;
VirtualUnwinder Unwinder(&SampleCounters, Binary);
for (const auto &Item : AggregatedSamples) {
const PerfSample *Sample = Item.first.getPtr();
Unwinder.unwind(Sample, Item.second);
auto &CurrUntrackedCallsites = Unwinder.getUntrackedCallsites();
AllUntrackedCallsites.insert(CurrUntrackedCallsites.begin(),
CurrUntrackedCallsites.end());
}

// Warn about untracked frames due to missing probes.
if (ShowDetailedWarning) {
for (auto Address : AllUntrackedCallsites)
for (auto Address : Unwinder.getUntrackedCallsites())
WithColor::warning() << "Profile context truncated due to missing probe "
<< "for call instruction at "
<< format("0x%" PRIx64, Address) << "\n";
}

emitWarningSummary(AllUntrackedCallsites.size(), SampleCounters.size(),
emitWarningSummary(Unwinder.getUntrackedCallsites().size(),
SampleCounters.size(),
"of profiled contexts are truncated due to missing probe "
"for call instruction.");
}
Expand Down

0 comments on commit 30c3aba

Please sign in to comment.