[llvm-commits] CVS: llvm/lib/CodeGen/BranchFolding.cpp
Chris Lattner
sabre at nondot.org
Mon Apr 30 16:35:19 PDT 2007
Changes in directory llvm/lib/CodeGen:
BranchFolding.cpp updated: 1.45 -> 1.46
---
Log message:
Fix PR1228: http://llvm.org/PR1228 and CodeGen/Generic/2007-04-30-LandingPadBranchFolding.ll
---
Diffs of the changes: (+8 -2)
BranchFolding.cpp | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
Index: llvm/lib/CodeGen/BranchFolding.cpp
diff -u llvm/lib/CodeGen/BranchFolding.cpp:1.45 llvm/lib/CodeGen/BranchFolding.cpp:1.46
--- llvm/lib/CodeGen/BranchFolding.cpp:1.45 Tue Mar 20 16:35:06 2007
+++ llvm/lib/CodeGen/BranchFolding.cpp Mon Apr 30 18:35:00 2007
@@ -877,7 +877,7 @@
// 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 @@
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);
More information about the llvm-commits
mailing list