From 3faa412ba04e687a9e3f9e60e8c5d1a482857f4a Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Mon, 6 Oct 2008 20:36:36 +0000 Subject: Remove interfaces implemented by dead pass from the list of available passes. Patch By Matthijs Kooijman. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57202 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/VMCore/PassManager.cpp | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'lib/VMCore') diff --git a/lib/VMCore/PassManager.cpp b/lib/VMCore/PassManager.cpp index 29a6df0..e3d1c53 100644 --- a/lib/VMCore/PassManager.cpp +++ b/lib/VMCore/PassManager.cpp @@ -779,13 +779,23 @@ void PMDataManager::removeDeadPasses(Pass *P, const char *Msg, if (TheTimeInfo) TheTimeInfo->passStarted(*I); (*I)->releaseMemory(); if (TheTimeInfo) TheTimeInfo->passEnded(*I); - - std::map::iterator Pos = - AvailableAnalysis.find((*I)->getPassInfo()); - - // It is possible that pass is already removed from the AvailableAnalysis - if (Pos != AvailableAnalysis.end()) - AvailableAnalysis.erase(Pos); + if (const PassInfo *PI = (*I)->getPassInfo()) { + std::map::iterator Pos = + AvailableAnalysis.find(PI); + + // It is possible that pass is already removed from the AvailableAnalysis + if (Pos != AvailableAnalysis.end()) + AvailableAnalysis.erase(Pos); + + // Remove all interfaces this pass implements, for which it is also + // listed as the available implementation. + const std::vector &II = PI->getInterfacesImplemented(); + for (unsigned i = 0, e = II.size(); i != e; ++i) { + Pos = AvailableAnalysis.find(II[i]); + if (Pos != AvailableAnalysis.end() && Pos->second == *I) + AvailableAnalysis.erase(Pos); + } + } } } -- cgit v1.1