cache another dereferenced iterator

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108421 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Gabor Greif 2010-07-15 10:19:23 +00:00
parent 5a3eb8f0e1
commit e616690466

View File

@ -78,9 +78,10 @@ ProfileInfoT<Function,BasicBlock>::getExecutionCount(const BasicBlock *BB) {
// 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;
@ -88,6 +89,7 @@ ProfileInfoT<Function,BasicBlock>::getExecutionCount(const BasicBlock *BB) {
Count += w;
}
}
}
// If the predecessors did not suffice to get block weight, try successors.
if (Count == MissingValue) {