[llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp

Devang Patel dpatel at apple.com
Thu Dec 7 16:38:07 PST 2006



Changes in directory llvm/lib/VMCore:

PassManager.cpp updated: 1.57 -> 1.58
---
Log message:

Reimplement removeDeadPasses().


---
Diffs of the changes:  (+15 -1)

 PassManager.cpp |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletion(-)


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.57 llvm/lib/VMCore/PassManager.cpp:1.58
--- llvm/lib/VMCore/PassManager.cpp:1.57	Thu Dec  7 17:55:10 2006
+++ llvm/lib/VMCore/PassManager.cpp	Thu Dec  7 18:37:52 2006
@@ -522,7 +522,21 @@
 
 /// Remove analysis passes that are not used any longer
 void PMDataManager::removeDeadPasses(Pass *P) {
-  // TODO : reimplement
+
+  std::vector<Pass *> DeadPasses;
+  TPM->collectLastUses(DeadPasses, P);
+
+  for (std::vector<Pass *>::iterator I = DeadPasses.begin(),
+         E = DeadPasses.end(); I != E; ++I) {
+    (*I)->releaseMemory();
+    
+    std::map<AnalysisID, Pass*>::iterator Pos = 
+      AvailableAnalysis.find((*I)->getPassInfo());
+    
+    // It is possible that deadPass is already removed from the AvailableAnalysis
+    if (Pos != AvailableAnalysis.end())
+      AvailableAnalysis.erase(Pos);
+  }
 }
 
 /// Add pass P into the PassVector. Update 






More information about the llvm-commits mailing list