[CSSPGO] Skip dangling probe value when computing profile summary

Recently we switched to use InvalidProbeCount = UINT64_MAX (instead of 0) to represent dangling probe, but UINT64_MAX is not excluded when computing profile summary. This caused profile summary to produce incorrect hot/cold threshold. The change fixed it by excluding UINT64_MAX from summary builder.

Differential Revision: https://reviews.llvm.org/D99788
This commit is contained in:
Wenlei He 2021-04-01 22:04:40 -07:00
parent 438b6dd3e5
commit c5605857bb
1 changed files with 6 additions and 2 deletions

View File

@ -68,8 +68,12 @@ void SampleProfileSummaryBuilder::addRecord(
if (FS.getHeadSamples() > MaxFunctionCount)
MaxFunctionCount = FS.getHeadSamples();
}
for (const auto &I : FS.getBodySamples())
addCount(I.second.getSamples());
for (const auto &I : FS.getBodySamples()) {
uint64_t Count = I.second.getSamples();
if (!sampleprof::FunctionSamples::ProfileIsProbeBased ||
(Count != sampleprof::FunctionSamples::InvalidProbeCount))
addCount(Count);
}
for (const auto &I : FS.getCallsiteSamples())
for (const auto &CS : I.second)
addRecord(CS.second, true);