1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 19:52:54 +01:00

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

llvm-svn: 36602
This commit is contained in:
Chris Lattner 2007-04-30 23:35:00 +00:00
parent ffb1892f98
commit 8da69f853c

View File

@ -877,7 +877,7 @@ void BranchFolder::OptimizeBlock(MachineBasicBlock *MBB) {
// Now we know that there was no fall-through into this block, check to // Now we know that there was no fall-through into this block, check to
// see if it has a fall-through into its successor. // see if it has a fall-through into its successor.
bool CurFallsThru = CanFallThrough(MBB, CurUnAnalyzable, CurTBB, CurFBB, bool CurFallsThru = CanFallThrough(MBB, CurUnAnalyzable, CurTBB, CurFBB,
CurCond); CurCond);
if (!MBB->isLandingPad()) { if (!MBB->isLandingPad()) {
// Check all the predecessors of this block. If one of them has no fall // Check all the predecessors of this block. If one of them has no fall
@ -914,7 +914,13 @@ void BranchFolder::OptimizeBlock(MachineBasicBlock *MBB) {
MachineBasicBlock *SuccBB = *SI; MachineBasicBlock *SuccBB = *SI;
MachineFunction::iterator SuccPrev = SuccBB; --SuccPrev; MachineFunction::iterator SuccPrev = SuccBB; --SuccPrev;
std::vector<MachineOperand> SuccPrevCond; 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); MBB->moveBefore(SuccBB);
MadeChange = true; MadeChange = true;
return OptimizeBlock(MBB); return OptimizeBlock(MBB);