aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChristopher Lamb <christopher.lamb@gmail.com>2007-12-10 07:24:06 +0000
committerChristopher Lamb <christopher.lamb@gmail.com>2007-12-10 07:24:06 +0000
commitff9045441499e076604a4f648c63de4fb9d0e64a (patch)
tree269a1e0d787265ac3f793513d1320da8ee4f7379 /lib
parent3e1980d0d56d7f7570e5c3000233bc21848ae0c6 (diff)
downloadexternal_llvm-ff9045441499e076604a4f648c63de4fb9d0e64a.zip
external_llvm-ff9045441499e076604a4f648c63de4fb9d0e64a.tar.gz
external_llvm-ff9045441499e076604a4f648c63de4fb9d0e64a.tar.bz2
Improve branch folding by recgonizing that explict successor relationships impact the value of fall-through choices.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44785 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/BranchFolding.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/CodeGen/BranchFolding.cpp b/lib/CodeGen/BranchFolding.cpp
index d4b1e90..0f8c662 100644
--- a/lib/CodeGen/BranchFolding.cpp
+++ b/lib/CodeGen/BranchFolding.cpp
@@ -775,6 +775,11 @@ static bool IsBetterFallthrough(MachineBasicBlock *MBB1,
// optimize branches that branch to either a return block or an assert block
// into a fallthrough to the return.
if (MBB1->empty() || MBB2->empty()) return false;
+
+ // If there is a clear successor ordering we make sure that one block
+ // will fall through to the next
+ if (MBB1->isSuccessor(MBB2)) return true;
+ if (MBB2->isSuccessor(MBB1)) return false;
MachineInstr *MBB1I = --MBB1->end();
MachineInstr *MBB2I = --MBB2->end();