LPPassManager : Add initialization and finalizatino hooks.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34968 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/LoopPass.cpp b/lib/Analysis/LoopPass.cpp
index fe1672a..8d613b0 100644
--- a/lib/Analysis/LoopPass.cpp
+++ b/lib/Analysis/LoopPass.cpp
@@ -57,6 +57,18 @@
   for (LoopInfo::iterator I = LI.begin(), E = LI.end(); I != E; ++I)
     addLoopIntoQueue(*I, LQ);
 
+  // Initialization
+  for (std::deque<Loop *>::const_iterator I = LQ.begin(), E = LQ.end();
+       I != E; ++I) {
+    Loop *L = *I;
+    for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {  
+      Pass *P = getContainedPass(Index);
+      LoopPass *LP = dynamic_cast<LoopPass *>(P);
+      if (LP)
+        Changed |= LP->doInitialization(L, *this);
+    }
+  }
+
   // Walk Loops
   while (!LQ.empty()) {
       
@@ -101,6 +113,14 @@
     if (redoThisLoop)
       LQ.push_back(L);
   }
+  
+  // Finalization
+  for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
+    Pass *P = getContainedPass(Index);
+    LoopPass *LP = dynamic_cast <LoopPass *>(P);
+    if (LP)
+      Changed |= LP->doFinalization();
+  }
 
   return Changed;
 }