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

Devang Patel dpatel at apple.com
Thu Feb 22 16:10:38 PST 2007



Changes in directory llvm/lib/Analysis:

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

Add LPPassManager interface that LoopPass can use to skip
rest of the passes in the queue for a loop.


---
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.3 llvm/lib/Analysis/LoopPass.cpp:1.4
--- llvm/lib/Analysis/LoopPass.cpp:1.3	Thu Feb 22 17:45:15 2007
+++ llvm/lib/Analysis/LoopPass.cpp	Thu Feb 22 18:10:16 2007
@@ -57,6 +57,13 @@
   delete LQ;
 }
 
+/// Delete loop from the loop queue. This is used by Loop pass to inform
+/// Loop Pass Manager that it should skip rest of the passes for this loop.
+void LPPassManager::deleteLoopFromQueue(Loop *L) {
+  // Do not pop loop from LQ here. It will be done by runOnFunction while loop.
+  skipThisLoop = 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)
@@ -81,6 +88,8 @@
   while (!LQ->empty()) {
       
     Loop *L  = LQ->top();
+    skipThisLoop = false;
+
     // Run all passes on current SCC
     for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {  
         
@@ -107,6 +116,10 @@
       removeNotPreservedAnalysis(P);
       recordAvailableAnalysis(P);
       removeDeadPasses(P, Msg2);
+
+      if (skipThisLoop)
+        // Do not run other passes on this loop.
+        break;
     }
     
     // Pop the loop from queue after running all passes.






More information about the llvm-commits mailing list