diff options
| author | Chris Lattner <sabre@nondot.org> | 2007-04-30 23:35:00 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2007-04-30 23:35:00 +0000 |
| commit | 4dbbace4ff300b6b4b4694c35ed702482f130636 (patch) | |
| tree | 2fb3ec1742902b58ad9e992ca7ee010623320904 /llvm/lib/CodeGen/BranchFolding.cpp | |
| parent | 9d912af4e8002a7afae5eb6aa988f055c3683507 (diff) | |
| download | bcm5719-llvm-4dbbace4ff300b6b4b4694c35ed702482f130636.tar.gz bcm5719-llvm-4dbbace4ff300b6b4b4694c35ed702482f130636.zip | |
Fix PR1228 and CodeGen/Generic/2007-04-30-LandingPadBranchFolding.ll
llvm-svn: 36602
Diffstat (limited to 'llvm/lib/CodeGen/BranchFolding.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/BranchFolding.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/BranchFolding.cpp b/llvm/lib/CodeGen/BranchFolding.cpp index 1f5d6752b65..33f96df302f 100644 --- a/llvm/lib/CodeGen/BranchFolding.cpp +++ b/llvm/lib/CodeGen/BranchFolding.cpp @@ -877,7 +877,7 @@ void BranchFolder::OptimizeBlock(MachineBasicBlock *MBB) { // Now we know that there was no fall-through into this block, check to // see if it has a fall-through into its successor. bool CurFallsThru = CanFallThrough(MBB, CurUnAnalyzable, CurTBB, CurFBB, - CurCond); + CurCond); if (!MBB->isLandingPad()) { // 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; 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); |

