summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorStefan Maksimovic <stefan.maksimovic@mips.com>2018-11-01 10:10:42 +0000
committerStefan Maksimovic <stefan.maksimovic@mips.com>2018-11-01 10:10:42 +0000
commitcd0c50e3d251fb8c063f421f0fe82a6a837e462f (patch)
tree8bfe225563c0892397224dded141d68de5f149f0 /llvm/lib
parent46955b58eefc245f862aed31cdec23c1546bd412 (diff)
downloadbcm5719-llvm-cd0c50e3d251fb8c063f421f0fe82a6a837e462f.tar.gz
bcm5719-llvm-cd0c50e3d251fb8c063f421f0fe82a6a837e462f.zip
[Mips] Conditionally remove successor block
In MipsBranchExpansion::splitMBB, upon splitting a block with two direct branches, remove the successor of the newly created block (which inherits successors from the original block) which is pointed to by the last branch in the original block only if the targets of two branches differ. This is to fix the failing test when ran with -verify-machineinstrs enabled. Differential Revision: https://reviews.llvm.org/D53756 llvm-svn: 345821
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/Mips/MipsBranchExpansion.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Target/Mips/MipsBranchExpansion.cpp b/llvm/lib/Target/Mips/MipsBranchExpansion.cpp
index f316e308be7..a8aca905965 100644
--- a/llvm/lib/Target/Mips/MipsBranchExpansion.cpp
+++ b/llvm/lib/Target/Mips/MipsBranchExpansion.cpp
@@ -271,7 +271,8 @@ void MipsBranchExpansion::splitMBB(MachineBasicBlock *MBB) {
// Insert NewMBB and fix control flow.
MachineBasicBlock *Tgt = getTargetMBB(*FirstBr);
NewMBB->transferSuccessors(MBB);
- NewMBB->removeSuccessor(Tgt, true);
+ if (Tgt != getTargetMBB(*LastBr))
+ NewMBB->removeSuccessor(Tgt, true);
MBB->addSuccessor(NewMBB);
MBB->addSuccessor(Tgt);
MFp->insert(std::next(MachineFunction::iterator(MBB)), NewMBB);
OpenPOWER on IntegriCloud