aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/LoopPass.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2007-02-23 00:16:44 +0000
committerDevang Patel <dpatel@apple.com>2007-02-23 00:16:44 +0000
commit8ded5852fe0dd317d9903809b49060248003d365 (patch)
treeec5f022696e012419a6152a3abcdc2b43b39db14 /lib/Analysis/LoopPass.cpp
parent5afdc7d78526622034932e6d07871c7b25d87361 (diff)
Add facility that allows LoopPass to re-insert a loop into
Loop Pass Manager's queue. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34509 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/LoopPass.cpp')
-rw-r--r--lib/Analysis/LoopPass.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/Analysis/LoopPass.cpp b/lib/Analysis/LoopPass.cpp
index 22d542b05b..dc5c5683fb 100644
--- a/lib/Analysis/LoopPass.cpp
+++ b/lib/Analysis/LoopPass.cpp
@@ -50,6 +50,8 @@ private:
/// LPPassManager manages FPPassManagers and CalLGraphSCCPasses.
LPPassManager::LPPassManager(int Depth) : PMDataManager(Depth) {
+ skipThisLoop = false;
+ redoThisLoop = false;
LQ = new LoopQueue();
}
@@ -64,6 +66,13 @@ void LPPassManager::deleteLoopFromQueue(Loop *L) {
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 @@ bool LPPassManager::runOnFunction(Function &F) {
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 @@ bool LPPassManager::runOnFunction(Function &F) {
// Pop the loop from queue after running all passes.
LQ->pop();
+
+ if (redoThisLoop)
+ LQ->push(L);
}
return Changed;