aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils/InlineCost.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Transforms/Utils/InlineCost.cpp')
-rw-r--r--lib/Transforms/Utils/InlineCost.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/Transforms/Utils/InlineCost.cpp b/lib/Transforms/Utils/InlineCost.cpp
index 80516723d0..37d2c0352a 100644
--- a/lib/Transforms/Utils/InlineCost.cpp
+++ b/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)) {