mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-22 10:29:35 +00:00
When comparing DominanceFrontier's, advance iterators
before erasing nodes, not after. Otherwise dom frontier checking reads from freed memory. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72168 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9b2818d207
commit
0a8fe7a245
@ -968,8 +968,8 @@ public:
|
||||
tmpSet.insert(*I);
|
||||
|
||||
for (DomSetType::const_iterator I = DS1.begin(),
|
||||
E = DS1.end(); I != E; ++I) {
|
||||
BasicBlock *Node = *I;
|
||||
E = DS1.end(); I != E; ) {
|
||||
BasicBlock *Node = *I++;
|
||||
|
||||
if (tmpSet.erase(Node) == 0)
|
||||
// Node is in DS1 but not in DS2.
|
||||
@ -993,7 +993,7 @@ public:
|
||||
tmpFrontiers.insert(std::make_pair(I->first, I->second));
|
||||
|
||||
for (DomSetMapType::iterator I = tmpFrontiers.begin(),
|
||||
E = tmpFrontiers.end(); I != E; ++I) {
|
||||
E = tmpFrontiers.end(); I != E; ) {
|
||||
BasicBlock *Node = I->first;
|
||||
const_iterator DFI = find(Node);
|
||||
if (DFI == end())
|
||||
@ -1002,6 +1002,7 @@ public:
|
||||
if (compareDomSet(I->second, DFI->second))
|
||||
return true;
|
||||
|
||||
++I;
|
||||
tmpFrontiers.erase(Node);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user