Speed up BlockFrequencyInfo a little bit.
authorJakub Staszak <jstaszak@apple.com>
Thu, 28 Jul 2011 20:09:31 +0000 (20:09 +0000)
committerJakub Staszak <jstaszak@apple.com>
Thu, 28 Jul 2011 20:09:31 +0000 (20:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136381 91177308-0d34-0410-b5e6-96231b3b80d8

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.