[llvm-commits] [llvm] r57202 - in /llvm/trunk: lib/VMCore/PassManager.cpp test/Other/2008-10-06-RemoveDeadPass.ll
Devang Patel
dpatel at apple.com
Mon Oct 6 13:36:36 PDT 2008
Author: dpatel
Date: Mon Oct 6 15:36:36 2008
New Revision: 57202
URL: http://llvm.org/viewvc/llvm-project?rev=57202&view=rev
Log:
Remove interfaces implemented by dead pass from the list of available passes.
Patch By Matthijs Kooijman.
Added:
llvm/trunk/test/Other/2008-10-06-RemoveDeadPass.ll
Modified:
llvm/trunk/lib/VMCore/PassManager.cpp
Modified: llvm/trunk/lib/VMCore/PassManager.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/PassManager.cpp?rev=57202&r1=57201&r2=57202&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/PassManager.cpp (original)
+++ llvm/trunk/lib/VMCore/PassManager.cpp Mon Oct 6 15:36:36 2008
@@ -779,13 +779,23 @@
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);
+ }
+ }
}
}
Added: llvm/trunk/test/Other/2008-10-06-RemoveDeadPass.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Other/2008-10-06-RemoveDeadPass.ll?rev=57202&view=auto
==============================================================================
--- llvm/trunk/test/Other/2008-10-06-RemoveDeadPass.ll (added)
+++ llvm/trunk/test/Other/2008-10-06-RemoveDeadPass.ll Mon Oct 6 15:36:36 2008
@@ -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
+}
+
+
More information about the llvm-commits
mailing list