From 8592a0cda4cf4ae76c5a29230fb330d0e952bb62 Mon Sep 17 00:00:00 2001 From: Andrew Trick Date: Sat, 27 Aug 2011 06:10:16 +0000 Subject: [PATCH] Reverting r138695 to see if it fixes clang self host. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138701 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Analysis/LoopPass.h | 2 +- include/llvm/Analysis/RegionPass.h | 2 +- include/llvm/LinkAllPasses.h | 2 +- include/llvm/PassManagers.h | 7 ++--- lib/Analysis/IPA/CallGraphSCCPass.cpp | 6 ++-- lib/Analysis/LoopPass.cpp | 8 +++--- lib/Analysis/RegionPass.cpp | 6 ++-- lib/VMCore/PassManager.cpp | 40 ++++++++++----------------- 8 files changed, 31 insertions(+), 42 deletions(-) diff --git a/include/llvm/Analysis/LoopPass.h b/include/llvm/Analysis/LoopPass.h index e6ed9bccee3..1603d2ea7a4 100644 --- a/include/llvm/Analysis/LoopPass.h +++ b/include/llvm/Analysis/LoopPass.h @@ -84,7 +84,7 @@ public: class LPPassManager : public FunctionPass, public PMDataManager { public: static char ID; - explicit LPPassManager(); + explicit LPPassManager(int Depth); /// run - Execute all of the passes scheduled for execution. Keep track of /// whether any of the passes modifies the module, and if so, return true. diff --git a/include/llvm/Analysis/RegionPass.h b/include/llvm/Analysis/RegionPass.h index 68f12012bcd..1a93859bab9 100644 --- a/include/llvm/Analysis/RegionPass.h +++ b/include/llvm/Analysis/RegionPass.h @@ -88,7 +88,7 @@ class RGPassManager : public FunctionPass, public PMDataManager { public: static char ID; - explicit RGPassManager(); + explicit RGPassManager(int Depth); /// @brief Execute all of the passes scheduled for execution. /// diff --git a/include/llvm/LinkAllPasses.h b/include/llvm/LinkAllPasses.h index e427f40aae2..058bd637f95 100644 --- a/include/llvm/LinkAllPasses.h +++ b/include/llvm/LinkAllPasses.h @@ -156,7 +156,7 @@ namespace { (void)new llvm::FindUsedTypes(); (void)new llvm::ScalarEvolution(); ((llvm::Function*)0)->viewCFGOnly(); - llvm::RGPassManager RGM; + llvm::RGPassManager RGM(0); ((llvm::RegionPass*)0)->runOnRegion((llvm::Region*)0, RGM); llvm::AliasSetTracker X(*(llvm::AliasAnalysis*)0); X.add((llvm::Value*)0, 0, 0); // for -print-alias-sets diff --git a/include/llvm/PassManagers.h b/include/llvm/PassManagers.h index c05347da793..c4f409ef525 100644 --- a/include/llvm/PassManagers.h +++ b/include/llvm/PassManagers.h @@ -263,7 +263,7 @@ private: class PMDataManager { public: - explicit PMDataManager() : TPM(NULL), Depth(0) { + explicit PMDataManager(int Depth) : TPM(NULL), Depth(Depth) { initializeAnalysisInfo(); } @@ -333,7 +333,6 @@ public: void setTopLevelManager(PMTopLevelManager *T) { TPM = T; } unsigned getDepth() const { return Depth; } - void setDepth(unsigned newDepth) { Depth = newDepth; } // Print routines used by debug-pass void dumpLastUses(Pass *P, unsigned Offset) const; @@ -409,8 +408,8 @@ private: class FPPassManager : public ModulePass, public PMDataManager { public: static char ID; - explicit FPPassManager() - : ModulePass(ID), PMDataManager() { } + explicit FPPassManager(int Depth) + : ModulePass(ID), PMDataManager(Depth) { } /// run - Execute all of the passes scheduled for execution. Keep track of /// whether any of the passes modifies the module, and if so, return true. diff --git a/lib/Analysis/IPA/CallGraphSCCPass.cpp b/lib/Analysis/IPA/CallGraphSCCPass.cpp index 963da752343..b6f9f0b32d8 100644 --- a/lib/Analysis/IPA/CallGraphSCCPass.cpp +++ b/lib/Analysis/IPA/CallGraphSCCPass.cpp @@ -44,8 +44,8 @@ namespace { class CGPassManager : public ModulePass, public PMDataManager { public: static char ID; - explicit CGPassManager() - : ModulePass(ID), PMDataManager() { } + explicit CGPassManager(int Depth) + : ModulePass(ID), PMDataManager(Depth) { } /// run - Execute all of the passes scheduled for execution. Keep track of /// whether any of the passes modifies the module, and if so, return true. @@ -543,7 +543,7 @@ void CallGraphSCCPass::assignPassManager(PMStack &PMS, PMDataManager *PMD = PMS.top(); // [1] Create new Call Graph Pass Manager - CGP = new CGPassManager(); + CGP = new CGPassManager(PMD->getDepth() + 1); // [2] Set up new manager's top level manager PMTopLevelManager *TPM = PMD->getTopLevelManager(); diff --git a/lib/Analysis/LoopPass.cpp b/lib/Analysis/LoopPass.cpp index 5ba1f4045d1..7ba3268b9ef 100644 --- a/lib/Analysis/LoopPass.cpp +++ b/lib/Analysis/LoopPass.cpp @@ -73,8 +73,8 @@ static void createDebugInfoProbe() { char LPPassManager::ID = 0; -LPPassManager::LPPassManager() - : FunctionPass(ID), PMDataManager() { +LPPassManager::LPPassManager(int Depth) + : FunctionPass(ID), PMDataManager(Depth) { skipThisLoop = false; redoThisLoop = false; LI = NULL; @@ -357,8 +357,8 @@ void LoopPass::assignPassManager(PMStack &PMS, assert (!PMS.empty() && "Unable to create Loop Pass Manager"); PMDataManager *PMD = PMS.top(); - // [1] Create new Loop Pass Manager - LPPM = new LPPassManager(); + // [1] Create new Call Graph Pass Manager + LPPM = new LPPassManager(PMD->getDepth() + 1); LPPM->populateInheritedAnalysis(PMS); // [2] Set up new manager's top level manager diff --git a/lib/Analysis/RegionPass.cpp b/lib/Analysis/RegionPass.cpp index 3a3529baf93..80eda79d8a4 100644 --- a/lib/Analysis/RegionPass.cpp +++ b/lib/Analysis/RegionPass.cpp @@ -27,8 +27,8 @@ using namespace llvm; char RGPassManager::ID = 0; -RGPassManager::RGPassManager() - : FunctionPass(ID), PMDataManager() { +RGPassManager::RGPassManager(int Depth) + : FunctionPass(ID), PMDataManager(Depth) { skipThisRegion = false; redoThisRegion = false; RI = NULL; @@ -250,7 +250,7 @@ void RegionPass::assignPassManager(PMStack &PMS, PMDataManager *PMD = PMS.top(); // [1] Create new Region Pass Manager - RGPM = new RGPassManager(); + RGPM = new RGPassManager(PMD->getDepth() + 1); RGPM->populateInheritedAnalysis(PMS); // [2] Set up new manager's top level manager diff --git a/lib/VMCore/PassManager.cpp b/lib/VMCore/PassManager.cpp index 8846ac59086..6146f9e5f21 100644 --- a/lib/VMCore/PassManager.cpp +++ b/lib/VMCore/PassManager.cpp @@ -167,8 +167,8 @@ class BBPassManager : public PMDataManager, public FunctionPass { public: static char ID; - explicit BBPassManager() - : PMDataManager(), FunctionPass(ID) {} + explicit BBPassManager(int Depth) + : PMDataManager(Depth), FunctionPass(ID) {} /// Execute all of the passes scheduled for execution. Keep track of /// whether any of the passes modifies the function, and if so, return true. @@ -228,9 +228,9 @@ private: bool wasRun; public: static char ID; - explicit FunctionPassManagerImpl() : - Pass(PT_PassManager, ID), PMDataManager(), - PMTopLevelManager(new FPPassManager()), wasRun(false) {} + explicit FunctionPassManagerImpl(int Depth) : + Pass(PT_PassManager, ID), PMDataManager(Depth), + PMTopLevelManager(new FPPassManager(1)), wasRun(false) {} /// add - Add a pass to the queue of passes to run. This passes ownership of /// the Pass to the PassManager. When the PassManager is destroyed, the pass @@ -303,8 +303,8 @@ char FunctionPassManagerImpl::ID = 0; class MPPassManager : public Pass, public PMDataManager { public: static char ID; - explicit MPPassManager() : - Pass(PT_PassManager, ID), PMDataManager() { } + explicit MPPassManager(int Depth) : + Pass(PT_PassManager, ID), PMDataManager(Depth) { } // Delete on the fly managers. virtual ~MPPassManager() { @@ -388,9 +388,9 @@ class PassManagerImpl : public Pass, public: static char ID; - explicit PassManagerImpl() : - Pass(PT_PassManager, ID), PMDataManager(), - PMTopLevelManager(new MPPassManager()) {} + explicit PassManagerImpl(int Depth) : + Pass(PT_PassManager, ID), PMDataManager(Depth), + PMTopLevelManager(new MPPassManager(1)) {} /// add - Add a pass to the queue of passes to run. This passes ownership of /// the Pass to the PassManager. When the PassManager is destroyed, the pass @@ -1340,7 +1340,7 @@ bool BBPassManager::doFinalization(Function &F) { /// Create new Function pass manager FunctionPassManager::FunctionPassManager(Module *m) : M(m) { - FPM = new FunctionPassManagerImpl(); + FPM = new FunctionPassManagerImpl(0); // FPM is the top level manager. FPM->setTopLevelManager(FPM); @@ -1626,7 +1626,7 @@ void MPPassManager::addLowerLevelRequiredPass(Pass *P, Pass *RequiredPass) { FunctionPassManagerImpl *FPP = OnTheFlyManagers[P]; if (!FPP) { - FPP = new FunctionPassManagerImpl(); + FPP = new FunctionPassManagerImpl(0); // FPP is the top level manager. FPP->setTopLevelManager(FPP); @@ -1677,7 +1677,7 @@ bool PassManagerImpl::run(Module &M) { /// Create new pass manager PassManager::PassManager() { - PM = new PassManagerImpl(); + PM = new PassManagerImpl(0); // PM is the top level manager PM->setTopLevelManager(PM); } @@ -1761,23 +1761,13 @@ void PMStack::pop() { // Push PM on the stack and set its top level manager. void PMStack::push(PMDataManager *PM) { assert(PM && "Unable to push. Pass Manager expected"); - assert(PM->getDepth()==0 && "Pass Manager depth set too early"); if (!this->empty()) { - assert(PM->getPassManagerType() > this->top()->getPassManagerType() - && "pushing bad pass manager to PMStack"); PMTopLevelManager *TPM = this->top()->getTopLevelManager(); assert(TPM && "Unable to find top level manager"); TPM->addIndirectPassManager(PM); PM->setTopLevelManager(TPM); - PM->setDepth(this->top()->getDepth()+1); - } - else { - assert(PM->getPassManagerType() == PMT_ModulePassManager - || PM->getPassManagerType() == PMT_FunctionPassManager - && "pushing bad pass manager to PMStack"); - PM->setDepth(1); } S.push_back(PM); @@ -1833,7 +1823,7 @@ void FunctionPass::assignPassManager(PMStack &PMS, PMDataManager *PMD = PMS.top(); // [1] Create new Function Pass Manager - FPP = new FPPassManager(); + FPP = new FPPassManager(PMD->getDepth() + 1); FPP->populateInheritedAnalysis(PMS); // [2] Set up new manager's top level manager @@ -1870,7 +1860,7 @@ void BasicBlockPass::assignPassManager(PMStack &PMS, PMDataManager *PMD = PMS.top(); // [1] Create new Basic Block Manager - BBP = new BBPassManager(); + BBP = new BBPassManager(PMD->getDepth() + 1); // [2] Set up new manager's top level manager // Basic Block Pass Manager does not live by itself