forked from OSchip/llvm-project
Reapply [InlineCost] Enable the cost benefit analysis on FDO
This patch enables the cost-benefit-analysis-based inliner by default if we have instrumentation profile. - SPEC CPU 2017 shows a 0.4% improvement. - An internal large benchmark shows a 0.9% reduction in the cycle count along with 14.6% reduction in the number of call instructions executed. Differential Revision: https://reviews.llvm.org/D98213
This commit is contained in:
parent
3c775d93a1
commit
9d375a40c3
|
@ -675,15 +675,22 @@ class InlineCostCallAnalyzer final : public CallAnalyzer {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isCostBenefitAnalysisEnabled() {
|
bool isCostBenefitAnalysisEnabled() {
|
||||||
if (!InlineEnableCostBenefitAnalysis)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!PSI || !PSI->hasProfileSummary())
|
if (!PSI || !PSI->hasProfileSummary())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!GetBFI)
|
if (!GetBFI)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (InlineEnableCostBenefitAnalysis.getNumOccurrences()) {
|
||||||
|
// Honor the explicit request from the user.
|
||||||
|
if (!InlineEnableCostBenefitAnalysis)
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
// Otherwise, require instrumentation profile.
|
||||||
|
if (!PSI->hasInstrumentationProfile())
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
auto *Caller = CandidateCall.getParent()->getParent();
|
auto *Caller = CandidateCall.getParent()->getParent();
|
||||||
if (!Caller->getEntryCount())
|
if (!Caller->getEntryCount())
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue