Changes in directory llvm/lib/VMCore:
PassManager.cpp updated: 1.13 -> 1.14 --- Log message: Remove analysis that is not preserved by the pass from AvailableAnalysis. --- Diffs of the changes: (+28 -3) PassManager.cpp | 31 ++++++++++++++++++++++++++++--- 1 files changed, 28 insertions(+), 3 deletions(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.13 llvm/lib/VMCore/PassManager.cpp:1.14 --- llvm/lib/VMCore/PassManager.cpp:1.13 Fri Nov 10 19:10:19 2006 +++ llvm/lib/VMCore/PassManager.cpp Fri Nov 10 19:24:55 2006 @@ -171,7 +171,8 @@ const std::vector<AnalysisID> &RequiredSet = AnUsage.getRequiredSet(); // FIXME: What about duplicates ? - RequiredAnalysis.insert(RequiredAnalysis.end(), RequiredSet.begin(), RequiredSet.end()); + RequiredAnalysis.insert(RequiredAnalysis.end(), RequiredSet.begin(), + RequiredSet.end()); } /// Augement AvailableAnalysis by adding analysis made available by pass P. @@ -197,8 +198,20 @@ /// Remove Analyss not preserved by Pass P void CommonPassManagerImpl::removeNotPreservedAnalysis(Pass *P) { - - // TODO + AnalysisUsage AnUsage; + P->getAnalysisUsage(AnUsage); + const std::vector<AnalysisID> &PreservedSet = AnUsage.getPreservedSet(); + + for (std::set<AnalysisID>::iterator I = AvailableAnalysis.begin(), + E = AvailableAnalysis.end(); I != E; ++I ) { + AnalysisID AID = *I; + if (std::find(PreservedSet.begin(), PreservedSet.end(), *I) == + PreservedSet.end()) { + // Remove this analysis + std::set<AnalysisID>::iterator J = I++; + AvailableAnalysis.erase(J); + } + } } /// BasicBlockPassManager implementation @@ -223,6 +236,10 @@ // Add pass PassVector.push_back(BP); + + // Remove the analysis not preserved by this pass + removeNotPreservedAnalysis(P); + return true; } @@ -306,6 +323,10 @@ noteDownAvailableAnalysis(P); PassVector.push_back(FP); + + // Remove the analysis not preserved by this pass + removeNotPreservedAnalysis(P); + activeBBPassManager = NULL; return true; } @@ -367,6 +388,10 @@ noteDownAvailableAnalysis(P); PassVector.push_back(MP); + + // Remove the analysis not preserved by this pass + removeNotPreservedAnalysis(P); + activeFunctionPassManager = NULL; return true; } _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits