summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Mips/MipsLongBranch.cpp
diff options
context:
space:
mode:
authorSimon Dardis <simon.dardis@imgtec.com>2017-06-14 12:16:47 +0000
committerSimon Dardis <simon.dardis@imgtec.com>2017-06-14 12:16:47 +0000
commit941a49b6d689813b8bac553cb5f410276d2aa519 (patch)
tree0fda9bdf3566defd5722b1f75e0478f2d82e221f /llvm/lib/Target/Mips/MipsLongBranch.cpp
parenta4ab1b1c59a8836c152450637ad9e3060ee7680f (diff)
downloadbcm5719-llvm-941a49b6d689813b8bac553cb5f410276d2aa519.tar.gz
bcm5719-llvm-941a49b6d689813b8bac553cb5f410276d2aa519.zip
[mips] Fix machine verifier errors in the long branch pass
This patch fixes two systemic machine verifier errors in the long branch pass. The first is the incorrect basic block successors and the second was the incorrect construction of several jump instructions. This partially resolves PR27458 and the associated PR32146. Reviewers: slthakur Differential Revision: https://reviews.llvm.org/D33378 llvm-svn: 305382
Diffstat (limited to 'llvm/lib/Target/Mips/MipsLongBranch.cpp')
-rw-r--r--llvm/lib/Target/Mips/MipsLongBranch.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/llvm/lib/Target/Mips/MipsLongBranch.cpp b/llvm/lib/Target/Mips/MipsLongBranch.cpp
index b95f1158fa5..272595af5f6 100644
--- a/llvm/lib/Target/Mips/MipsLongBranch.cpp
+++ b/llvm/lib/Target/Mips/MipsLongBranch.cpp
@@ -274,8 +274,8 @@ void MipsLongBranch::expandToLongBranch(MBBInfo &I) {
if (IsPIC) {
MachineBasicBlock *BalTgtMBB = MF->CreateMachineBasicBlock(BB);
MF->insert(FallThroughMBB, BalTgtMBB);
- LongBrMBB->addSuccessor(BalTgtMBB);
- BalTgtMBB->addSuccessor(TgtMBB);
+ LongBrMBB->addSuccessor(BalTgtMBB, BranchProbability::getOne());
+ BalTgtMBB->addSuccessor(&*FallThroughMBB, BranchProbability::getOne());
// We must select between the MIPS32r6/MIPS64r6 BAL (which is a normal
// instruction) and the pre-MIPS32r6/MIPS64r6 definition (which is an
@@ -342,8 +342,8 @@ void MipsLongBranch::expandToLongBranch(MBBInfo &I) {
.addReg(Mips::SP).addImm(8);
if (Subtarget.hasMips32r6())
- BuildMI(*BalTgtMBB, Pos, DL, TII->get(Mips::JALR))
- .addReg(Mips::ZERO).addReg(Mips::AT);
+ BuildMI(*BalTgtMBB, Pos, DL, TII->get(Mips::JALR), Mips::ZERO)
+ .addReg(Mips::AT);
else
BuildMI(*BalTgtMBB, Pos, DL, TII->get(Mips::JR)).addReg(Mips::AT);
@@ -415,8 +415,8 @@ void MipsLongBranch::expandToLongBranch(MBBInfo &I) {
.addReg(Mips::SP_64).addImm(0);
if (Subtarget.hasMips64r6())
- BuildMI(*BalTgtMBB, Pos, DL, TII->get(Mips::JALR64))
- .addReg(Mips::ZERO_64).addReg(Mips::AT_64);
+ BuildMI(*BalTgtMBB, Pos, DL, TII->get(Mips::JALR64), Mips::ZERO_64)
+ .addReg(Mips::AT_64);
else
BuildMI(*BalTgtMBB, Pos, DL, TII->get(Mips::JR64)).addReg(Mips::AT_64);
OpenPOWER on IntegriCloud