aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/BranchFolding.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2009-12-15 00:39:24 +0000
committerBill Wendling <isanbard@gmail.com>2009-12-15 00:39:24 +0000
commit87426f8cd21507e13f0256a6727a0c27f60705c3 (patch)
tree623049c891b9cc8a3c90183b8af63a0fd7a7ba5c /lib/CodeGen/BranchFolding.cpp
parente6e14f2cfc4e8bd346bf3fa7a5ac87b6ebf422ff (diff)
downloadexternal_llvm-87426f8cd21507e13f0256a6727a0c27f60705c3.zip
external_llvm-87426f8cd21507e13f0256a6727a0c27f60705c3.tar.gz
external_llvm-87426f8cd21507e13f0256a6727a0c27f60705c3.tar.bz2
Revert these. They may have been causing 483_xalancbmk to fail:
$ svn merge -c -91161 https://llvm.org/svn/llvm-project/llvm/trunk --- Reverse-merging r91161 into '.': U lib/CodeGen/BranchFolding.cpp U lib/CodeGen/MachineBasicBlock.cpp $ svn merge -c -91113 https://llvm.org/svn/llvm-project/llvm/trunk --- Reverse-merging r91113 into '.': G lib/CodeGen/MachineBasicBlock.cpp $ svn merge -c -91101 https://llvm.org/svn/llvm-project/llvm/trunk --- Reverse-merging r91101 into '.': U include/llvm/CodeGen/MachineBasicBlock.h G lib/CodeGen/MachineBasicBlock.cpp $ svn merge -c -91092 https://llvm.org/svn/llvm-project/llvm/trunk --- Reverse-merging r91092 into '.': G include/llvm/CodeGen/MachineBasicBlock.h G lib/CodeGen/MachineBasicBlock.cpp git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91376 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/BranchFolding.cpp')
-rw-r--r--lib/CodeGen/BranchFolding.cpp42
1 files changed, 19 insertions, 23 deletions
diff --git a/lib/CodeGen/BranchFolding.cpp b/lib/CodeGen/BranchFolding.cpp
index 7ac8bda..3887e6d 100644
--- a/lib/CodeGen/BranchFolding.cpp
+++ b/lib/CodeGen/BranchFolding.cpp
@@ -1205,11 +1205,11 @@ ReoptimizeBlock:
}
}
- // If the prior block doesn't fall through into this block and if this block
- // doesn't fall through into some other block and it's not branching only to a
- // landing pad, then see if we can find a place to move this block where a
- // fall-through will happen.
- if (!PrevBB.canFallThrough() && !MBB->BranchesToLandingPad(MBB)) {
+ // If the prior block doesn't fall through into this block, and if this
+ // block doesn't fall through into some other block, see if we can find a
+ // place to move this block where a fall-through will happen.
+ if (!PrevBB.canFallThrough()) {
+
// 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 = MBB->canFallThrough();
@@ -1221,32 +1221,28 @@ ReoptimizeBlock:
E = MBB->pred_end(); PI != E; ++PI) {
// Analyze the branch at the end of the pred.
MachineBasicBlock *PredBB = *PI;
- MachineFunction::iterator PredNextBB = PredBB; ++PredNextBB;
+ MachineFunction::iterator PredFallthrough = PredBB; ++PredFallthrough;
MachineBasicBlock *PredTBB, *PredFBB;
SmallVector<MachineOperand, 4> PredCond;
- if (PredBB != MBB && !PredBB->canFallThrough()
- && !TII->AnalyzeBranch(*PredBB, PredTBB, PredFBB, PredCond, true)
+ if (PredBB != MBB && !PredBB->canFallThrough() &&
+ !TII->AnalyzeBranch(*PredBB, PredTBB, PredFBB, PredCond, true)
&& (!CurFallsThru || !CurTBB || !CurFBB)
&& (!CurFallsThru || MBB->getNumber() >= PredBB->getNumber())) {
- // If the current block doesn't fall through, just move it. If the
- // current block can fall through and does not end with a conditional
- // branch, we need to append an unconditional jump to the (current)
- // next block. To avoid a possible compile-time infinite loop, move
- // blocks only backward in this case.
- //
- // Also, if there are already 2 branches here, we cannot add a third.
- // I.e. we have the case:
- //
- // Bcc next
- // B elsewhere
- // next:
+ // If the current block doesn't fall through, just move it.
+ // If the current block can fall through and does not end with a
+ // conditional branch, we need to append an unconditional jump to
+ // the (current) next block. To avoid a possible compile-time
+ // infinite loop, move blocks only backward in this case.
+ // Also, if there are already 2 branches here, we cannot add a third;
+ // this means we have the case
+ // Bcc next
+ // B elsewhere
+ // next:
if (CurFallsThru) {
- MachineBasicBlock *NextBB =
- llvm::next(MachineFunction::iterator(MBB));
+ MachineBasicBlock *NextBB = llvm::next(MachineFunction::iterator(MBB));
CurCond.clear();
TII->InsertBranch(*MBB, NextBB, 0, CurCond);
}
-
MBB->moveAfter(PredBB);
MadeChange = true;
goto ReoptimizeBlock;