diff options
author | Nuno Lopes <nunoplopes@sapo.pt> | 2008-11-04 23:03:58 +0000 |
---|---|---|
committer | Nuno Lopes <nunoplopes@sapo.pt> | 2008-11-04 23:03:58 +0000 |
commit | 0460bb27e0986410d1e7aa20b1e3be4b04b0b0db (patch) | |
tree | 21397078bb046c9d40d657ad6ced4a6ff682478c /llvm/lib/VMCore/PassManager.cpp | |
parent | d6948315b7421686c7c912b77fc1a3d7971b20e9 (diff) | |
download | bcm5719-llvm-0460bb27e0986410d1e7aa20b1e3be4b04b0b0db.tar.gz bcm5719-llvm-0460bb27e0986410d1e7aa20b1e3be4b04b0b0db.zip |
fix memory leak in pass manager when adding an analysis pass that already existed. as pass manager takes ownership of the added passes, it has to delete the pass if it isnt added to the pass list
tweak the opt tool so that it doesnt access a Pass after the ownership was taken by the pass manager
llvm-svn: 58730
Diffstat (limited to 'llvm/lib/VMCore/PassManager.cpp')
-rw-r--r-- | llvm/lib/VMCore/PassManager.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/VMCore/PassManager.cpp b/llvm/lib/VMCore/PassManager.cpp index ef90aace3da..6f559c47c3f 100644 --- a/llvm/lib/VMCore/PassManager.cpp +++ b/llvm/lib/VMCore/PassManager.cpp @@ -458,8 +458,10 @@ void PMTopLevelManager::schedulePass(Pass *P) { // generate the analysis again. Stale analysis info should not be // available at this point. if (P->getPassInfo() && - P->getPassInfo()->isAnalysis() && findAnalysisPass(P->getPassInfo())) + P->getPassInfo()->isAnalysis() && findAnalysisPass(P->getPassInfo())) { + delete P; return; + } AnalysisUsage *AnUsage = findAnalysisUsage(P); |