[llvm-commits] [llvm] r62908 - /llvm/trunk/lib/Transforms/Utils/InlineCost.cpp

Dale Johannesen dalej at apple.com
Fri Jan 23 17:27:34 PST 2009


Author: johannes
Date: Fri Jan 23 19:27:33 2009
New Revision: 62908

URL: http://llvm.org/viewvc/llvm-project?rev=62908&view=rev
Log:
Improve the inlining cost function a bit.
Little practical effect.


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

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

==============================================================================
--- llvm/trunk/lib/Transforms/Utils/InlineCost.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/InlineCost.cpp Fri Jan 23 19:27:33 2009
@@ -121,9 +121,12 @@
           }
         
         // Calls often compile into many machine instructions.  Bump up their
-        // cost to reflect this.
-        if (!isa<IntrinsicInst>(II))
-          NumInsts += 5;
+        // cost to reflect this.  Allow an extra instruction per parameter.
+        if (!isa<IntrinsicInst>(II)) {
+          for (CallSite::arg_iterator I = CS.arg_begin(), E = CS.arg_end();
+               I != E; ++I)
+            NumInsts ++;
+        }
       }
       
       if (const AllocaInst *AI = dyn_cast<AllocaInst>(II)) {





More information about the llvm-commits mailing list