mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +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:
parent
f3168957ef
commit
ca66d093c0
@ -779,13 +779,23 @@ void PMDataManager::removeDeadPasses(Pass *P, const char *Msg,
|
||||
if (TheTimeInfo) TheTimeInfo->passStarted(*I);
|
||||
(*I)->releaseMemory();
|
||||
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 =
|
||||
AvailableAnalysis.find((*I)->getPassInfo());
|
||||
|
||||
// It is possible that pass is already removed from the AvailableAnalysis
|
||||
if (Pos != AvailableAnalysis.end())
|
||||
AvailableAnalysis.erase(Pos);
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
11
test/Other/2008-10-06-RemoveDeadPass.ll
Normal file
11
test/Other/2008-10-06-RemoveDeadPass.ll
Normal 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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user