// 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 deleteLoopFromQueue(Loop *L);
+
+ // 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 redoLoop(Loop *L);
private:
LoopQueue *LQ;
bool skipThisLoop;
-
+ bool redoThisLoop;
};
} // End llvm namespace
/// LPPassManager manages FPPassManagers and CalLGraphSCCPasses.
LPPassManager::LPPassManager(int Depth) : PMDataManager(Depth) {
+ skipThisLoop = false;
+ redoThisLoop = false;
LQ = new LoopQueue();
}
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)
Loop *L = LQ->top();
skipThisLoop = false;
+ redoThisLoop = false;
// Run all passes on current SCC
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
// Pop the loop from queue after running all passes.
LQ->pop();
+
+ if (redoThisLoop)
+ LQ->push(L);
}
return Changed;