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

llvm-svn: 6998
This commit is contained in:
Chris Lattner 2003-06-30 04:53:27 +00:00
parent 7695128217
commit 01877f5224
1 changed files with 6 additions and 3 deletions

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.