[llvm] [AMDGPU] Add MachineVerifier check to detect illegal copies from vector register to SGPR (PR #105494)
Aditi Medhane via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 2 02:18:25 PDT 2024
https://github.com/AditiRM updated https://github.com/llvm/llvm-project/pull/105494
>From 28724d61d2b4c5da60bf44f46a68aa004d35ebb6 Mon Sep 17 00:00:00 2001
From: AditiRM <aditi.medhane at amd.com>
Date: Wed, 21 Aug 2024 06:36:47 +0000
Subject: [PATCH 1/3] [AMDGPU] Add MachineVerifer check to detect illegal
copies from VGPR to SGPR
---
llvm/lib/Target/AMDGPU/SIInstrInfo.cpp | 32 +++++++++++++++++--
llvm/lib/Target/AMDGPU/SIInstrInfo.h | 3 ++
.../AMDGPU/fix-illegal-vgpr-copies.mir | 29 +++++++++++++++++
.../AMDGPU/phi-moveimm-subreg-input.mir | 30 +++++++++++++++++
.../CodeGen/AMDGPU/phi-vgpr-input-moveimm.mir | 32 -------------------
llvm/test/CodeGen/AMDGPU/wqm.mir | 9 +++---
6 files changed, 95 insertions(+), 40 deletions(-)
create mode 100644 llvm/test/CodeGen/AMDGPU/fix-illegal-vgpr-copies.mir
create mode 100644 llvm/test/CodeGen/AMDGPU/phi-moveimm-subreg-input.mir
diff --git a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
index b6dd4905fb61bb..22572a92227b70 100644
--- a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
+++ b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
@@ -4613,15 +4613,41 @@ static bool isSubRegOf(const SIRegisterInfo &TRI,
SubReg.getReg() == SuperVec.getReg();
}
+// Verify the illgal copy from VGPR to SGPR for generic opcode COPY
+bool SIInstrInfo::verifyCopy(const MachineInstr &MI,
+ const MachineRegisterInfo &MRI,
+ StringRef &ErrInfo) const {
+ const MachineOperand &Dst = MI.getOperand(0);
+ const MachineOperand &Src = MI.getOperand(1);
+
+ if (Dst.isReg() && Src.isReg()) {
+ Register DstReg = Dst.getReg();
+ Register SrcReg = Src.getReg();
+ // This is a check for copy from an VGPR to SGPR
+ if (RI.isVGPR(MRI, SrcReg) && RI.isSGPRReg(MRI, DstReg)) {
+ ErrInfo = "illegal copy from VGPR to SGPR";
+ return false;
+ }
+ }
+ return true;
+}
+
bool SIInstrInfo::verifyInstruction(const MachineInstr &MI,
StringRef &ErrInfo) const {
uint16_t Opcode = MI.getOpcode();
- if (SIInstrInfo::isGenericOpcode(MI.getOpcode()))
- return true;
-
const MachineFunction *MF = MI.getParent()->getParent();
const MachineRegisterInfo &MRI = MF->getRegInfo();
+ if (SIInstrInfo::isGenericOpcode(MI.getOpcode())) {
+ // FIXME: At this point the COPY verify is done only for non-ssa forms.
+ // Find a better property to recognize the point where instruction selection
+ // is just done.
+ if (!MRI.isSSA() && MI.isCopy())
+ return verifyCopy(MI, MRI, ErrInfo);
+
+ return true;
+ }
+
int Src0Idx = AMDGPU::getNamedOperandIdx(Opcode, AMDGPU::OpName::src0);
int Src1Idx = AMDGPU::getNamedOperandIdx(Opcode, AMDGPU::OpName::src1);
int Src2Idx = AMDGPU::getNamedOperandIdx(Opcode, AMDGPU::OpName::src2);
diff --git a/llvm/lib/Target/AMDGPU/SIInstrInfo.h b/llvm/lib/Target/AMDGPU/SIInstrInfo.h
index 1712dfe8d406cc..4caf37cd2f08e0 100644
--- a/llvm/lib/Target/AMDGPU/SIInstrInfo.h
+++ b/llvm/lib/Target/AMDGPU/SIInstrInfo.h
@@ -178,6 +178,9 @@ class SIInstrInfo final : public AMDGPUGenInstrInfo {
Register findUsedSGPR(const MachineInstr &MI, int OpIndices[3]) const;
+ bool verifyCopy(const MachineInstr &MI, const MachineRegisterInfo &MRI,
+ StringRef &ErrInfo) const;
+
protected:
/// If the specific machine instruction is a instruction that moves/copies
/// value from one register to another register return destination and source
diff --git a/llvm/test/CodeGen/AMDGPU/fix-illegal-vgpr-copies.mir b/llvm/test/CodeGen/AMDGPU/fix-illegal-vgpr-copies.mir
new file mode 100644
index 00000000000000..8eaab0a16e55e4
--- /dev/null
+++ b/llvm/test/CodeGen/AMDGPU/fix-illegal-vgpr-copies.mir
@@ -0,0 +1,29 @@
+# RUN: not --crash llc -march=amdgcn -mcpu=gfx1200 -run-pass=machineverifier %s 2>&1 | FileCheck -check-prefix=ERR %s
+
+---
+name: fix-illegal-copies
+tracksRegLiveness: true
+machineFunctionInfo:
+ isEntryFunction: true
+body: |
+ bb.0:
+ %0:vgpr_32 = IMPLICIT_DEF
+ %0:vgpr_32 = IMPLICIT_DEF ; Break SSA format
+ %1:vgpr_32 = IMPLICIT_DEF
+ %2:sgpr_32 = IMPLICIT_DEF
+ %3:sgpr_32 = IMPLICIT_DEF
+
+ ; ERR: *** Bad machine code: illegal copy from VGPR to SGPR ***
+ ; ERR: instruction: %4:sgpr_32 = COPY %0:vgpr_32
+ %4:sgpr_32 = COPY %0:vgpr_32
+
+ ; ERR: *** Bad machine code: illegal copy from VGPR to SGPR ***
+ ; ERR: instruction: $sgpr0 = COPY %0:vgpr_32
+ $sgpr0 = COPY %0:vgpr_32
+
+ ; ERR: *** Bad machine code: illegal copy from VGPR to SGPR ***
+ ; ERR: instruction: $sgpr1 = COPY $vgpr0
+ $sgpr1 = COPY $vgpr0
+
+ S_ENDPGM 0
+...
diff --git a/llvm/test/CodeGen/AMDGPU/phi-moveimm-subreg-input.mir b/llvm/test/CodeGen/AMDGPU/phi-moveimm-subreg-input.mir
new file mode 100644
index 00000000000000..5d58673f7bdca9
--- /dev/null
+++ b/llvm/test/CodeGen/AMDGPU/phi-moveimm-subreg-input.mir
@@ -0,0 +1,30 @@
+# RUN: not --crash llc -mtriple=amdgcn -mcpu=gfx900 -verify-machineinstrs -run-pass=si-fix-sgpr-copies -o - %s 2>&1 | FileCheck -check-prefix=GCN %s
+
+# GCN: *** Bad machine code: illegal copy from VGPR to SGPR ***
+# GCN: instruction: undef %5.sub0:sreg_64 = COPY %0:vgpr_32
+name: phi_moveimm_subreg_input
+tracksRegLiveness: true
+body: |
+ bb.0:
+ successors: %bb.1
+ liveins: $sgpr0, $sgpr1
+
+ %0:vgpr_32 = V_MOV_B32_e32 0, implicit $exec
+
+ %4:sreg_32 = COPY $sgpr0
+ %5:sreg_32 = COPY $sgpr1
+
+ bb.1:
+ successors: %bb.2
+ undef %2.sub0:sreg_64 = S_ADD_U32 %4, %5, implicit-def $scc
+ S_BRANCH %bb.2
+
+ bb.2:
+ successors: %bb.3
+ %3:sreg_64 = PHI %1, %bb.3, %2, %bb.1
+ S_BRANCH %bb.3
+
+ bb.3:
+ successors: %bb.2
+ undef %1.sub0:sreg_64 = COPY %0
+ S_BRANCH %bb.2
diff --git a/llvm/test/CodeGen/AMDGPU/phi-vgpr-input-moveimm.mir b/llvm/test/CodeGen/AMDGPU/phi-vgpr-input-moveimm.mir
index f931acb8408da2..2b78f984ae775c 100644
--- a/llvm/test/CodeGen/AMDGPU/phi-vgpr-input-moveimm.mir
+++ b/llvm/test/CodeGen/AMDGPU/phi-vgpr-input-moveimm.mir
@@ -32,38 +32,6 @@ body: |
S_BRANCH %bb.2
...
----
-# GCN-LABEL: name: phi_moveimm_subreg_input
-# GCN: %{{[0-9]+}}:sreg_64 = PHI %{{[0-9]+}}, %bb.3, %{{[0-9]+}}, %bb.1
-name: phi_moveimm_subreg_input
-tracksRegLiveness: true
-body: |
- bb.0:
- successors: %bb.1
- liveins: $sgpr0, $sgpr1
-
- %0:vgpr_32 = V_MOV_B32_e32 0, implicit $exec
-
- %4:sreg_32 = COPY $sgpr0
- %5:sreg_32 = COPY $sgpr1
-
- bb.1:
- successors: %bb.2
- undef %2.sub0:sreg_64 = S_ADD_U32 %4, %5, implicit-def $scc
- S_BRANCH %bb.2
-
- bb.2:
- successors: %bb.3
- %3:sreg_64 = PHI %1, %bb.3, %2, %bb.1
- S_BRANCH %bb.3
-
- bb.3:
- successors: %bb.2
- undef %1.sub0:sreg_64 = COPY %0
- S_BRANCH %bb.2
-...
-
-
---
# GCN-LABEL: name: phi_moveimm_bad_opcode_input
# GCN-NOT: %{{[0-9]+}}:sreg_32 = PHI %{{[0-9]+}}, %bb.3, %{{[0-9]+}}, %bb.1
diff --git a/llvm/test/CodeGen/AMDGPU/wqm.mir b/llvm/test/CodeGen/AMDGPU/wqm.mir
index ef6d0780f395fd..5ff508b1e3842e 100644
--- a/llvm/test/CodeGen/AMDGPU/wqm.mir
+++ b/llvm/test/CodeGen/AMDGPU/wqm.mir
@@ -189,9 +189,9 @@ body: |
# Ensure that strict_wwm is not put around an EXEC copy
#CHECK-LABEL: name: copy_exec
#CHECK: %7:sreg_64 = COPY $exec
-#CHECK-NEXT: %14:sreg_64 = ENTER_STRICT_WWM -1, implicit-def $exec, implicit-def $scc, implicit $exec
+#CHECK-NEXT: %13:sreg_64 = ENTER_STRICT_WWM -1, implicit-def $exec, implicit-def $scc, implicit $exec
#CHECK-NEXT: %8:vgpr_32 = V_MOV_B32_e32 0, implicit $exec
-#CHECK-NEXT: $exec = EXIT_STRICT_WWM %14
+#CHECK-NEXT: $exec = EXIT_STRICT_WWM %13
#CHECK-NEXT: %9:vgpr_32 = V_MBCNT_LO_U32_B32_e64 %7.sub0, 0, implicit $exec
name: copy_exec
tracksRegLiveness: true
@@ -212,10 +212,9 @@ body: |
%10:vgpr_32 = V_MBCNT_LO_U32_B32_e64 %8.sub0:sreg_64, 0, implicit $exec
%11:vgpr_32 = V_MOV_B32_dpp %9:vgpr_32, %10:vgpr_32, 312, 15, 15, 0, implicit $exec
%12:sreg_32 = V_READLANE_B32 %11:vgpr_32, 63
- early-clobber %13:sreg_32 = STRICT_WWM %9:vgpr_32, implicit $exec
+ early-clobber %13:vgpr_32 = STRICT_WWM %9:vgpr_32, implicit $exec
- %14:vgpr_32 = COPY %13
- BUFFER_STORE_DWORD_OFFSET_exact killed %14, %4, %5, 4, 0, 0, implicit $exec
+ BUFFER_STORE_DWORD_OFFSET_exact killed %13, %4, %5, 4, 0, 0, implicit $exec
S_ENDPGM 0
...
>From e5f73a030974e545bee3657065748e3fa10c083d Mon Sep 17 00:00:00 2001
From: AditiRM <Aditi.Medhane at amd.com>
Date: Tue, 27 Aug 2024 15:14:18 +0530
Subject: [PATCH 2/3] Handle review comments
Addition of illegal AGPR to SGPR copies and update with review changes
---
llvm/lib/Target/AMDGPU/SIInstrInfo.cpp | 24 ++++----
.../AMDGPU/fix-illegal-vgpr-copies.mir | 29 ---------
.../MachineVerifier/fix-illegal-copies.mir | 60 +++++++++++++++++++
3 files changed, 74 insertions(+), 39 deletions(-)
delete mode 100644 llvm/test/CodeGen/AMDGPU/fix-illegal-vgpr-copies.mir
create mode 100644 llvm/test/MachineVerifier/fix-illegal-copies.mir
diff --git a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
index 22572a92227b70..4762c1283b6b4d 100644
--- a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
+++ b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
@@ -4613,22 +4613,27 @@ static bool isSubRegOf(const SIRegisterInfo &TRI,
SubReg.getReg() == SuperVec.getReg();
}
-// Verify the illgal copy from VGPR to SGPR for generic opcode COPY
+// Verify the illegal copy from VGPR to SGPR for generic opcode COPY
bool SIInstrInfo::verifyCopy(const MachineInstr &MI,
const MachineRegisterInfo &MRI,
StringRef &ErrInfo) const {
const MachineOperand &Dst = MI.getOperand(0);
const MachineOperand &Src = MI.getOperand(1);
- if (Dst.isReg() && Src.isReg()) {
- Register DstReg = Dst.getReg();
- Register SrcReg = Src.getReg();
- // This is a check for copy from an VGPR to SGPR
- if (RI.isVGPR(MRI, SrcReg) && RI.isSGPRReg(MRI, DstReg)) {
- ErrInfo = "illegal copy from VGPR to SGPR";
- return false;
- }
+ Register DstReg = Dst.getReg();
+ Register SrcReg = Src.getReg();
+ // This is a check for copy from an VGPR to SGPR
+ if (RI.isVGPR(MRI, SrcReg) && RI.isSGPRReg(MRI, DstReg)) {
+ ErrInfo = "illegal copy from VGPR to SGPR";
+ return false;
}
+
+ // This is a check for copy from an AGPR to SGPR
+ if (RI.isAGPR(MRI, SrcReg) && RI.isSGPRReg(MRI, DstReg)) {
+ ErrInfo = "illegal copy from AGPR to SGPR";
+ return false;
+ }
+
return true;
}
@@ -4644,7 +4649,6 @@ bool SIInstrInfo::verifyInstruction(const MachineInstr &MI,
// is just done.
if (!MRI.isSSA() && MI.isCopy())
return verifyCopy(MI, MRI, ErrInfo);
-
return true;
}
diff --git a/llvm/test/CodeGen/AMDGPU/fix-illegal-vgpr-copies.mir b/llvm/test/CodeGen/AMDGPU/fix-illegal-vgpr-copies.mir
deleted file mode 100644
index 8eaab0a16e55e4..00000000000000
--- a/llvm/test/CodeGen/AMDGPU/fix-illegal-vgpr-copies.mir
+++ /dev/null
@@ -1,29 +0,0 @@
-# RUN: not --crash llc -march=amdgcn -mcpu=gfx1200 -run-pass=machineverifier %s 2>&1 | FileCheck -check-prefix=ERR %s
-
----
-name: fix-illegal-copies
-tracksRegLiveness: true
-machineFunctionInfo:
- isEntryFunction: true
-body: |
- bb.0:
- %0:vgpr_32 = IMPLICIT_DEF
- %0:vgpr_32 = IMPLICIT_DEF ; Break SSA format
- %1:vgpr_32 = IMPLICIT_DEF
- %2:sgpr_32 = IMPLICIT_DEF
- %3:sgpr_32 = IMPLICIT_DEF
-
- ; ERR: *** Bad machine code: illegal copy from VGPR to SGPR ***
- ; ERR: instruction: %4:sgpr_32 = COPY %0:vgpr_32
- %4:sgpr_32 = COPY %0:vgpr_32
-
- ; ERR: *** Bad machine code: illegal copy from VGPR to SGPR ***
- ; ERR: instruction: $sgpr0 = COPY %0:vgpr_32
- $sgpr0 = COPY %0:vgpr_32
-
- ; ERR: *** Bad machine code: illegal copy from VGPR to SGPR ***
- ; ERR: instruction: $sgpr1 = COPY $vgpr0
- $sgpr1 = COPY $vgpr0
-
- S_ENDPGM 0
-...
diff --git a/llvm/test/MachineVerifier/fix-illegal-copies.mir b/llvm/test/MachineVerifier/fix-illegal-copies.mir
new file mode 100644
index 00000000000000..e1737eb0d0c959
--- /dev/null
+++ b/llvm/test/MachineVerifier/fix-illegal-copies.mir
@@ -0,0 +1,60 @@
+# RUN: not --crash llc -march=amdgcn -mcpu=gfx1200 -run-pass=none -o /dev/null %s 2>&1 | FileCheck %s
+# REQUIRES: amdgpu-registered-target
+
+---
+name: fix-illegal-copies
+tracksRegLiveness: true
+machineFunctionInfo:
+ isEntryFunction: true
+body: |
+ bb.0:
+ %0:vgpr_32 = IMPLICIT_DEF
+ %0:vgpr_32 = IMPLICIT_DEF ; Break SSA format
+ %1:vgpr_32 = IMPLICIT_DEF
+ %2:sgpr_32 = IMPLICIT_DEF
+ %3:sgpr_32 = IMPLICIT_DEF
+ %4:agpr_32 = IMPLICIT_DEF
+ %5:agpr_32 = IMPLICIT_DEF
+
+ ; copy from virtual VGPR to virtual SGPR
+ ; CHECK: *** Bad machine code: illegal copy from VGPR to SGPR ***
+ ; CHECK: - instruction: %6:sgpr_32 = COPY %0:vgpr_32
+ %6:sgpr_32 = COPY %0:vgpr_32
+
+ ; copy from virtual VGPR to physical SGPR
+ ; CHECK: *** Bad machine code: illegal copy from VGPR to SGPR ***
+ ; CHECK: - instruction: $sgpr0 = COPY %0:vgpr_32
+ $sgpr0 = COPY %0:vgpr_32
+
+ ; copy from physical VGPR to physical SGPR
+ ; CHECK: *** Bad machine code: illegal copy from VGPR to SGPR ***
+ ; CHECK: - instruction: $sgpr1 = COPY $vgpr0
+ $sgpr1 = COPY $vgpr0
+
+ ; copy from virtual AGPR to virtual SGPR
+ ; CHECK: *** Bad machine code: illegal copy from AGPR to SGPR ***
+ ; CHECK: - instruction: %7:sgpr_32 = COPY %4:agpr_32
+ %7:sgpr_32 = COPY %4:agpr_32
+
+ ; copy from virtual AGPR to physical SGPR
+ ; CHECK: *** Bad machine code: illegal copy from AGPR to SGPR ***
+ ; CHECK: - instruction: $sgpr2 = COPY %4:agpr_32
+ $sgpr2 = COPY %4:agpr_32
+
+ ; copy from physical AGPR to physical SGPR
+ ; CHECK: *** Bad machine code: illegal copy from AGPR to SGPR ***
+ ; CHECK: - instruction: $sgpr3 = COPY $agpr0
+ $sgpr3 = COPY $agpr0
+
+ ; copy from tuple of physical VGPRs to tuple of physical SGPRs
+ ; CHECK: *** Bad machine code: illegal copy from VGPR to SGPR ***
+ ; CHECK: - instruction: $sgpr4_sgpr5 = COPY $vgpr0_vgpr1
+ $sgpr4_sgpr5 = COPY $vgpr0_vgpr1
+
+ ; copy from tuple of physical AGPRs to tuple of physical SGPRs
+ ; CHECK: *** Bad machine code: illegal copy from AGPR to SGPR ***
+ ; CHECK: - instruction: $sgpr6_sgpr7 = COPY $agpr0_agpr1
+ $sgpr6_sgpr7 = COPY $agpr0_agpr1
+
+ S_ENDPGM 0
+...
>From 9c89b57102e05ed82b76e818349be555d2d6ba60 Mon Sep 17 00:00:00 2001
From: AditiRM <Aditi.Medhane at amd.com>
Date: Wed, 28 Aug 2024 10:27:20 +0530
Subject: [PATCH 3/3] Handle Review comments
introduced vector register illegal copies for both VGPR and AGPR, removed subreg-input testcase scenario, updated the testcase error checks accordingly
---
llvm/lib/Target/AMDGPU/SIInstrInfo.cpp | 23 +++++---------
.../AMDGPU/phi-moveimm-subreg-input.mir | 30 -------------------
.../MachineVerifier/fix-illegal-copies.mir | 16 +++++-----
3 files changed, 15 insertions(+), 54 deletions(-)
delete mode 100644 llvm/test/CodeGen/AMDGPU/phi-moveimm-subreg-input.mir
diff --git a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
index 4762c1283b6b4d..9f8b856643ccd2 100644
--- a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
+++ b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
@@ -4613,27 +4613,17 @@ static bool isSubRegOf(const SIRegisterInfo &TRI,
SubReg.getReg() == SuperVec.getReg();
}
-// Verify the illegal copy from VGPR to SGPR for generic opcode COPY
+// Verify the illegal copy from vector register to SGPR for generic opcode COPY
bool SIInstrInfo::verifyCopy(const MachineInstr &MI,
const MachineRegisterInfo &MRI,
StringRef &ErrInfo) const {
- const MachineOperand &Dst = MI.getOperand(0);
- const MachineOperand &Src = MI.getOperand(1);
-
- Register DstReg = Dst.getReg();
- Register SrcReg = Src.getReg();
- // This is a check for copy from an VGPR to SGPR
- if (RI.isVGPR(MRI, SrcReg) && RI.isSGPRReg(MRI, DstReg)) {
- ErrInfo = "illegal copy from VGPR to SGPR";
+ Register DstReg = MI.getOperand(0).getReg();
+ Register SrcReg = MI.getOperand(1).getReg();
+ // This is a check for copy from vector register to SGPR
+ if (RI.isVectorRegister(MRI, SrcReg) && RI.isSGPRReg(MRI, DstReg)) {
+ ErrInfo = "illegal copy from vector register to SGPR";
return false;
}
-
- // This is a check for copy from an AGPR to SGPR
- if (RI.isAGPR(MRI, SrcReg) && RI.isSGPRReg(MRI, DstReg)) {
- ErrInfo = "illegal copy from AGPR to SGPR";
- return false;
- }
-
return true;
}
@@ -4647,6 +4637,7 @@ bool SIInstrInfo::verifyInstruction(const MachineInstr &MI,
// FIXME: At this point the COPY verify is done only for non-ssa forms.
// Find a better property to recognize the point where instruction selection
// is just done.
+ // We can only enforce this check after SIFixSGPRCopies pass.
if (!MRI.isSSA() && MI.isCopy())
return verifyCopy(MI, MRI, ErrInfo);
return true;
diff --git a/llvm/test/CodeGen/AMDGPU/phi-moveimm-subreg-input.mir b/llvm/test/CodeGen/AMDGPU/phi-moveimm-subreg-input.mir
deleted file mode 100644
index 5d58673f7bdca9..00000000000000
--- a/llvm/test/CodeGen/AMDGPU/phi-moveimm-subreg-input.mir
+++ /dev/null
@@ -1,30 +0,0 @@
-# RUN: not --crash llc -mtriple=amdgcn -mcpu=gfx900 -verify-machineinstrs -run-pass=si-fix-sgpr-copies -o - %s 2>&1 | FileCheck -check-prefix=GCN %s
-
-# GCN: *** Bad machine code: illegal copy from VGPR to SGPR ***
-# GCN: instruction: undef %5.sub0:sreg_64 = COPY %0:vgpr_32
-name: phi_moveimm_subreg_input
-tracksRegLiveness: true
-body: |
- bb.0:
- successors: %bb.1
- liveins: $sgpr0, $sgpr1
-
- %0:vgpr_32 = V_MOV_B32_e32 0, implicit $exec
-
- %4:sreg_32 = COPY $sgpr0
- %5:sreg_32 = COPY $sgpr1
-
- bb.1:
- successors: %bb.2
- undef %2.sub0:sreg_64 = S_ADD_U32 %4, %5, implicit-def $scc
- S_BRANCH %bb.2
-
- bb.2:
- successors: %bb.3
- %3:sreg_64 = PHI %1, %bb.3, %2, %bb.1
- S_BRANCH %bb.3
-
- bb.3:
- successors: %bb.2
- undef %1.sub0:sreg_64 = COPY %0
- S_BRANCH %bb.2
diff --git a/llvm/test/MachineVerifier/fix-illegal-copies.mir b/llvm/test/MachineVerifier/fix-illegal-copies.mir
index e1737eb0d0c959..c3acebf7a694eb 100644
--- a/llvm/test/MachineVerifier/fix-illegal-copies.mir
+++ b/llvm/test/MachineVerifier/fix-illegal-copies.mir
@@ -17,42 +17,42 @@ body: |
%5:agpr_32 = IMPLICIT_DEF
; copy from virtual VGPR to virtual SGPR
- ; CHECK: *** Bad machine code: illegal copy from VGPR to SGPR ***
+ ; CHECK: *** Bad machine code: illegal copy from vector register to SGPR ***
; CHECK: - instruction: %6:sgpr_32 = COPY %0:vgpr_32
%6:sgpr_32 = COPY %0:vgpr_32
; copy from virtual VGPR to physical SGPR
- ; CHECK: *** Bad machine code: illegal copy from VGPR to SGPR ***
+ ; CHECK: *** Bad machine code: illegal copy from vector register to SGPR ***
; CHECK: - instruction: $sgpr0 = COPY %0:vgpr_32
$sgpr0 = COPY %0:vgpr_32
; copy from physical VGPR to physical SGPR
- ; CHECK: *** Bad machine code: illegal copy from VGPR to SGPR ***
+ ; CHECK: *** Bad machine code: illegal copy from vector register to SGPR ***
; CHECK: - instruction: $sgpr1 = COPY $vgpr0
$sgpr1 = COPY $vgpr0
; copy from virtual AGPR to virtual SGPR
- ; CHECK: *** Bad machine code: illegal copy from AGPR to SGPR ***
+ ; CHECK: *** Bad machine code: illegal copy from vector register to SGPR ***
; CHECK: - instruction: %7:sgpr_32 = COPY %4:agpr_32
%7:sgpr_32 = COPY %4:agpr_32
; copy from virtual AGPR to physical SGPR
- ; CHECK: *** Bad machine code: illegal copy from AGPR to SGPR ***
+ ; CHECK: *** Bad machine code: illegal copy from vector register to SGPR ***
; CHECK: - instruction: $sgpr2 = COPY %4:agpr_32
$sgpr2 = COPY %4:agpr_32
; copy from physical AGPR to physical SGPR
- ; CHECK: *** Bad machine code: illegal copy from AGPR to SGPR ***
+ ; CHECK: *** Bad machine code: illegal copy from vector register to SGPR ***
; CHECK: - instruction: $sgpr3 = COPY $agpr0
$sgpr3 = COPY $agpr0
; copy from tuple of physical VGPRs to tuple of physical SGPRs
- ; CHECK: *** Bad machine code: illegal copy from VGPR to SGPR ***
+ ; CHECK: *** Bad machine code: illegal copy from vector register to SGPR ***
; CHECK: - instruction: $sgpr4_sgpr5 = COPY $vgpr0_vgpr1
$sgpr4_sgpr5 = COPY $vgpr0_vgpr1
; copy from tuple of physical AGPRs to tuple of physical SGPRs
- ; CHECK: *** Bad machine code: illegal copy from AGPR to SGPR ***
+ ; CHECK: *** Bad machine code: illegal copy from vector register to SGPR ***
; CHECK: - instruction: $sgpr6_sgpr7 = COPY $agpr0_agpr1
$sgpr6_sgpr7 = COPY $agpr0_agpr1
More information about the llvm-commits
mailing list