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

Quentin Colombet via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 22 11:46:17 PDT 2016


Author: qcolombet
Date: Fri Apr 22 13:46:17 2016
New Revision: 267185

URL: http://llvm.org/viewvc/llvm-project?rev=267185&view=rev
Log:
[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.

Modified:
    llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp
    llvm/trunk/test/CodeGen/AArch64/nzcv-save.ll

Modified: llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp?rev=267185&r1=267184&r2=267185&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp Fri Apr 22 13:46:17 2016
@@ -2138,8 +2138,7 @@ void AArch64InstrInfo::copyPhysReg(Machi
 
   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;

Modified: llvm/trunk/test/CodeGen/AArch64/nzcv-save.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/nzcv-save.ll?rev=267185&r1=267184&r2=267185&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/nzcv-save.ll (original)
+++ llvm/trunk/test/CodeGen/AArch64/nzcv-save.ll Fri Apr 22 13:46:17 2016
@@ -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]]




More information about the llvm-commits mailing list