[llvm-branch-commits] [llvm-branch] r96068 - /llvm/branches/Apple/Hermes/lib/Transforms/IPO/Inliner.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Fri Feb 12 17:53:08 PST 2010


Author: stoklund
Date: Fri Feb 12 19:53:07 2010
New Revision: 96068

URL: http://llvm.org/viewvc/llvm-project?rev=96068&view=rev
Log:
$ svn merge -c 96066 https://llvm.org/svn/llvm-project/llvm/trunk
--- Merging r96066 into '.':
U    lib/Transforms/IPO/Inliner.cpp

Modified:
    llvm/branches/Apple/Hermes/lib/Transforms/IPO/Inliner.cpp

Modified: llvm/branches/Apple/Hermes/lib/Transforms/IPO/Inliner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Hermes/lib/Transforms/IPO/Inliner.cpp?rev=96068&r1=96067&r2=96068&view=diff

==============================================================================
--- llvm/branches/Apple/Hermes/lib/Transforms/IPO/Inliner.cpp (original)
+++ llvm/branches/Apple/Hermes/lib/Transforms/IPO/Inliner.cpp Fri Feb 12 19:53:07 2010
@@ -41,12 +41,9 @@
 InlineLimit("inline-threshold", cl::Hidden, cl::init(225), cl::ZeroOrMore,
         cl::desc("Control the amount of inlining to perform (default = 225)"));
 
-static cl::opt<bool>
-RespectHint("respect-inlinehint", cl::Hidden,
-            cl::desc("Respect the inlinehint attribute"));
-
-// Threshold to use when inlinehint is given.
-const int HintThreshold = 300;
+static cl::opt<int>
+HintThreshold("inlinehint-threshold", cl::Hidden, cl::init(325),
+              cl::desc("Threshold for inlining functions with inline hint"));
 
 // Threshold to use when optsize is specified (and there is no -inline-limit).
 const int OptSizeThreshold = 75;
@@ -183,20 +180,22 @@
 }
 
 unsigned Inliner::getInlineThreshold(CallSite CS) const {
-  // Listen to inlinehint when -respect-inlinehint is given.
-  Function *Callee = CS.getCalledFunction();
-  if (RespectHint && Callee && !Callee->isDeclaration() &&
-      Callee->hasFnAttr(Attribute::InlineHint))
-    return HintThreshold;
+  int thres = InlineThreshold;
 
   // Listen to optsize when -inline-limit is not given.
   Function *Caller = CS.getCaller();
   if (Caller && !Caller->isDeclaration() &&
       Caller->hasFnAttr(Attribute::OptimizeForSize) &&
       InlineLimit.getNumOccurrences() == 0)
-      return OptSizeThreshold;
+    thres = OptSizeThreshold;
+
+  // Listen to inlinehint when it would increase the threshold.
+  Function *Callee = CS.getCalledFunction();
+  if (HintThreshold > thres && Callee && !Callee->isDeclaration() &&
+      Callee->hasFnAttr(Attribute::InlineHint))
+    thres = HintThreshold;
 
-  return InlineThreshold;
+  return thres;
 }
 
 /// shouldInline - Return true if the inliner should attempt to inline





More information about the llvm-branch-commits mailing list