summaryrefslogtreecommitdiffstats
path: root/llvm/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
commit4f6f6d080f520d7bc7e87dfcf3b8bafda064fe1a (patch)
tree1a10e3ed9b86cd04f63b316bd3ba197cfa51a733 /llvm/lib/Analysis/ProfileInfo.cpp
parent1efb6b039195754ff8fd6189ef4b069c85a928f0 (diff)
downloadbcm5719-llvm-4f6f6d080f520d7bc7e87dfcf3b8bafda064fe1a.tar.gz
bcm5719-llvm-4f6f6d080f520d7bc7e87dfcf3b8bafda064fe1a.zip
Make block and function count available via ProfileInfo.
- Part of optimal static profiling patch sequence by Andreas Neustifter. llvm-svn: 78247
Diffstat (limited to 'llvm/lib/Analysis/ProfileInfo.cpp')
-rw-r--r--llvm/lib/Analysis/ProfileInfo.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/ProfileInfo.cpp b/llvm/lib/Analysis/ProfileInfo.cpp
index 26328d073cf..1b86ec8e01b 100644
--- a/llvm/lib/Analysis/ProfileInfo.cpp
+++ b/llvm/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());
}
OpenPOWER on IntegriCloud