cache dereferenced iterators
authorGabor Greif <ggreif@gmail.com>
Mon, 12 Jul 2010 10:49:54 +0000 (10:49 +0000)
committerGabor Greif <ggreif@gmail.com>
Mon, 12 Jul 2010 10:49:54 +0000 (10:49 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108132 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Utils/Local.cpp

index b9fcfd5f5fe99bba86b90db84e2c6baa1a4a432f..0b48a8fce78b7dd824b2d38e60b7a7616ee12f2e 100644 (file)
@@ -432,9 +432,11 @@ static bool CanPropagatePredecessorsForPHIs(BasicBlock *BB, BasicBlock *Succ) {
   // Use that list to make another list of common predecessors of BB and Succ
   BlockSet CommonPreds;
   for (pred_iterator PI = pred_begin(Succ), PE = pred_end(Succ);
-        PI != PE; ++PI)
-    if (BBPreds.count(*PI))
-      CommonPreds.insert(*PI);
+       PI != PE; ++PI) {
+    BasicBlock *P = *PI;
+    if (BBPreds.count(P))
+      CommonPreds.insert(P);
+  }
 
   // Shortcut, if there are no common predecessors, merging is always safe
   if (CommonPreds.empty())