Moved isDeclaration() check further down to allow for function counts for

declarations if necessary.

llvm-svn: 80084
This commit is contained in:
Andreas Neustifter 2009-08-26 13:33:09 +00:00
parent ffda9eb31a
commit 83489058d0
1 changed files with 4 additions and 1 deletions

View File

@ -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;