cache result of operator*
authorGabor Greif <ggreif@gmail.com>
Fri, 9 Jul 2010 16:31:08 +0000 (16:31 +0000)
committerGabor Greif <ggreif@gmail.com>
Fri, 9 Jul 2010 16:31:08 +0000 (16:31 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107984 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Utils/BreakCriticalEdges.cpp

index fe99daa1123407a6e2d72b57872cb83c117964e4..26f53c05a042fed2d42085ba478bc8a447d77bdf 100644 (file)
@@ -403,11 +403,13 @@ BasicBlock *llvm::SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum,
           bool HasPredOutsideOfLoop = false;
           BasicBlock *Exit = ExitBlocks[i];
           for (pred_iterator I = pred_begin(Exit), E = pred_end(Exit);
-               I != E; ++I)
-            if (TIL->contains(*I))
-              Preds.push_back(*I);
+               I != E; ++I) {
+            BasicBlock *P = *I;
+            if (TIL->contains(P))
+              Preds.push_back(P);
             else
               HasPredOutsideOfLoop = true;
+          }
           // If there are any preds not in the loop, we'll need to split
           // the edges. The Preds.empty() check is needed because a block
           // may appear multiple times in the list. We can't use