diff options
author | Devang Patel <dpatel@apple.com> | 2006-12-07 22:34:21 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2006-12-07 22:34:21 +0000 |
commit | badc4fae531cc0fdaa8e58f481c3b1d23ea7dd56 (patch) | |
tree | 056b3d6df3f9f15ef4b0747c4636a926171c7aca | |
parent | f5da13367f88f06e3b585dc2263ab6e9ca6c4bf8 (diff) | |
download | external_llvm-badc4fae531cc0fdaa8e58f481c3b1d23ea7dd56.zip external_llvm-badc4fae531cc0fdaa8e58f481c3b1d23ea7dd56.tar.gz external_llvm-badc4fae531cc0fdaa8e58f481c3b1d23ea7dd56.tar.bz2 |
When new pass manager is created, initialize available analysis info
of existing manager at the same level. Otherwise, such info may be
considered as available, which not true.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32334 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/VMCore/PassManager.cpp | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/lib/VMCore/PassManager.cpp b/lib/VMCore/PassManager.cpp index d0672d1..76869fe 100644 --- a/lib/VMCore/PassManager.cpp +++ b/lib/VMCore/PassManager.cpp @@ -652,13 +652,17 @@ FunctionPassManagerImpl_New::addPass(Pass *P) { // If P is a BasicBlockPass then use BasicBlockPassManager_New. if (BasicBlockPass *BP = dynamic_cast<BasicBlockPass*>(P)) { - if (!activeBBPassManager - || !activeBBPassManager->addPass(BP)) { + if (!activeBBPassManager || !activeBBPassManager->addPass(BP)) { - // TODO : intialize AvailableAnalysis info + // If active manager exists then clear its analysis info. + if (activeBBPassManager) + activeBBPassManager->initializeAnalysisInfo(); + // Create and add new manager activeBBPassManager = new BasicBlockPassManager_New(); addPassToManager(activeBBPassManager, false); + + // Add pass into new manager. This time it must succeed. if (!activeBBPassManager->addPass(BP)) assert(0 && "Unable to add Pass"); } @@ -675,8 +679,13 @@ FunctionPassManagerImpl_New::addPass(Pass *P) { return false; addPassToManager (FP); - // TODO : intialize AvailableAnalysis info - activeBBPassManager = NULL; + + // If active manager exists then clear its analysis info. + if (activeBBPassManager) { + activeBBPassManager->initializeAnalysisInfo(); + activeBBPassManager = NULL; + } + return true; } @@ -784,11 +793,15 @@ ModulePassManager_New::addPass(Pass *P) { if (!activeFunctionPassManager || !activeFunctionPassManager->addPass(P)) { - // TODO : intialize AvailableAnalysis info - activeFunctionPassManager = NULL; + // If active manager exists then clear its analysis info. + if (activeFunctionPassManager) + activeFunctionPassManager->initializeAnalysisInfo(); + // Create and add new manager activeFunctionPassManager = new FunctionPassManagerImpl_New(); addPassToManager(activeFunctionPassManager, false); + + // Add pass into new manager. This time it must succeed. if (!activeFunctionPassManager->addPass(FP)) assert(0 && "Unable to add pass"); } @@ -805,8 +818,12 @@ ModulePassManager_New::addPass(Pass *P) { return false; addPassToManager(MP); - // TODO : intialize AvailableAnalysis info - activeFunctionPassManager = NULL; + // If active manager exists then clear its analysis info. + if (activeFunctionPassManager) { + activeFunctionPassManager->initializeAnalysisInfo(); + activeFunctionPassManager = NULL; + } + return true; } |