diff --git a/llvm/lib/VMCore/PassManager.cpp b/llvm/lib/VMCore/PassManager.cpp index 9585b0dbce36..77820ad6a8e6 100644 --- a/llvm/lib/VMCore/PassManager.cpp +++ b/llvm/lib/VMCore/PassManager.cpp @@ -436,8 +436,11 @@ void PMDataManager::recordAvailableAnalysis(Pass *P) { void PMDataManager::removeNotPreservedAnalysis(Pass *P) { AnalysisUsage AnUsage; P->getAnalysisUsage(AnUsage); - const std::vector &PreservedSet = AnUsage.getPreservedSet(); + if (AnUsage.getPreservesAll()) + return; + + const std::vector &PreservedSet = AnUsage.getPreservedSet(); for (std::map::iterator I = AvailableAnalysis.begin(), E = AvailableAnalysis.end(); I != E; ++I ) { if (std::find(PreservedSet.begin(), PreservedSet.end(), I->first) == @@ -470,8 +473,8 @@ void PMDataManager::removeDeadPasses(Pass *P) { /// Add pass P into the PassVector. Update /// AvailableAnalysis appropriately if ProcessAnalysis is true. -void PMDataManager::addPassToManager (Pass *P, - bool ProcessAnalysis) { +void PMDataManager::addPassToManager(Pass *P, + bool ProcessAnalysis) { if (ProcessAnalysis) { // Take a note of analysis required and made available by this pass