aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/InlineCost.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2021-01-05 12:48:49 -0800
committerKazu Hirata <kazu@google.com>2021-01-05 12:48:49 -0800
commit65cd3cbb3fc9ee440234a5adbfea6cbe4834f3d3 (patch)
treef2d5a2bf40e5cc6b682c62e402b2733fe04ebc4d /llvm/lib/Analysis/InlineCost.cpp
parent4ef91f5871a3c38bb2324f89b47a2a845e8a33fd (diff)
downloadllvm-65cd3cbb3fc9ee440234a5adbfea6cbe4834f3d3.zip
llvm-65cd3cbb3fc9ee440234a5adbfea6cbe4834f3d3.tar.gz
llvm-65cd3cbb3fc9ee440234a5adbfea6cbe4834f3d3.tar.bz2
[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
Diffstat (limited to 'llvm/lib/Analysis/InlineCost.cpp')
-rw-r--r--llvm/lib/Analysis/InlineCost.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp
index bf8d9c9..ff589b8 100644
--- a/llvm/lib/Analysis/InlineCost.cpp
+++ b/llvm/lib/Analysis/InlineCost.cpp
@@ -901,7 +901,8 @@ public:
bool IgnoreThreshold = false)
: CallAnalyzer(Callee, Call, TTI, GetAssumptionCache, GetBFI, PSI, ORE),
ComputeFullInlineCost(OptComputeFullInlineCost ||
- Params.ComputeFullInlineCost || ORE),
+ Params.ComputeFullInlineCost || ORE ||
+ isCostBenefitAnalysisEnabled()),
Params(Params), Threshold(Params.DefaultThreshold),
BoostIndirectCalls(BoostIndirect), IgnoreThreshold(IgnoreThreshold),
CostBenefitAnalysisEnabled(isCostBenefitAnalysisEnabled()),