[llvm] r275999 - [LoopPass] Some minor cleanups

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 19 10:50:24 PDT 2016


Author: majnemer
Date: Tue Jul 19 12:50:24 2016
New Revision: 275999

URL: http://llvm.org/viewvc/llvm-project?rev=275999&view=rev
Log:
[LoopPass] Some minor cleanups

No functional change is intended.

Modified:
    llvm/trunk/lib/Analysis/LoopPass.cpp

Modified: llvm/trunk/lib/Analysis/LoopPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopPass.cpp?rev=275999&r1=275998&r2=275999&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LoopPass.cpp (original)
+++ llvm/trunk/lib/Analysis/LoopPass.cpp Tue Jul 19 12:50:24 2016
@@ -131,8 +131,8 @@ void LPPassManager::deleteSimpleAnalysis
 // Recurse through all subloops and all loops  into LQ.
 static void addLoopIntoQueue(Loop *L, std::deque<Loop *> &LQ) {
   LQ.push_back(L);
-  for (Loop::reverse_iterator I = L->rbegin(), E = L->rend(); I != E; ++I)
-    addLoopIntoQueue(*I, LQ);
+  for (Loop *I : reverse(*L))
+    addLoopIntoQueue(I, LQ);
 }
 
 /// Pass Manager itself does not invalidate any analysis info.
@@ -162,16 +162,14 @@ bool LPPassManager::runOnFunction(Functi
   // Note that LoopInfo::iterator visits loops in reverse program
   // order. Here, reverse_iterator gives us a forward order, and the LoopQueue
   // reverses the order a third time by popping from the back.
-  for (LoopInfo::reverse_iterator I = LI->rbegin(), E = LI->rend(); I != E; ++I)
-    addLoopIntoQueue(*I, LQ);
+  for (Loop *L : reverse(*LI))
+    addLoopIntoQueue(L, LQ);
 
   if (LQ.empty()) // No loops, skip calling finalizers
     return false;
 
   // Initialization
-  for (std::deque<Loop *>::const_iterator I = LQ.begin(), E = LQ.end();
-       I != E; ++I) {
-    Loop *L = *I;
+  for (Loop *L : LQ) {
     for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
       LoopPass *P = getContainedPass(Index);
       Changed |= P->doInitialization(L, *this);




More information about the llvm-commits mailing list