From e4e094b52d278ea112cadd6aef5e565e1a2bcb1d Mon Sep 17 00:00:00 2001 From: Dale Johannesen Date: Sat, 24 Jan 2009 01:27:33 +0000 Subject: [PATCH] Improve the inlining cost function a bit. 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 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/Transforms/Utils/InlineCost.cpp b/lib/Transforms/Utils/InlineCost.cpp index 80516723d0c..37d2c0352ac 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(II)) - NumInsts += 5; + // cost to reflect this. Allow an extra instruction per parameter. + if (!isa(II)) { + for (CallSite::arg_iterator I = CS.arg_begin(), E = CS.arg_end(); + I != E; ++I) + NumInsts ++; + } } if (const AllocaInst *AI = dyn_cast(II)) { -- 2.34.1