[llvm-branch-commits] [llvm] 65cd3cb - [Inliner] Compute the full cost for the cost benefit analsysis

Kazu Hirata via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Jan 5 12:54:03 PST 2021


Author: Kazu Hirata
Date: 2021-01-05T12:48:49-08:00
New Revision: 65cd3cbb3fc9ee440234a5adbfea6cbe4834f3d3

URL: https://github.com/llvm/llvm-project/commit/65cd3cbb3fc9ee440234a5adbfea6cbe4834f3d3
DIFF: https://github.com/llvm/llvm-project/commit/65cd3cbb3fc9ee440234a5adbfea6cbe4834f3d3.diff

LOG: [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

Added: 
    

Modified: 
    llvm/lib/Analysis/InlineCost.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp
index bf8d9c98aa0e..ff589b86bb50 100644
--- a/llvm/lib/Analysis/InlineCost.cpp
+++ b/llvm/lib/Analysis/InlineCost.cpp
@@ -901,7 +901,8 @@ class InlineCostCallAnalyzer final : public CallAnalyzer {
       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()),


        


More information about the llvm-branch-commits mailing list