Use a range loop. NFC.
[oota-llvm.git] / lib / Transforms / Scalar / Sink.cpp
index 2f7a9f9a65cf8505659d61e3a6b4a4a3aab4ce81..7348c45c5d37be8d65b4dc48e62fcfeab33bd25c 100644 (file)
@@ -258,11 +258,10 @@ bool Sinking::SinkInstruction(Instruction *Inst,
 
   // If no suitable postdominator was found, look at all the successors and
   // decide which one we should sink to, if any.
-  for (BasicBlock *Succ : successors(Inst->getParent())) {
-    if (SuccToSinkTo)
-      break;
-    if (IsAcceptableTarget(Inst, Succ))
-      SuccToSinkTo = Succ;
+  for (succ_iterator I = succ_begin(Inst->getParent()),
+      E = succ_end(Inst->getParent()); I != E && !SuccToSinkTo; ++I) {
+    if (IsAcceptableTarget(Inst, *I))
+      SuccToSinkTo = *I;
   }
 
   // If we couldn't find a block to sink to, ignore this instruction.