[AArch64] When creating MRS instruction, make sure the destination register is

declared as a definition.

This fixes the machine verifier error for CodeGen/AArch64/nzcv-save.ll.

llvm-svn: 267185
This commit is contained in:
Quentin Colombet 2016-04-22 18:46:17 +00:00
parent 760e583e22
commit 658d9dbe56
2 changed files with 2 additions and 3 deletions

View File

@ -2138,8 +2138,7 @@ void AArch64InstrInfo::copyPhysReg(MachineBasicBlock &MBB,
if (SrcReg == AArch64::NZCV) {
assert(AArch64::GPR64RegClass.contains(DestReg) && "Invalid NZCV copy");
BuildMI(MBB, I, DL, get(AArch64::MRS))
.addReg(DestReg)
BuildMI(MBB, I, DL, get(AArch64::MRS), DestReg)
.addImm(AArch64SysReg::NZCV)
.addReg(AArch64::NZCV, RegState::Implicit | getKillRegState(KillSrc));
return;

View File

@ -1,4 +1,4 @@
; RUN: llc -march=aarch64 < %s | FileCheck %s
; RUN: llc -verify-machineinstrs -march=aarch64 < %s | FileCheck %s
; CHECK: mrs [[NZCV_SAVE:x[0-9]+]], NZCV
; CHECK: msr NZCV, [[NZCV_SAVE]]