diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-01-26 21:31:24 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-01-26 21:31:24 +0000 |
commit | cab470b17a54cd9c4a04275ea57a75d4e8a79c70 (patch) | |
tree | 43a763c1f3d354615e592543876df9febd865253 /llvm/lib/Analysis | |
parent | 303a1beea639cc5920aceae724800de59c5bccf9 (diff) | |
download | bcm5719-llvm-cab470b17a54cd9c4a04275ea57a75d4e8a79c70.tar.gz bcm5719-llvm-cab470b17a54cd9c4a04275ea57a75d4e8a79c70.zip |
Skip calculation of ArgumentWeights if it will never be used.
Save a few bytes by allocating the correct size vector.
No functional change intended.
llvm-svn: 94589
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r-- | llvm/lib/Analysis/InlineCost.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp index 651c918a37f..595d41c3418 100644 --- a/llvm/lib/Analysis/InlineCost.cpp +++ b/llvm/lib/Analysis/InlineCost.cpp @@ -223,8 +223,14 @@ void InlineCostAnalyzer::FunctionInfo::analyzeFunction(Function *F) { if (Metrics.NumRets==1) --Metrics.NumInsts; + // Don't bother calculating argument weights if we are never going to inline + // the function anyway. + if (Metrics.NeverInline) + return; + // Check out all of the arguments to the function, figuring out how much // code can be eliminated if one of the arguments is a constant. + ArgumentWeights.reserve(F->arg_size()); for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I) ArgumentWeights.push_back(ArgInfo(CountCodeReductionForConstant(I), CountCodeReductionForAlloca(I))); |