summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Mips/MipsLongBranch.cpp
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
commit55504b4ac9528324f5aeb6f65e830ca3851d8298 (patch)
tree0ceeef6149fab3e26a3d5acc4d5c5a198d7bad9e /llvm/lib/Target/Mips/MipsLongBranch.cpp
parent698d4ac8a883446a5f6959ba9b9674b61021a32a (diff)
downloadbcm5719-llvm-55504b4ac9528324f5aeb6f65e830ca3851d8298.tar.gz
bcm5719-llvm-55504b4ac9528324f5aeb6f65e830ca3851d8298.zip
[mips] Fix a bug in MipsLongBranch::replaceBranch, which was erasing
instructions in delay slots along with the original branch instructions. llvm-svn: 191978
Diffstat (limited to 'llvm/lib/Target/Mips/MipsLongBranch.cpp')
-rw-r--r--llvm/lib/Target/Mips/MipsLongBranch.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Target/Mips/MipsLongBranch.cpp b/llvm/lib/Target/Mips/MipsLongBranch.cpp
index 971176ec8fb..06bb14a383c 100644
--- a/llvm/lib/Target/Mips/MipsLongBranch.cpp
+++ b/llvm/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();
}
OpenPOWER on IntegriCloud