Exit a search loop when the search goal is found.
[oota-llvm.git] / lib / VMCore / Dominators.cpp
index 96add57f14641ebd32c004802d22a2b6a533f4a5..8a33eb06236a5bab767459307d3187b1cc0fb3fd 100644 (file)
@@ -161,8 +161,10 @@ void DominanceFrontier::splitBlock(BasicBlock *NewBB) {
         bool DominatesPred = false;
         for (pred_iterator PI = pred_begin(*SetI), E = pred_end(*SetI);
              PI != E; ++PI)
-          if (DT.dominates(NewBB, *PI))
+          if (DT.dominates(NewBB, *PI)) {
             DominatesPred = true;
+            break;
+          }
         if (!DominatesPred)
           Set.erase(SetI++);
         else