aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/ProfileInfo.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-08-05 21:51:16 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-08-05 21:51:16 +0000
commitc9008c5cc7113ea4c3a262e346c0dfcdbca12ae6 (patch)
treee8e8c7d27032dc84dd20ce8327a4cbf927104d1f /lib/Analysis/ProfileInfo.cpp
parentb341577401dfb25e1e6c451eee6dd01df531365a (diff)
Make block and function count available via ProfileInfo.
- Part of optimal static profiling patch sequence by Andreas Neustifter. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78247 91177308-0d34-0410-b5e6-96231b3b80d8
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());
}