[llvm-commits] CVS: llvm/lib/CodeGen/BranchFolding.cpp
Dale Johannesen
dalej at apple.com
Fri Jun 1 17:08:37 PDT 2007
Changes in directory llvm/lib/CodeGen:
BranchFolding.cpp updated: 1.62 -> 1.63
---
Log message:
Fix CorrectExtraCFGEdges to allow for multiple LandingPad targets.
---
Diffs of the changes: (+6 -9)
BranchFolding.cpp | 15 ++++++---------
1 files changed, 6 insertions(+), 9 deletions(-)
Index: llvm/lib/CodeGen/BranchFolding.cpp
diff -u llvm/lib/CodeGen/BranchFolding.cpp:1.62 llvm/lib/CodeGen/BranchFolding.cpp:1.63
--- llvm/lib/CodeGen/BranchFolding.cpp:1.62 Fri Jun 1 18:02:45 2007
+++ llvm/lib/CodeGen/BranchFolding.cpp Fri Jun 1 19:08:15 2007
@@ -675,6 +675,9 @@
/// CFG to be inserted. If we have proven that MBB can only branch to DestA and
/// DestB, remove any other MBB successors from the CFG. DestA and DestB can
/// be null.
+/// Besides DestA and DestB, retain other edges leading to LandingPads (currently
+/// there can be only one; we don't check or require that here).
+/// Note it is possible that DestA and/or DestB are LandingPads.
static bool CorrectExtraCFGEdges(MachineBasicBlock &MBB,
MachineBasicBlock *DestA,
MachineBasicBlock *DestB,
@@ -700,25 +703,19 @@
}
MachineBasicBlock::succ_iterator SI = MBB.succ_begin();
- bool foundPad = false;
+ MachineBasicBlock *OrigDestA = DestA, *OrigDestB = DestB;
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() && !foundPad) {
- foundPad = true;
+ } else if ((*SI)->isLandingPad() &&
+ *SI!=OrigDestA && *SI!=OrigDestB) {
++SI;
} else {
// Otherwise, this is a superfluous edge, remove it.
More information about the llvm-commits
mailing list