summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/DataStructure
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Analysis/DataStructure')
-rw-r--r--llvm/lib/Analysis/DataStructure/Local.cpp9
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.
OpenPOWER on IntegriCloud