[llvm-commits] CVS: llvm/lib/Transforms/Utils/LoopSimplify.cpp

Chris Lattner lattner at cs.uiuc.edu
Tue Feb 14 15:06:14 PST 2006



Changes in directory llvm/lib/Transforms/Utils:

LoopSimplify.cpp updated: 1.68 -> 1.69
---
Log message:

Canonicalize inner loops before outer loops.  Inner loop canonicalization
can provide work for the outer loop to canonicalize.

This fixes a case that breaks unswitching.



---
Diffs of the changes:  (+5 -4)

 LoopSimplify.cpp |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)


Index: llvm/lib/Transforms/Utils/LoopSimplify.cpp
diff -u llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.68 llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.69
--- llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.68	Tue Feb 14 16:34:08 2006
+++ llvm/lib/Transforms/Utils/LoopSimplify.cpp	Tue Feb 14 17:06:02 2006
@@ -115,7 +115,11 @@
 ///
 bool LoopSimplify::ProcessLoop(Loop *L) {
   bool Changed = false;
-
+  // Canonicalize inner loops before outer loops.  Inner loop canonicalization
+  // can provide work for the outer loop to canonicalize.
+  for (Loop::iterator I = L->begin(), E = L->end(); I != E; ++I)
+    Changed |= ProcessLoop(*I);
+  
   // Check to see that no blocks (other than the header) in the loop have
   // predecessors that are not in the loop.  This is not valid for natural
   // loops, but can occur if the blocks are unreachable.  Since they are
@@ -205,9 +209,6 @@
         PN->eraseFromParent();
       }
 
-  for (Loop::iterator I = L->begin(), E = L->end(); I != E; ++I)
-    Changed |= ProcessLoop(*I);
-
   return Changed;
 }
 






More information about the llvm-commits mailing list