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:
Chris Lattner
2009-11-01 04:23:20 +00:00
parent 660a4f389c
commit 0b649dd91f

View File

@@ -196,18 +196,20 @@ 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))) {
// If we have a constant, forward the edge from its current to its BasicBlock *PredBB = PN->getIncomingBlock(i-1);
// ultimate destination. if (isa<BranchInst>(PredBB->getTerminator())) {
unsigned DestCase = SI->findCaseValue(CI); // If we have a constant, forward the edge from its current to its
RevectorBlockTo(PN->getIncomingBlock(i-1), // ultimate destination.
SI->getSuccessor(DestCase)); unsigned DestCase = SI->findCaseValue(CI);
++NumSwThread; RevectorBlockTo(PredBB, SI->getSuccessor(DestCase));
++NumSwThread;
// If there were two predecessors before this simplification, or if the // If there were two predecessors before this simplification, or if the
// PHI node contained all the same value except for the one we just // PHI node contained all the same value except for the one we just
// substituted, the PHI node may be deleted. Don't iterate through it the // substituted, the PHI node may be deleted. Don't iterate through it the
// last time. // last time.
if (SI->getCondition() != PN) return; if (SI->getCondition() != PN) return;
}
} }
} }