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.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Analysis/ProfileInfo.cpp b/lib/Analysis/ProfileInfo.cpp
index 26328d073c..1b86ec8e01 100644
--- a/lib/Analysis/ProfileInfo.cpp
+++ b/lib/Analysis/ProfileInfo.cpp
@@ -27,6 +27,9 @@ char ProfileInfo::ID = 0;
ProfileInfo::~ProfileInfo() {}
unsigned ProfileInfo::getExecutionCount(const BasicBlock *BB) const {
+ if (BlockCounts.find(BB) != BlockCounts.end())
+ return BlockCounts.find(BB)->second;
+
pred_const_iterator PI = pred_begin(BB), PE = pred_end(BB);
// Are there zero predecessors of this block?
@@ -76,7 +79,9 @@ unsigned ProfileInfo::getExecutionCount(const BasicBlock *BB) const {
}
unsigned ProfileInfo::getExecutionCount(const Function *F) const {
- if (F->isDeclaration()) return -1;
+ if (FunctionCounts.find(F) != FunctionCounts.end())
+ return FunctionCounts.find(F)->second;
+
return getExecutionCount(&F->getEntryBlock());
}