mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-04-30 06:38:14 +00:00
fix memleak by cleaning the global sets on pass exit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57353 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2312022972
commit
7cdd9ee088
@ -739,6 +739,7 @@ namespace {
|
|||||||
bool performPRE(Function& F);
|
bool performPRE(Function& F);
|
||||||
Value* lookupNumber(BasicBlock* BB, uint32_t num);
|
Value* lookupNumber(BasicBlock* BB, uint32_t num);
|
||||||
bool mergeBlockIntoPredecessor(BasicBlock* BB);
|
bool mergeBlockIntoPredecessor(BasicBlock* BB);
|
||||||
|
void cleanupGlobalSets();
|
||||||
};
|
};
|
||||||
|
|
||||||
char GVN::ID = 0;
|
char GVN::ID = 0;
|
||||||
@ -1129,7 +1130,9 @@ bool GVN::runOnFunction(Function& F) {
|
|||||||
changed |= PREChanged;
|
changed |= PREChanged;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cleanupGlobalSets();
|
||||||
|
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1332,16 +1335,9 @@ bool GVN::performPRE(Function& F) {
|
|||||||
|
|
||||||
// iterateOnFunction - Executes one iteration of GVN
|
// iterateOnFunction - Executes one iteration of GVN
|
||||||
bool GVN::iterateOnFunction(Function &F) {
|
bool GVN::iterateOnFunction(Function &F) {
|
||||||
// Clean out global sets from any previous functions
|
DominatorTree &DT = getAnalysis<DominatorTree>();
|
||||||
VN.clear();
|
|
||||||
phiMap.clear();
|
cleanupGlobalSets();
|
||||||
|
|
||||||
for (DenseMap<BasicBlock*, ValueNumberScope*>::iterator
|
|
||||||
I = localAvail.begin(), E = localAvail.end(); I != E; ++I)
|
|
||||||
delete I->second;
|
|
||||||
localAvail.clear();
|
|
||||||
|
|
||||||
DominatorTree &DT = getAnalysis<DominatorTree>();
|
|
||||||
|
|
||||||
// Top-down walk of the dominator tree
|
// Top-down walk of the dominator tree
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
@ -1351,3 +1347,13 @@ bool GVN::iterateOnFunction(Function &F) {
|
|||||||
|
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GVN::cleanupGlobalSets() {
|
||||||
|
VN.clear();
|
||||||
|
phiMap.clear();
|
||||||
|
|
||||||
|
for (DenseMap<BasicBlock*, ValueNumberScope*>::iterator
|
||||||
|
I = localAvail.begin(), E = localAvail.end(); I != E; ++I)
|
||||||
|
delete I->second;
|
||||||
|
localAvail.clear();
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user