summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndreas Neustifter <astifter-llvm@gmx.at>2009-08-24 21:37:48 +0000
committerAndreas Neustifter <astifter-llvm@gmx.at>2009-08-24 21:37:48 +0000
commit96135b617a5c752ea98388d0ed4a289c47c147b3 (patch)
treeb4d5ac1ff5bb01e08940e5cec36b83ab37684032 /lib
parentfd7a918e5890a6c0611ab6b3fca7001d16593844 (diff)
downloadllvm-96135b617a5c752ea98388d0ed4a289c47c147b3.tar.gz
llvm-96135b617a5c752ea98388d0ed4a289c47c147b3.tar.bz2
llvm-96135b617a5c752ea98388d0ed4a289c47c147b3.tar.xz
This patch cleans up the ProfileInfo by
*) introducing new data type and export function of edge info for whole function (preparation for next patch). *) renaming variables to make clear distinction between data and containers that contain this data. *) updated comments and whitespaces. *) made ProfileInfo::MissingValue a double (as it should be...). (Discussed at http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090817/084955.html.) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79940 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Analysis/ProfileInfo.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Analysis/ProfileInfo.cpp b/lib/Analysis/ProfileInfo.cpp
index 98ea25199b..a7fc4c49d5 100644
--- a/lib/Analysis/ProfileInfo.cpp
+++ b/lib/Analysis/ProfileInfo.cpp
@@ -26,6 +26,8 @@ char ProfileInfo::ID = 0;
ProfileInfo::~ProfileInfo() {}
+const double ProfileInfo::MissingValue = -1;
+
double ProfileInfo::getExecutionCount(const BasicBlock *BB) {
std::map<const Function*, BlockCounts>::iterator J =
BlockInformation.find(BB->getParent());
@@ -60,7 +62,7 @@ double ProfileInfo::getExecutionCount(const BasicBlock *BB) {
Count += w;
}
- BlockInformation[BB->getParent()][BB] = Count;
+ if (Count != MissingValue) BlockInformation[BB->getParent()][BB] = Count;
return Count;
}
@@ -72,7 +74,7 @@ double ProfileInfo::getExecutionCount(const Function *F) {
return J->second;
double Count = getExecutionCount(&F->getEntryBlock());
- FunctionInformation[F] = Count;
+ if (Count != MissingValue) FunctionInformation[F] = Count;
return Count;
}