aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/ProfileInfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Analysis/ProfileInfo.cpp')
-rw-r--r--lib/Analysis/ProfileInfo.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Analysis/ProfileInfo.cpp b/lib/Analysis/ProfileInfo.cpp
index a7fc4c49d5..fdbf03cc34 100644
--- a/lib/Analysis/ProfileInfo.cpp
+++ b/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;