[C++11] Add predecessors(BasicBlock *) / successors(BasicBlock *) iterator ranges.
[oota-llvm.git] / lib / Analysis / ScalarEvolution.cpp
index 06dbde58c1084488ae087b9efbc0633394c0c11e..fd5b86b4634bb0e97ef9f712c0b94abde393fc6c 100644 (file)
@@ -4512,13 +4512,12 @@ ScalarEvolution::ComputeExitLimit(const Loop *L, BasicBlock *ExitingBlock) {
   // lead to the loop header.
   bool MustExecuteLoopHeader = true;
   BasicBlock *Exit = nullptr;
-  for (succ_iterator SI = succ_begin(ExitingBlock), SE = succ_end(ExitingBlock);
-       SI != SE; ++SI)
-    if (!L->contains(*SI)) {
+  for (BasicBlock *Succ : successors(ExitingBlock))
+    if (!L->contains(Succ)) {
       if (Exit) // Multiple exit successors.
         return getCouldNotCompute();
-      Exit = *SI;
-    } else if (*SI != L->getHeader()) {
+      Exit = Succ;
+    } else if (Succ != L->getHeader()) {
       MustExecuteLoopHeader = false;
     }