summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAkira Hatanaka <ahatanaka@mips.com>2013-10-04 20:51:40 +0000
committerAkira Hatanaka <ahatanaka@mips.com>2013-10-04 20:51:40 +0000
commit60ccc3b0ece748b6d0b6bb51ccd1c4e31d334424 (patch)
tree9221cd2f2f836e96a99568266799de45298a6bee /lib
parentaf57bdf7d673a3731fb887218e7a9ccd1576ab4f (diff)
downloadllvm-60ccc3b0ece748b6d0b6bb51ccd1c4e31d334424.tar.gz
llvm-60ccc3b0ece748b6d0b6bb51ccd1c4e31d334424.tar.bz2
llvm-60ccc3b0ece748b6d0b6bb51ccd1c4e31d334424.tar.xz
[mips] Fix a bug in MipsLongBranch::replaceBranch, which was erasing
instructions in delay slots along with the original branch instructions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191978 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/Mips/MipsLongBranch.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Target/Mips/MipsLongBranch.cpp b/lib/Target/Mips/MipsLongBranch.cpp
index 971176ec8f..06bb14a383 100644
--- a/lib/Target/Mips/MipsLongBranch.cpp
+++ b/lib/Target/Mips/MipsLongBranch.cpp
@@ -237,6 +237,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();
}