Do not multiply delete graphs if functions are sharing graphs
authorChris Lattner <sabre@nondot.org>
Mon, 30 Jun 2003 04:53:08 +0000 (04:53 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 30 Jun 2003 04:53:08 +0000 (04:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6997 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/DataStructure/TopDownClosure.cpp

index 85a79d1076a31602c80cecc563355752b37c1ce8..7eea92266122a65564800a5b3e26e2e7314be4f6 100644 (file)
@@ -45,10 +45,12 @@ bool TDDataStructures::run(Module &M) {
 // has no way to extend the lifetime of the pass, which screws up ds-aa.
 //
 void TDDataStructures::releaseMyMemory() {
-  return;
-  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.