summaryrefslogtreecommitdiff
path: root/lib/Analysis/ProfileInfo.cpp
diff options
context:
space:
mode:
authorGabor Greif <ggreif@gmail.com>2010-07-15 10:19:23 +0000
committerGabor Greif <ggreif@gmail.com>2010-07-15 10:19:23 +0000
commite61669046683f3436c880af3bd3ad91ae2ec690b (patch)
treecb5ebc162a2f3a88e93d0a16a1f43130e15551a8 /lib/Analysis/ProfileInfo.cpp
parent5a3eb8f0e1141825634be38165e40871ce60b3d5 (diff)
downloadllvm-e61669046683f3436c880af3bd3ad91ae2ec690b.tar.gz
llvm-e61669046683f3436c880af3bd3ad91ae2ec690b.tar.bz2
llvm-e61669046683f3436c880af3bd3ad91ae2ec690b.tar.xz
cache another dereferenced iterator
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108421 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ProfileInfo.cpp')
-rw-r--r--lib/Analysis/ProfileInfo.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/Analysis/ProfileInfo.cpp b/lib/Analysis/ProfileInfo.cpp
index 38dcd2580e..8d2712fd6e 100644
--- a/lib/Analysis/ProfileInfo.cpp
+++ b/lib/Analysis/ProfileInfo.cpp
@@ -71,22 +71,24 @@ ProfileInfoT<Function,BasicBlock>::getExecutionCount(const BasicBlock *BB) {
// Are there zero predecessors of this block?
if (PI == PE) {
- Edge e = getEdge(0,BB);
+ Edge e = getEdge(0, BB);
Count = getEdgeWeight(e);
} else {
// Otherwise, if there are predecessors, the execution count of this block is
// the sum of the edge frequencies from the incoming edges.
std::set<const BasicBlock*> ProcessedPreds;
Count = 0;
- for (; PI != PE; ++PI)
- if (ProcessedPreds.insert(*PI).second) {
- double w = getEdgeWeight(getEdge(*PI, BB));
+ for (; PI != PE; ++PI) {
+ const BasicBlock *P = *PI;
+ if (ProcessedPreds.insert(P).second) {
+ double w = getEdgeWeight(getEdge(P, BB));
if (w == MissingValue) {
Count = MissingValue;
break;
}
Count += w;
}
+ }
}
// If the predecessors did not suffice to get block weight, try successors.