mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-23 16:19:52 +00:00
strengthen an assumption: RevectorBlockTo knows that PredBB
ended in an uncond branch because the pass requires BreakCriticalEdges. However, BCE doesn't eliminate critical adges from indbrs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85707 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -196,11 +196,12 @@ void CondProp::SimplifyPredecessors(SwitchInst *SI) {
|
|||||||
// possible, and to avoid invalidating "i".
|
// possible, and to avoid invalidating "i".
|
||||||
for (unsigned i = PN->getNumIncomingValues(); i != 0; --i)
|
for (unsigned i = PN->getNumIncomingValues(); i != 0; --i)
|
||||||
if (ConstantInt *CI = dyn_cast<ConstantInt>(PN->getIncomingValue(i-1))) {
|
if (ConstantInt *CI = dyn_cast<ConstantInt>(PN->getIncomingValue(i-1))) {
|
||||||
|
BasicBlock *PredBB = PN->getIncomingBlock(i-1);
|
||||||
|
if (isa<BranchInst>(PredBB->getTerminator())) {
|
||||||
// If we have a constant, forward the edge from its current to its
|
// If we have a constant, forward the edge from its current to its
|
||||||
// ultimate destination.
|
// ultimate destination.
|
||||||
unsigned DestCase = SI->findCaseValue(CI);
|
unsigned DestCase = SI->findCaseValue(CI);
|
||||||
RevectorBlockTo(PN->getIncomingBlock(i-1),
|
RevectorBlockTo(PredBB, SI->getSuccessor(DestCase));
|
||||||
SI->getSuccessor(DestCase));
|
|
||||||
++NumSwThread;
|
++NumSwThread;
|
||||||
|
|
||||||
// If there were two predecessors before this simplification, or if the
|
// If there were two predecessors before this simplification, or if the
|
||||||
@@ -210,6 +211,7 @@ void CondProp::SimplifyPredecessors(SwitchInst *SI) {
|
|||||||
if (SI->getCondition() != PN) return;
|
if (SI->getCondition() != PN) return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// RevectorBlockTo - Revector the unconditional branch at the end of FromBB to
|
// RevectorBlockTo - Revector the unconditional branch at the end of FromBB to
|
||||||
|
|||||||
Reference in New Issue
Block a user