Fix PR1228 and CodeGen/Generic/2007-04-30-LandingPadBranchFolding.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36602 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2007-04-30 23:35:00 +00:00
parent 045a9278b8
commit 77edc4b1b0

View File

@ -914,7 +914,13 @@ void BranchFolder::OptimizeBlock(MachineBasicBlock *MBB) {
MachineBasicBlock *SuccBB = *SI;
MachineFunction::iterator SuccPrev = SuccBB; --SuccPrev;
std::vector<MachineOperand> SuccPrevCond;
if (SuccBB != MBB && !CanFallThrough(SuccPrev)) {
// If this block doesn't already fall-through to that successor, and if
// the succ doesn't already have a block that can fall through into it,
// and if the successor isn't an EH destination, we can arrange for the
// fallthrough to happen.
if (SuccBB != MBB && !CanFallThrough(SuccPrev) &&
!SuccBB->isLandingPad()) {
MBB->moveBefore(SuccBB);
MadeChange = true;
return OptimizeBlock(MBB);