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 | |
parent | 0fb259046d43b72d82981af2505b1813b50b3432 (diff) | |
download | external_llvm-f9a60ae75d6fdc74160085323c14e92e7d3517d3.zip external_llvm-f9a60ae75d6fdc74160085323c14e92e7d3517d3.tar.gz external_llvm-f9a60ae75d6fdc74160085323c14e92e7d3517d3.tar.bz2 |
Reimplement removeDeadPasses().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32344 91177308-0d34-0410-b5e6-96231b3b80d8
-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 375f0ff..8cf4a15 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 |