summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/InlineCost.cpp
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2009-01-24 01:27:33 +0000
committerDale Johannesen <dalej@apple.com>2009-01-24 01:27:33 +0000
commit899ecdbbba5af65d84f85f25430c966a8d332187 (patch)
tree55a838818dae8b43ee934a94840d35775ae3c8e2 /llvm/lib/Transforms/Utils/InlineCost.cpp
parent72cd68fe64333b0e1005179fdbefacfa2db2e063 (diff)
downloadbcm5719-llvm-899ecdbbba5af65d84f85f25430c966a8d332187.tar.gz
bcm5719-llvm-899ecdbbba5af65d84f85f25430c966a8d332187.zip
Improve the inlining cost function a bit.
Little practical effect. llvm-svn: 62908
Diffstat (limited to 'llvm/lib/Transforms/Utils/InlineCost.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/InlineCost.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Utils/InlineCost.cpp b/llvm/lib/Transforms/Utils/InlineCost.cpp
index 80516723d0c..37d2c0352ac 100644
--- a/llvm/lib/Transforms/Utils/InlineCost.cpp
+++ b/llvm/lib/Transforms/Utils/InlineCost.cpp
@@ -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)) {
OpenPOWER on IntegriCloud