Add comment.
[oota-llvm.git] / lib / Transforms / Scalar / LoopRotation.cpp
index c2e0d230a6b4cb2d27897f77c3545fce3959aea6..153f09563dfc9fad4d4ed6eb0ceac4f6d439ac7d 100644 (file)
@@ -2,8 +2,8 @@
 //
 //                     The LLVM Compiler Infrastructure
 //
-// This file was developed by Devang Patel and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
 //
@@ -56,12 +56,12 @@ namespace {
 
     // LCSSA form makes instruction renaming easier.
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+      AU.addRequiredID(LoopSimplifyID);
+      AU.addPreservedID(LoopSimplifyID);
       AU.addRequiredID(LCSSAID);
       AU.addPreservedID(LCSSAID);
       AU.addPreserved<ScalarEvolution>();
       AU.addPreserved<LoopInfo>();
-      AU.addRequiredID(LoopSimplifyID);
-      AU.addPreservedID(LoopSimplifyID);
       AU.addPreserved<DominatorTree>();
       AU.addPreserved<DominanceFrontier>();
     }
@@ -151,7 +151,7 @@ bool LoopRotate::rotateLoop(Loop *Lp, LPPassManager &LPM) {
   BranchInst *BI = dyn_cast<BranchInst>(OrigHeader->getTerminator());
   if (!BI)
     return false;
-  assert (BI->isConditional() && "Branch Instruction is not condiitional");
+  assert (BI->isConditional() && "Branch Instruction is not conditional");
 
   // Updating PHInodes in loops with multiple exits adds complexity. 
   // Keep it simple, and restrict loop rotation to loops with one exit only.
@@ -451,7 +451,7 @@ void LoopRotate::preserveCanonicalLoopForm(LPPassManager &LPM) {
                                 NewHeader);
   LoopInfo &LI = LPM.getAnalysis<LoopInfo>();
   if (Loop *PL = LI.getLoopFor(OrigPreHeader))
-    PL->addBasicBlockToLoop(NewPreHeader, LI);
+    PL->addBasicBlockToLoop(NewPreHeader, LI.getBase());
   new BranchInst(NewHeader, NewPreHeader);
   
   BranchInst *OrigPH_BI = cast<BranchInst>(OrigPreHeader->getTerminator());