diff options
author | Andreas Neustifter <astifter-llvm@gmx.at> | 2009-08-26 13:33:09 +0000 |
---|---|---|
committer | Andreas Neustifter <astifter-llvm@gmx.at> | 2009-08-26 13:33:09 +0000 |
commit | 3772fb11feabfa304faddaaf902eaf57307766af (patch) | |
tree | 1bbdf9ab7b4864d7e8ea7de6685964819aa48931 /lib/Analysis/ProfileInfo.cpp | |
parent | 383cbff0311237bfd60daaa77d07bc9785a07ee8 (diff) | |
download | llvm-3772fb11feabfa304faddaaf902eaf57307766af.tar.gz llvm-3772fb11feabfa304faddaaf902eaf57307766af.tar.bz2 llvm-3772fb11feabfa304faddaaf902eaf57307766af.tar.xz |
Moved isDeclaration() check further down to allow for function counts for
declarations if necessary.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80084 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ProfileInfo.cpp')
-rw-r--r-- | lib/Analysis/ProfileInfo.cpp | 5 |
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; |