summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
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
commit26ec65ac3cfcdf27962d78137e72a0cb625532b8 (patch)
treed04ca122cd3b2af0be95fbcb234aa6be7c4e9676 /llvm/lib/Analysis
parent0f470ab1049d8d92513cff1683bae49a1b7a7d66 (diff)
downloadbcm5719-llvm-26ec65ac3cfcdf27962d78137e72a0cb625532b8.tar.gz
bcm5719-llvm-26ec65ac3cfcdf27962d78137e72a0cb625532b8.zip
cache another dereferenced iterator
llvm-svn: 108421
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/ProfileInfo.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/ProfileInfo.cpp b/llvm/lib/Analysis/ProfileInfo.cpp
index 38dcd2580e7..8d2712fd6e0 100644
--- a/llvm/lib/Analysis/ProfileInfo.cpp
+++ b/llvm/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.
OpenPOWER on IntegriCloud