[llvm-commits] [llvm] r137317 - /llvm/trunk/lib/Analysis/LoopInfo.cpp

Andrew Trick atrick at apple.com
Thu Aug 11 10:54:58 PDT 2011


Author: atrick
Date: Thu Aug 11 12:54:58 2011
New Revision: 137317

URL: http://llvm.org/viewvc/llvm-project?rev=137317&view=rev
Log:
Cleanup. Another thorough review by Nick!

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

Modified: llvm/trunk/lib/Analysis/LoopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopInfo.cpp?rev=137317&r1=137316&r2=137317&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LoopInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/LoopInfo.cpp Thu Aug 11 12:54:58 2011
@@ -471,8 +471,8 @@
 /// nested within unloop.
 void UnloopUpdater::updateSubloopParents() {
   while (!Unloop->empty()) {
-    Loop *Subloop = *(Unloop->end()-1);
-    Unloop->removeChildLoop(Unloop->end()-1);
+    Loop *Subloop = *llvm::prior(Unloop->end());
+    Unloop->removeChildLoop(llvm::prior(Unloop->end()));
 
     assert(SubloopParents.count(Subloop) && "DFS failed to visit subloop");
     if (SubloopParents[Subloop])
@@ -487,8 +487,8 @@
 /// For subloop blocks, simply update SubloopParents and return NULL.
 Loop *UnloopUpdater::getNearestLoop(BasicBlock *BB, Loop *BBLoop) {
 
-  // Initialy for blocks directly contained by Unloop, NearLoop == Unloop and is
-  // considered uninitialized.
+  // Initially for blocks directly contained by Unloop, NearLoop == Unloop and
+  // is considered uninitialized.
   Loop *NearLoop = BBLoop;
 
   Loop *Subloop = 0;
@@ -562,7 +562,7 @@
 
 /// updateUnloop - The last backedge has been removed from a loop--now the
 /// "unloop". Find a new parent for the blocks contained within unloop and
-/// update the loop tree. We don't necessarilly have valid dominators at this
+/// update the loop tree. We don't necessarily have valid dominators at this
 /// point, but LoopInfo is still valid except for the removal of this loop.
 ///
 /// Note that Unloop may now be an empty loop. Calling Loop::getHeader without
@@ -595,7 +595,7 @@
 
     // Move all of the subloops to the top-level.
     while (!Unloop->empty())
-      LI.addTopLevelLoop(Unloop->removeChildLoop(Unloop->end()-1));
+      LI.addTopLevelLoop(Unloop->removeChildLoop(llvm::prior(Unloop->end())));
 
     return;
   }





More information about the llvm-commits mailing list