[llvm-commits] [llvm] r55745 - /llvm/trunk/lib/Transforms/IPO/Inliner.cpp

Devang Patel dpatel at apple.com
Wed Sep 3 16:06:09 PDT 2008


Author: dpatel
Date: Wed Sep  3 18:06:09 2008
New Revision: 55745

URL: http://llvm.org/viewvc/llvm-project?rev=55745&view=rev
Log:
Update inline threshold for current function if the notes say, optimize for size.

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

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

==============================================================================
--- llvm/trunk/lib/Transforms/IPO/Inliner.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/Inliner.cpp Wed Sep  3 18:06:09 2008
@@ -139,8 +139,15 @@
         CallSite CS = CallSites[CSi];
         int InlineCost = getInlineCost(CS);
         float FudgeFactor = getInlineFudgeFactor(CS);
-
-        if (InlineCost >= (int)(InlineThreshold * FudgeFactor)) {
+        
+        int CurrentThreshold = InlineThreshold;
+        Function *Fn = CS.getCaller();
+        if (Fn && (Fn->getNotes() & FN_NOTE_OptimizeForSize)
+            && InlineThreshold != 50) {
+          CurrentThreshold = 50;
+        }
+        
+        if (InlineCost >= (int)(CurrentThreshold * FudgeFactor)) {
           DOUT << "    NOT Inlining: cost=" << InlineCost
                << ", Call: " << *CS.getInstruction();
         } else {





More information about the llvm-commits mailing list