Skip to content

Commit 65cd3cb

Browse files
[Inliner] Compute the full cost for the cost benefit analsysis
This patch teaches the inliner to compute the full cost for a call site where the newly introduced cost benefit analysis is enabled. Note that the cost benefit analysis requires the full cost to be computed. However, without this patch or the -inline-cost-full option, the early termination logic would kick in when the cost exceeds the threshold, so we don't get to perform the cost benefit analysis. For this reason, we would need to specify four clang options: -mllvm -inline-cost-full -mllvm -inline-enable-cost-benefit-analysis This patch eliminates the need to specify -inline-cost-full. Differential Revision: https://reviews.llvm.org/D93658
1 parent 4ef91f5 commit 65cd3cb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

llvm/lib/Analysis/InlineCost.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,8 @@ class InlineCostCallAnalyzer final : public CallAnalyzer {
901901
bool IgnoreThreshold = false)
902902
: CallAnalyzer(Callee, Call, TTI, GetAssumptionCache, GetBFI, PSI, ORE),
903903
ComputeFullInlineCost(OptComputeFullInlineCost ||
904-
Params.ComputeFullInlineCost || ORE),
904+
Params.ComputeFullInlineCost || ORE ||
905+
isCostBenefitAnalysisEnabled()),
905906
Params(Params), Threshold(Params.DefaultThreshold),
906907
BoostIndirectCalls(BoostIndirect), IgnoreThreshold(IgnoreThreshold),
907908
CostBenefitAnalysisEnabled(isCostBenefitAnalysisEnabled()),

0 commit comments

Comments
 (0)