Skip to content

Commit 9d375a4

Browse files
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
1 parent 3c775d9 commit 9d375a4

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

llvm/lib/Analysis/InlineCost.cpp

+10-3
Original file line numberDiff line numberDiff line change
@@ -675,15 +675,22 @@ class InlineCostCallAnalyzer final : public CallAnalyzer {
675675
}
676676

677677
bool isCostBenefitAnalysisEnabled() {
678-
if (!InlineEnableCostBenefitAnalysis)
679-
return false;
680-
681678
if (!PSI || !PSI->hasProfileSummary())
682679
return false;
683680

684681
if (!GetBFI)
685682
return false;
686683

684+
if (InlineEnableCostBenefitAnalysis.getNumOccurrences()) {
685+
// Honor the explicit request from the user.
686+
if (!InlineEnableCostBenefitAnalysis)
687+
return false;
688+
} else {
689+
// Otherwise, require instrumentation profile.
690+
if (!PSI->hasInstrumentationProfile())
691+
return false;
692+
}
693+
687694
auto *Caller = CandidateCall.getParent()->getParent();
688695
if (!Caller->getEntryCount())
689696
return false;

0 commit comments

Comments
 (0)