[llvm-commits] [llvm] r82946 - in /llvm/trunk: include/llvm/Analysis/LoopPass.h lib/Analysis/LoopPass.cpp
Dan Gohman
gohman at apple.com
Sun Sep 27 16:49:44 PDT 2009
Author: djg
Date: Sun Sep 27 18:49:43 2009
New Revision: 82946
URL: http://llvm.org/viewvc/llvm-project?rev=82946&view=rev
Log:
Extract the code for inserting a loop into the loop queue into
a separate function.
Modified:
llvm/trunk/include/llvm/Analysis/LoopPass.h
llvm/trunk/lib/Analysis/LoopPass.cpp
Modified: llvm/trunk/include/llvm/Analysis/LoopPass.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LoopPass.h?rev=82946&r1=82945&r2=82946&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/LoopPass.h (original)
+++ llvm/trunk/include/llvm/Analysis/LoopPass.h Sun Sep 27 18:49:43 2009
@@ -111,9 +111,13 @@
// Delete loop from the loop queue and loop nest (LoopInfo).
void deleteLoopFromQueue(Loop *L);
- // Insert loop into the loop nest(LoopInfo) and loop queue(LQ).
+ // Insert loop into the loop queue and add it as a child of the
+ // given parent.
void insertLoop(Loop *L, Loop *ParentLoop);
+ // Insert a loop into the loop queue.
+ void insertLoopIntoQueue(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.
Modified: llvm/trunk/lib/Analysis/LoopPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopPass.cpp?rev=82946&r1=82945&r2=82946&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LoopPass.cpp (original)
+++ llvm/trunk/lib/Analysis/LoopPass.cpp Sun Sep 27 18:49:43 2009
@@ -110,17 +110,21 @@
else
LI->addTopLevelLoop(L);
+ insertLoopIntoQueue(L);
+}
+
+void LPPassManager::insertLoopIntoQueue(Loop *L) {
// Insert L into loop queue
if (L == CurrentLoop)
redoLoop(L);
- else if (!ParentLoop)
+ else if (!L->getParentLoop())
// This is top level loop.
LQ.push_front(L);
else {
- // Insert L after ParentLoop
+ // Insert L after the parent loop.
for (std::deque<Loop *>::iterator I = LQ.begin(),
E = LQ.end(); I != E; ++I) {
- if (*I == ParentLoop) {
+ if (*I == L->getParentLoop()) {
// deque does not support insert after.
++I;
LQ.insert(I, 1, L);
More information about the llvm-commits
mailing list