From 4a8725cf2f2b9c620736d6fa397026e3aab71626 Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Tue, 6 Mar 2007 19:11:25 +0000 Subject: Use schedulePass() instead of assignPassManager() to add new LPPassManager. This ensures that require analysis info is available. llvm-svn: 34980 --- llvm/lib/Analysis/LoopPass.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'llvm/lib/Analysis/LoopPass.cpp') diff --git a/llvm/lib/Analysis/LoopPass.cpp b/llvm/lib/Analysis/LoopPass.cpp index 0a29c5dae36..b6b862eca15 100644 --- a/llvm/lib/Analysis/LoopPass.cpp +++ b/llvm/lib/Analysis/LoopPass.cpp @@ -143,14 +143,22 @@ static void addLoopIntoQueue(Loop *L, std::deque &LQ) { LQ.push_back(L); } +/// Pass Manager itself does not invalidate any analysis info. +void LPPassManager::getAnalysisUsage(AnalysisUsage &Info) const { + // LPPassManager needs LoopInfo. In the long term LoopInfo class will + // become part of LPPassManager. + Info.addRequired(); + Info.setPreservesAll(); +} + /// run - Execute all of the passes scheduled for execution. Keep track of /// whether any of the passes modifies the function, and if so, return true. bool LPPassManager::runOnFunction(Function &F) { - LoopInfo &LI = getAnalysis(); + LI = &getAnalysis(); bool Changed = false; // Populate Loop Queue - for (LoopInfo::iterator I = LI.begin(), E = LI.end(); I != E; ++I) + for (LoopInfo::iterator I = LI->begin(), E = LI->end(); I != E; ++I) addLoopIntoQueue(*I, LQ); // Initialization @@ -279,7 +287,7 @@ void LoopPass::assignPassManager(PMStack &PMS, // [3] Assign manager to manage this new manager. This may create // and push new managers into PMS Pass *P = dynamic_cast(LPPM); - P->assignPassManager(PMS); + TPM->schedulePass(P); // [4] Push new manager into PMS PMS.push(LPPM); -- cgit v1.2.3