[llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Local.cpp

Chris Lattner lattner at cs.uiuc.edu
Sun Jun 29 23:55:01 PDT 2003


Changes in directory llvm/lib/Analysis/DataStructure:

Local.cpp updated: 1.56 -> 1.57

---
Log message:

Do not delete the same graph multiple times when freeing memory if graphs are sharing


---
Diffs of the changes:

Index: llvm/lib/Analysis/DataStructure/Local.cpp
diff -u llvm/lib/Analysis/DataStructure/Local.cpp:1.56 llvm/lib/Analysis/DataStructure/Local.cpp:1.57
--- llvm/lib/Analysis/DataStructure/Local.cpp:1.56	Sun Jun 29 22:36:09 2003
+++ llvm/lib/Analysis/DataStructure/Local.cpp	Sun Jun 29 23:53:27 2003
@@ -487,9 +487,12 @@
 // 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.





More information about the llvm-commits mailing list