[PATCH] D37819: [Inliner] Add another way to compute full inline cost.

Easwaran Raman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 13 13:17:30 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL313185: [Inliner] Add another way to compute full inline cost. (authored by eraman).

Repository:
  rL LLVM

https://reviews.llvm.org/D37819

Files:
  llvm/trunk/include/llvm/Analysis/InlineCost.h
  llvm/trunk/lib/Analysis/InlineCost.cpp


Index: llvm/trunk/include/llvm/Analysis/InlineCost.h
===================================================================
--- llvm/trunk/include/llvm/Analysis/InlineCost.h
+++ llvm/trunk/include/llvm/Analysis/InlineCost.h
@@ -152,6 +152,9 @@
 
   /// Threshold to use when the callsite is considered cold.
   Optional<int> ColdCallSiteThreshold;
+
+  /// Compute inline cost even when the cost has exceeded the threshold.
+  Optional<bool> ComputeFullInlineCost;
 };
 
 /// Generate the parameters to tune the inline cost analysis based only on the
Index: llvm/trunk/lib/Analysis/InlineCost.cpp
===================================================================
--- llvm/trunk/lib/Analysis/InlineCost.cpp
+++ llvm/trunk/lib/Analysis/InlineCost.cpp
@@ -82,7 +82,7 @@
              "entry frequency, for a callsite to be hot in the absence of "
              "profile information."));
 
-static cl::opt<bool> ComputeFullInlineCost(
+static cl::opt<bool> OptComputeFullInlineCost(
     "inline-cost-full", cl::Hidden, cl::init(false),
     cl::desc("Compute the full inline cost of a call site even when the cost "
              "exceeds the threshold."));
@@ -124,6 +124,7 @@
 
   int Threshold;
   int Cost;
+  bool ComputeFullInlineCost;
 
   bool IsCallerRecursive;
   bool IsRecursiveCall;
@@ -256,7 +257,9 @@
       : TTI(TTI), GetAssumptionCache(GetAssumptionCache), GetBFI(GetBFI),
         PSI(PSI), F(Callee), DL(F.getParent()->getDataLayout()), ORE(ORE),
         CandidateCS(CSArg), Params(Params), Threshold(Params.DefaultThreshold),
-        Cost(0), IsCallerRecursive(false), IsRecursiveCall(false),
+        Cost(0), ComputeFullInlineCost(OptComputeFullInlineCost ||
+                                       Params.ComputeFullInlineCost || ORE),
+        IsCallerRecursive(false), IsRecursiveCall(false),
         ExposesReturnsTwice(false), HasDynamicAlloca(false),
         ContainsNoDuplicateCall(false), HasReturn(false), HasIndirectBr(false),
         HasFrameEscape(false), AllocatedSize(0), NumInstructions(0),
@@ -1722,9 +1725,6 @@
       CS.isNoInline())
     return llvm::InlineCost::getNever();
 
-  if (ORE)
-    ComputeFullInlineCost = true;
-
   DEBUG(llvm::dbgs() << "      Analyzing call of " << Callee->getName()
                      << "... (caller:" << Caller->getName() << ")\n");
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37819.115107.patch
Type: text/x-patch
Size: 2316 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170913/c1842dec/attachment.bin>


More information about the llvm-commits mailing list