1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

Remove interfaces implemented by dead pass from the list of available passes.

Patch By Matthijs Kooijman.

llvm-svn: 57202
This commit is contained in:
Devang Patel 2008-10-06 20:36:36 +00:00
parent f3168957ef
commit ca66d093c0
2 changed files with 27 additions and 6 deletions

View File

@ -779,13 +779,23 @@ void PMDataManager::removeDeadPasses(Pass *P, const char *Msg,
if (TheTimeInfo) TheTimeInfo->passStarted(*I); if (TheTimeInfo) TheTimeInfo->passStarted(*I);
(*I)->releaseMemory(); (*I)->releaseMemory();
if (TheTimeInfo) TheTimeInfo->passEnded(*I); if (TheTimeInfo) TheTimeInfo->passEnded(*I);
if (const PassInfo *PI = (*I)->getPassInfo()) {
std::map<AnalysisID, Pass*>::iterator Pos =
AvailableAnalysis.find(PI);
std::map<AnalysisID, Pass*>::iterator Pos = // It is possible that pass is already removed from the AvailableAnalysis
AvailableAnalysis.find((*I)->getPassInfo()); if (Pos != AvailableAnalysis.end())
AvailableAnalysis.erase(Pos);
// It is possible that pass is already removed from the AvailableAnalysis
if (Pos != AvailableAnalysis.end()) // Remove all interfaces this pass implements, for which it is also
AvailableAnalysis.erase(Pos); // 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);
}
}
} }
} }

View File

@ -0,0 +1,11 @@
; RUN: llvm-as < %s | opt -inline -internalize -disable-output
define void @foo() nounwind {
ret void
}
define void @main(...) nounwind {
call void @foo()
ret void
}