[llvm-branch-commits] [llvm-branch] r89617 - /llvm/branches/Apple/Zoidberg/lib/CodeGen/MachineBasicBlock.cpp
Jakob Stoklund Olesen
stoklund at 2pi.dk
Sun Nov 22 11:35:11 PST 2009
Author: stoklund
Date: Sun Nov 22 13:35:11 2009
New Revision: 89617
URL: http://llvm.org/viewvc/llvm-project?rev=89617&view=rev
Log:
89608
Modified:
llvm/branches/Apple/Zoidberg/lib/CodeGen/MachineBasicBlock.cpp
Modified: llvm/branches/Apple/Zoidberg/lib/CodeGen/MachineBasicBlock.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Zoidberg/lib/CodeGen/MachineBasicBlock.cpp?rev=89617&r1=89616&r2=89617&view=diff
==============================================================================
--- llvm/branches/Apple/Zoidberg/lib/CodeGen/MachineBasicBlock.cpp (original)
+++ llvm/branches/Apple/Zoidberg/lib/CodeGen/MachineBasicBlock.cpp Sun Nov 22 13:35:11 2009
@@ -279,8 +279,9 @@
// successors is its layout successor, rewrite it to a fallthrough
// conditional branch.
if (isLayoutSuccessor(TBB)) {
+ if (TII->ReverseBranchCondition(Cond))
+ return;
TII->RemoveBranch(*this);
- TII->ReverseBranchCondition(Cond);
TII->InsertBranch(*this, FBB, 0, Cond);
} else if (isLayoutSuccessor(FBB)) {
TII->RemoveBranch(*this);
@@ -292,8 +293,13 @@
MachineBasicBlock *MBBB = *next(succ_begin());
if (MBBA == TBB) std::swap(MBBB, MBBA);
if (isLayoutSuccessor(TBB)) {
+ if (TII->ReverseBranchCondition(Cond)) {
+ // We can't reverse the condition, add an unconditional branch.
+ Cond.clear();
+ TII->InsertBranch(*this, MBBA, 0, Cond);
+ return;
+ }
TII->RemoveBranch(*this);
- TII->ReverseBranchCondition(Cond);
TII->InsertBranch(*this, MBBA, 0, Cond);
} else if (!isLayoutSuccessor(MBBA)) {
TII->RemoveBranch(*this);
More information about the llvm-branch-commits
mailing list