diff --git a/lib/Target/Mips/MipsBranchExpansion.cpp b/lib/Target/Mips/MipsBranchExpansion.cpp index f316e308be7..a8aca905965 100644 --- a/lib/Target/Mips/MipsBranchExpansion.cpp +++ b/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); diff --git a/test/CodeGen/Mips/micromips-mtc-mfc.ll b/test/CodeGen/Mips/micromips-mtc-mfc.ll index 1db9337a982..c60b0067522 100644 --- a/test/CodeGen/Mips/micromips-mtc-mfc.ll +++ b/test/CodeGen/Mips/micromips-mtc-mfc.ll @@ -1,7 +1,7 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py -; RUN: llc -mtriple=mips -mcpu=mips32r2 -mattr=+micromips \ +; RUN: llc -mtriple=mips -mcpu=mips32r2 -mattr=+micromips -verify-machineinstrs \ ; RUN: -show-mc-encoding < %s | FileCheck --check-prefix=MM2 %s -; RUN: llc -mtriple=mips -mcpu=mips32r6 -mattr=+micromips \ +; RUN: llc -mtriple=mips -mcpu=mips32r6 -mattr=+micromips -verify-machineinstrs \ ; RUN: -show-mc-encoding < %s | FileCheck --check-prefix=MM6 %s define double @foo(double %a, double %b) {