aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/DataStructure/Local.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-06-30 04:53:27 +0000
committerChris Lattner <sabre@nondot.org>2003-06-30 04:53:27 +0000
commit81d924d8045f61f3a6165de701f8ef6ec249ea31 (patch)
treea346ece085db849b379f7731b6e1ef2ddc7bbeb8 /lib/Analysis/DataStructure/Local.cpp
parent3d162907e3f52560cdd75e4bedf5d37795b8d79c (diff)
Do not delete the same graph multiple times when freeing memory if graphs are sharing
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6998 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DataStructure/Local.cpp')
-rw-r--r--lib/Analysis/DataStructure/Local.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/Analysis/DataStructure/Local.cpp b/lib/Analysis/DataStructure/Local.cpp
index ebac2690e7..27d5ce563a 100644
--- a/lib/Analysis/DataStructure/Local.cpp
+++ b/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.