diff options
author | Simon Dardis <simon.dardis@imgtec.com> | 2017-06-13 14:11:29 +0000 |
---|---|---|
committer | Simon Dardis <simon.dardis@imgtec.com> | 2017-06-13 14:11:29 +0000 |
commit | c38d391f562ca73b5b73e593a8cef5cbc5223090 (patch) | |
tree | 8b9d4879a499ebb682c806ca9a94ed7ccb14a7d7 /llvm/lib/Target/Mips/MipsInstrInfo.cpp | |
parent | 9bd4d91037bf0ce824a1b759ddcdaed84ec341a8 (diff) | |
download | bcm5719-llvm-c38d391f562ca73b5b73e593a8cef5cbc5223090.tar.gz bcm5719-llvm-c38d391f562ca73b5b73e593a8cef5cbc5223090.zip |
[MIPS] BuildCondBr should preserve MO flags
While simplifying branches in the MachineInstr representation, the
routine BuildCondBr must preserve flags on register MachineOperands. In
particular, it must preserve the <undef> flag.
This fixes a bug that is unlikely to occur in any real scenario, but
which bugpoint is likely to introduce.
Patch By Nick Johnson!
Reviewers: ahatanak, sdardis
Differential Revision: https://reviews.llvm.org/D34041
llvm-svn: 305290
Diffstat (limited to 'llvm/lib/Target/Mips/MipsInstrInfo.cpp')
-rw-r--r-- | llvm/lib/Target/Mips/MipsInstrInfo.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/llvm/lib/Target/Mips/MipsInstrInfo.cpp b/llvm/lib/Target/Mips/MipsInstrInfo.cpp index df62c66b75a..4adf77f8d9a 100644 --- a/llvm/lib/Target/Mips/MipsInstrInfo.cpp +++ b/llvm/lib/Target/Mips/MipsInstrInfo.cpp @@ -103,12 +103,9 @@ void MipsInstrInfo::BuildCondBr(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineInstrBuilder MIB = BuildMI(&MBB, DL, MCID); for (unsigned i = 1; i < Cond.size(); ++i) { - if (Cond[i].isReg()) - MIB.addReg(Cond[i].getReg()); - else if (Cond[i].isImm()) - MIB.addImm(Cond[i].getImm()); - else - assert(false && "Cannot copy operand"); + assert((Cond[i].isImm() || Cond[i].isReg()) && + "Cannot copy operand for conditional branch!"); + MIB.add(Cond[i]); } MIB.addMBB(TBB); } |