diff options
-rw-r--r-- | lib/Target/Mips/MipsLongBranch.cpp | 5 | ||||
-rw-r--r-- | test/CodeGen/Mips/longbranch.ll | 8 |
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/Target/Mips/MipsLongBranch.cpp b/lib/Target/Mips/MipsLongBranch.cpp index bf5ad37031..24b42b9150 100644 --- a/lib/Target/Mips/MipsLongBranch.cpp +++ b/lib/Target/Mips/MipsLongBranch.cpp @@ -235,6 +235,11 @@ void MipsLongBranch::replaceBranch(MachineBasicBlock &MBB, Iter Br, MIB.addMBB(MBBOpnd); + // Bundle the instruction in the delay slot to the newly created branch + // and erase the original branch. + assert(Br->isBundledWithSucc()); + MachineBasicBlock::instr_iterator II(Br); + MIBundleBuilder(&*MIB).append(llvm::next(II)->removeFromBundle()); Br->eraseFromParent(); } diff --git a/test/CodeGen/Mips/longbranch.ll b/test/CodeGen/Mips/longbranch.ll index 1a4f79c191..af192d0e92 100644 --- a/test/CodeGen/Mips/longbranch.ll +++ b/test/CodeGen/Mips/longbranch.ll @@ -1,13 +1,17 @@ -; RUN: llc -march=mipsel -force-mips-long-branch < %s | FileCheck %s -check-prefix=O32 -; RUN: llc -march=mips64el -mcpu=mips64 -mattr=n64 -force-mips-long-branch < %s | FileCheck %s -check-prefix=N64 +; RUN: llc -march=mipsel -force-mips-long-branch -disable-mips-delay-filler < %s | FileCheck %s -check-prefix=O32 +; RUN: llc -march=mips64el -mcpu=mips64 -mattr=n64 -force-mips-long-branch -disable-mips-delay-filler < %s | FileCheck %s -check-prefix=N64 @g0 = external global i32 define void @foo1(i32 %s) nounwind { entry: +; O32: nop +; O32: addiu $sp, $sp, -8 ; O32: bal ; O32: lui $1, 0 ; O32: addiu $1, $1, {{[0-9]+}} +; N64: nop +; N64: daddiu $sp, $sp, -16 ; N64: lui $1, 0 ; N64: daddiu $1, $1, 0 ; N64: dsll $1, $1, 16 |