diff options
author | Chris Lattner <sabre@nondot.org> | 2003-06-30 04:53:27 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-06-30 04:53:27 +0000 |
commit | 01877f52241d5e8c658e74a70010e5de2aa33e51 (patch) | |
tree | 5bd4465e3752e8ed6ccec0835182e9e3b99397ad /llvm/lib/Analysis/DataStructure/Local.cpp | |
parent | 7695128217af9a06c792d98d2e329a92f4ada47f (diff) | |
download | bcm5719-llvm-01877f52241d5e8c658e74a70010e5de2aa33e51.tar.gz bcm5719-llvm-01877f52241d5e8c658e74a70010e5de2aa33e51.zip |
Do not delete the same graph multiple times when freeing memory if graphs are sharing
llvm-svn: 6998
Diffstat (limited to 'llvm/lib/Analysis/DataStructure/Local.cpp')
-rw-r--r-- | llvm/lib/Analysis/DataStructure/Local.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/DataStructure/Local.cpp b/llvm/lib/Analysis/DataStructure/Local.cpp index ebac2690e70..27d5ce563aa 100644 --- a/llvm/lib/Analysis/DataStructure/Local.cpp +++ b/llvm/lib/Analysis/DataStructure/Local.cpp @@ -487,9 +487,12 @@ bool LocalDataStructures::run(Module &M) { // our memory... here... // void LocalDataStructures::releaseMemory() { - for (hash_map<const Function*, DSGraph*>::iterator I = DSInfo.begin(), - E = DSInfo.end(); I != E; ++I) - delete I->second; + for (hash_map<Function*, DSGraph*>::iterator I = DSInfo.begin(), + E = DSInfo.end(); I != E; ++I) { + I->second->getReturnNodes().erase(I->first); + if (I->second->getReturnNodes().empty()) + delete I->second; + } // Empty map so next time memory is released, data structures are not // re-deleted. |