summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/ProfileInfo.cpp
diff options
context:
space:
mode:
authorAndreas Neustifter <astifter-llvm@gmx.at>2009-08-26 13:33:09 +0000
committerAndreas Neustifter <astifter-llvm@gmx.at>2009-08-26 13:33:09 +0000
commit83489058d018145ba25ca827f591a6eb4b6ec88a (patch)
treeeef538881c868b32b33ad3e9c78a774619f4330f /llvm/lib/Analysis/ProfileInfo.cpp
parentffda9eb31a5f7316e6fd264fe11a43aec319ad42 (diff)
downloadbcm5719-llvm-83489058d018145ba25ca827f591a6eb4b6ec88a.tar.gz
bcm5719-llvm-83489058d018145ba25ca827f591a6eb4b6ec88a.zip
Moved isDeclaration() check further down to allow for function counts for
declarations if necessary. llvm-svn: 80084
Diffstat (limited to 'llvm/lib/Analysis/ProfileInfo.cpp')
-rw-r--r--llvm/lib/Analysis/ProfileInfo.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/ProfileInfo.cpp b/llvm/lib/Analysis/ProfileInfo.cpp
index a7fc4c49d5e..fdbf03cc34d 100644
--- a/llvm/lib/Analysis/ProfileInfo.cpp
+++ b/llvm/lib/Analysis/ProfileInfo.cpp
@@ -67,12 +67,15 @@ double ProfileInfo::getExecutionCount(const BasicBlock *BB) {
}
double ProfileInfo::getExecutionCount(const Function *F) {
- if (F->isDeclaration()) return MissingValue;
std::map<const Function*, double>::iterator J =
FunctionInformation.find(F);
if (J != FunctionInformation.end())
return J->second;
+ // isDeclaration() is checked here and not at start of function to allow
+ // functions without a body still to have a execution count.
+ if (F->isDeclaration()) return MissingValue;
+
double Count = getExecutionCount(&F->getEntryBlock());
if (Count != MissingValue) FunctionInformation[F] = Count;
return Count;
OpenPOWER on IntegriCloud