mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-19 02:25:01 +00:00
Fix dom frontier update. This fixes PR4667.
Patch by Jakub Staszak. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78388 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -511,10 +511,14 @@ void LoopRotate::preserveCanonicalLoopForm(LPPassManager &LPM) {
|
|||||||
DF->addBasicBlock(L->getHeader(), LatchSet);
|
DF->addBasicBlock(L->getHeader(), LatchSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If a loop block dominates new loop latch then its frontier is
|
// If a loop block dominates new loop latch then add to its frontiers
|
||||||
// new header and Exit.
|
// new header and Exit and remove new latch (which is equal to original
|
||||||
|
// header).
|
||||||
BasicBlock *NewLatch = L->getLoopLatch();
|
BasicBlock *NewLatch = L->getLoopLatch();
|
||||||
DominatorTree *DT = getAnalysisIfAvailable<DominatorTree>();
|
|
||||||
|
assert(NewLatch == OrigHeader && "NewLatch is inequal to OrigHeader");
|
||||||
|
|
||||||
|
if (DominatorTree *DT = getAnalysisIfAvailable<DominatorTree>()) {
|
||||||
for (Loop::block_iterator BI = L->block_begin(), BE = L->block_end();
|
for (Loop::block_iterator BI = L->block_begin(), BE = L->block_end();
|
||||||
BI != BE; ++BI) {
|
BI != BE; ++BI) {
|
||||||
BasicBlock *B = *BI;
|
BasicBlock *B = *BI;
|
||||||
@@ -522,8 +526,7 @@ void LoopRotate::preserveCanonicalLoopForm(LPPassManager &LPM) {
|
|||||||
DominanceFrontier::iterator BDFI = DF->find(B);
|
DominanceFrontier::iterator BDFI = DF->find(B);
|
||||||
if (BDFI != DF->end()) {
|
if (BDFI != DF->end()) {
|
||||||
DominanceFrontier::DomSetType &BSet = BDFI->second;
|
DominanceFrontier::DomSetType &BSet = BDFI->second;
|
||||||
BSet = BDFI->second;
|
BSet.erase(NewLatch);
|
||||||
BSet.clear();
|
|
||||||
BSet.insert(L->getHeader());
|
BSet.insert(L->getHeader());
|
||||||
BSet.insert(Exit);
|
BSet.insert(Exit);
|
||||||
} else {
|
} else {
|
||||||
@@ -535,6 +538,7 @@ void LoopRotate::preserveCanonicalLoopForm(LPPassManager &LPM) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Preserve canonical loop form, which means Exit block should
|
// Preserve canonical loop form, which means Exit block should
|
||||||
// have only one predecessor.
|
// have only one predecessor.
|
||||||
|
Reference in New Issue
Block a user