mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-17 20:23:59 +00:00
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:
@ -487,9 +487,12 @@ bool LocalDataStructures::run(Module &M) {
|
|||||||
// our memory... here...
|
// our memory... here...
|
||||||
//
|
//
|
||||||
void LocalDataStructures::releaseMemory() {
|
void LocalDataStructures::releaseMemory() {
|
||||||
for (hash_map<const Function*, DSGraph*>::iterator I = DSInfo.begin(),
|
for (hash_map<Function*, DSGraph*>::iterator I = DSInfo.begin(),
|
||||||
E = DSInfo.end(); I != E; ++I)
|
E = DSInfo.end(); I != E; ++I) {
|
||||||
delete I->second;
|
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
|
// Empty map so next time memory is released, data structures are not
|
||||||
// re-deleted.
|
// re-deleted.
|
||||||
|
Reference in New Issue
Block a user