summaryrefslogtreecommitdiffstats
path: root/lib/VMCore/PassManager.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2008-10-06 20:36:36 +0000
committerDevang Patel <dpatel@apple.com>2008-10-06 20:36:36 +0000
commit617fddf51c2aa6822281f0b52e700ffb1f15ed8d (patch)
tree3e75deb6b1b1914c18b790c5d00eeb8c678e010b /lib/VMCore/PassManager.cpp
parenta3668afdeeac587b760b8e5f5ae644949a375b0c (diff)
downloadexternal_llvm-617fddf51c2aa6822281f0b52e700ffb1f15ed8d.zip
external_llvm-617fddf51c2aa6822281f0b52e700ffb1f15ed8d.tar.gz
external_llvm-617fddf51c2aa6822281f0b52e700ffb1f15ed8d.tar.bz2
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
Diffstat (limited to 'lib/VMCore/PassManager.cpp')
-rw-r--r--lib/VMCore/PassManager.cpp24
1 files changed, 17 insertions, 7 deletions
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<AnalysisID, Pass*>::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<AnalysisID, Pass*>::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<const PassInfo*> &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);
+ }
+ }
}
}