Speed up BlockFrequencyInfo a little bit.
[oota-llvm.git] / include / llvm / Analysis / BlockFrequencyImpl.h
index bfe2d66d1ce205e4318135a5693bb331f4053231..3e3a772ccd57f6135d23589ca9edc8d7957d14ca 100644 (file)
@@ -224,11 +224,13 @@ class BlockFrequencyImpl {
 
     SmallPtrSet<BlockT *, 8> BlocksInLoop;
 
-    for (rpot_iterator I = rpot_at(Head), E = rpot_end(); I != E; ++I) {
+    for (rpot_iterator I = rpot_at(Head), E = rpot_at(Tail); ; ++I) {
       BlockT *BB = *I;
       doBlock(BB, Head, BlocksInLoop);
 
       BlocksInLoop.insert(BB);
+      if (I != E)
+        break;
     }
 
     // Compute loop's cyclic probability using backedges probabilities.