diff options
author | Devang Patel <dpatel@apple.com> | 2006-12-08 00:37:52 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2006-12-08 00:37:52 +0000 |
commit | f9a60ae75d6fdc74160085323c14e92e7d3517d3 (patch) | |
tree | 00379d688ea58c3e9581f352ae483264324a9f01 /lib/VMCore/PassManager.cpp | |
parent | 0fb259046d43b72d82981af2505b1813b50b3432 (diff) |
Reimplement removeDeadPasses().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32344 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/PassManager.cpp')
-rw-r--r-- | lib/VMCore/PassManager.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/VMCore/PassManager.cpp b/lib/VMCore/PassManager.cpp index 375f0fff25..8cf4a15964 100644 --- a/lib/VMCore/PassManager.cpp +++ b/lib/VMCore/PassManager.cpp @@ -522,7 +522,21 @@ void PMDataManager::removeNotPreservedAnalysis(Pass *P) { /// 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 |