[llvm-commits] [llvm] r55712 - in /llvm/trunk/lib/Transforms: IPO/Inliner.cpp Utils/InlineCost.cpp

Devang Patel dpatel at apple.com
Wed Sep 3 11:47:45 PDT 2008


Author: dpatel
Date: Wed Sep  3 13:47:45 2008
New Revision: 55712

URL: http://llvm.org/viewvc/llvm-project?rev=55712&view=rev
Log:
Handle "always inline" note during inline cost analysis.

Modified:
    llvm/trunk/lib/Transforms/IPO/Inliner.cpp
    llvm/trunk/lib/Transforms/Utils/InlineCost.cpp

Modified: llvm/trunk/lib/Transforms/IPO/Inliner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/Inliner.cpp?rev=55712&r1=55711&r2=55712&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/IPO/Inliner.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/Inliner.cpp Wed Sep  3 13:47:45 2008
@@ -140,12 +140,7 @@
         int InlineCost = getInlineCost(CS);
         float FudgeFactor = getInlineFudgeFactor(CS);
 
-        Function *Fn = CS.getCalledFunction();
-        bool AlwaysInline = false;
-        if (Fn && (Fn->getNotes() & FN_NOTE_AlwaysInline))
-          AlwaysInline = true;
-        if (!AlwaysInline 
-            && InlineCost >= (int)(InlineThreshold * FudgeFactor)) {
+        if (InlineCost >= (int)(InlineThreshold * FudgeFactor)) {
           DOUT << "    NOT Inlining: cost=" << InlineCost
                << ", Call: " << *CS.getInstruction();
         } else {

Modified: llvm/trunk/lib/Transforms/Utils/InlineCost.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/InlineCost.cpp?rev=55712&r1=55711&r2=55712&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Utils/InlineCost.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/InlineCost.cpp Wed Sep  3 13:47:45 2008
@@ -221,6 +221,9 @@
   // If we should never inline this, return a huge cost.
   if (CalleeFI.NeverInline)
     return 2000000000;
+
+  if (Callee->getNotes() & FN_NOTE_AlwaysInline)
+    return -2000000000;
     
   // Add to the inline quality for properties that make the call valuable to
   // inline.  This includes factors that indicate that the result of inlining





More information about the llvm-commits mailing list