diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2009-11-22 18:28:04 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2009-11-22 18:28:04 +0000 |
commit | 8a3fdae0aa21dbf13d7f449ce515cd77cc1fa1cc (patch) | |
tree | 9c8e19065ccd46a4a6ded765c7493c949f5766dc /llvm/lib/CodeGen/MachineBasicBlock.cpp | |
parent | 43bff37afb1d0a021b8406b50a14d2cf75318748 (diff) | |
download | llvm-8a3fdae0aa21dbf13d7f449ce515cd77cc1fa1cc.zip llvm-8a3fdae0aa21dbf13d7f449ce515cd77cc1fa1cc.tar.gz llvm-8a3fdae0aa21dbf13d7f449ce515cd77cc1fa1cc.tar.bz2 |
Teach MachineBasicBlock::updateTerminator() to handle a failing TII->ReverseBranchCondition(Cond) call.
This fixes the MallocBench/cfrac test case regression.
llvm-svn: 89608
Diffstat (limited to 'llvm/lib/CodeGen/MachineBasicBlock.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineBasicBlock.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp index 2e6bd8a..e6a1878 100644 --- a/llvm/lib/CodeGen/MachineBasicBlock.cpp +++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp @@ -279,8 +279,9 @@ void MachineBasicBlock::updateTerminator() { // 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 @@ void MachineBasicBlock::updateTerminator() { 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); |