[llvm-commits] CVS: llvm/lib/Analysis/LoopPass.cpp

Devang Patel dpatel at apple.com
Thu Feb 22 16:17:01 PST 2007



Changes in directory llvm/lib/Analysis:

LoopPass.cpp updated: 1.4 -> 1.5
---
Log message:

Add facility that allows LoopPass to re-insert a loop into 
Loop Pass Manager's queue.


---
Diffs of the changes:  (+13 -0)

 LoopPass.cpp |   13 +++++++++++++
 1 files changed, 13 insertions(+)


Index: llvm/lib/Analysis/LoopPass.cpp
diff -u llvm/lib/Analysis/LoopPass.cpp:1.4 llvm/lib/Analysis/LoopPass.cpp:1.5
--- llvm/lib/Analysis/LoopPass.cpp:1.4	Thu Feb 22 18:10:16 2007
+++ llvm/lib/Analysis/LoopPass.cpp	Thu Feb 22 18:16:44 2007
@@ -50,6 +50,8 @@
 /// LPPassManager manages FPPassManagers and CalLGraphSCCPasses.
 
 LPPassManager::LPPassManager(int Depth) : PMDataManager(Depth) { 
+  skipThisLoop = false;
+  redoThisLoop = false;
   LQ = new LoopQueue(); 
 }
 
@@ -64,6 +66,13 @@
   skipThisLoop = true;
 }
 
+// Reoptimize this loop. LPPassManager will re-insert this loop into the
+// queue. This allows LoopPass to change loop nest for the loop. This
+// utility may send LPPassManager into infinite loops so use caution.
+void LPPassManager::redoLoop(Loop *L) {
+  redoThisLoop = true;
+}
+
 // Recurse through all subloops and all loops  into LQ.
 static void addLoopIntoQueue(Loop *L, LoopQueue *LQ) {
   for (Loop::iterator I = L->begin(), E = L->end(); I != E; ++I)
@@ -89,6 +98,7 @@
       
     Loop *L  = LQ->top();
     skipThisLoop = false;
+    redoThisLoop = false;
 
     // Run all passes on current SCC
     for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {  
@@ -124,6 +134,9 @@
     
     // Pop the loop from queue after running all passes.
     LQ->pop();
+    
+    if (redoThisLoop)
+      LQ->push(L);
   }
 
   return Changed;






More information about the llvm-commits mailing list