[llvm-commits] CVS: llvm/lib/CodeGen/BranchFolding.cpp
Dale Johannesen
dalej at apple.com
Thu May 31 14:54:20 PDT 2007
Changes in directory llvm/lib/CodeGen:
BranchFolding.cpp updated: 1.60 -> 1.61
---
Log message:
Arrange for only 1 of multiple branches to landing pad to be kept.
Do not remove empty landing pads (EH table needs to be updated)
---
Diffs of the changes: (+13 -4)
BranchFolding.cpp | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
Index: llvm/lib/CodeGen/BranchFolding.cpp
diff -u llvm/lib/CodeGen/BranchFolding.cpp:1.60 llvm/lib/CodeGen/BranchFolding.cpp:1.61
--- llvm/lib/CodeGen/BranchFolding.cpp:1.60 Tue May 29 19:32:01 2007
+++ llvm/lib/CodeGen/BranchFolding.cpp Thu May 31 16:54:00 2007
@@ -684,18 +684,26 @@
}
}
- MachineBasicBlock::pred_iterator SI = MBB.succ_begin();
+ MachineBasicBlock::succ_iterator SI = MBB.succ_begin();
+ bool foundPad = false;
while (SI != MBB.succ_end()) {
if (*SI == DestA && DestA == DestB) {
DestA = DestB = 0;
+ if ((*SI)->isLandingPad())
+ foundPad = true;
++SI;
} else if (*SI == DestA) {
DestA = 0;
+ if ((*SI)->isLandingPad())
+ foundPad = true;
++SI;
} else if (*SI == DestB) {
DestB = 0;
+ if ((*SI)->isLandingPad())
+ foundPad = true;
++SI;
- } else if ((*SI)->isLandingPad()) {
+ } else if ((*SI)->isLandingPad() && !foundPad) {
+ foundPad = true;
++SI;
} else {
// Otherwise, this is a superfluous edge, remove it.
@@ -832,8 +840,9 @@
++FallThrough;
// If this block is empty, make everyone use its fall-through, not the block
- // explicitly.
- if (MBB->empty()) {
+ // explicitly. Landing pads should not do this since the landing-pad table
+ // points to this block.
+ if (MBB->empty() && !MBB->isLandingPad()) {
// Dead block? Leave for cleanup later.
if (MBB->pred_empty()) return;
More information about the llvm-commits
mailing list