Improve the inlining cost function a bit.
authorDale Johannesen <dalej@apple.com>
Sat, 24 Jan 2009 01:27:33 +0000 (01:27 +0000)
committerDale Johannesen <dalej@apple.com>
Sat, 24 Jan 2009 01:27:33 +0000 (01:27 +0000)
Little practical effect.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62908 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Utils/InlineCost.cpp

index 80516723d0ca6f3feaf122156a01fc3e947b6fee..37d2c0352aced657671422157cc12ecc25e0d238 100644 (file)
@@ -121,9 +121,12 @@ void InlineCostAnalyzer::FunctionInfo::analyzeFunction(Function *F) {
           }
         
         // 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)) {