mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-01 00:17:01 +00:00
[AArch64] Keep flags on condition vreg when instantiating a CB branch.
Reversing a CB* instruction used to drop the flags on the condition. On the included testcase, this lead to a read from an undefined vreg. Using addOperand keeps the flags, here <undef>. Differential Revision: http://reviews.llvm.org/D6159 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221507 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -261,8 +261,9 @@ void AArch64InstrInfo::instantiateCondBranch(
|
||||
BuildMI(&MBB, DL, get(AArch64::Bcc)).addImm(Cond[0].getImm()).addMBB(TBB);
|
||||
} else {
|
||||
// Folded compare-and-branch
|
||||
// Note that we use addOperand instead of addReg to keep the flags.
|
||||
const MachineInstrBuilder MIB =
|
||||
BuildMI(&MBB, DL, get(Cond[1].getImm())).addReg(Cond[2].getReg());
|
||||
BuildMI(&MBB, DL, get(Cond[1].getImm())).addOperand(Cond[2]);
|
||||
if (Cond.size() > 3)
|
||||
MIB.addImm(Cond[3].getImm());
|
||||
MIB.addMBB(TBB);
|
||||
|
||||
Reference in New Issue
Block a user