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
This commit is contained in:
Chris Lattner 2003-06-30 04:53:27 +00:00
parent 3d162907e3
commit 81d924d804

View File

@ -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.