[PGO] Change hardcoded thresholds for cold/inlinehint to use summary

Summary:
The PGO counter reading will add cold and inlinehint (hot) attributes
to functions that are very cold or hot. This was using hardcoded
thresholds, instead of the profile summary cutoffs which are used in
other hot/cold detection and are more dynamic and adaptable. Switch
to using the summary-based cold/hot detection.

The hardcoded limits were causing some code that had a medium level of
hotness (per the summary) to be incorrectly marked with a cold
attribute, blocking inlining.

Reviewers: davidxl

Subscribers: llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D67673

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372189 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Teresa Johnson
2019-09-17 23:12:13 +00:00
parent ffd5316983
commit 584a08b94d
4 changed files with 60 additions and 34 deletions
+6 -6
View File
@@ -783,13 +783,13 @@ IndexedInstrProfReader::readSummary(IndexedInstrProf::ProfVersion Version,
SummaryData->get(Summary::TotalNumFunctions));
return Cur + SummarySize;
} else {
// For older version of profile data, we need to compute on the fly:
using namespace IndexedInstrProf;
// The older versions do not support a profile summary. This just computes
// an empty summary, which will not result in accurate hot/cold detection.
// We would need to call addRecord for all NamedInstrProfRecords to get the
// correct summary. However, this version is old (prior to early 2016) and
// has not been supporting an accurate summary for several years.
InstrProfSummaryBuilder Builder(ProfileSummaryBuilder::DefaultCutoffs);
// FIXME: This only computes an empty summary. Need to call addRecord for
// all NamedInstrProfRecords to get the correct summary.
this->Summary = Builder.getSummary();
Summary = Builder.getSummary();
return Cur;
}
}