Files
clang-p2996/llvm/test/MachineVerifier/AMDGPU/fix-illegal-vector-copies.mir
Aditi Medhane 60a8b2b1d0 [AMDGPU] Add MachineVerifier check to detect illegal copies from vector register to SGPR (#105494)
Addition of a check in the MachineVerifier to detect and report illegal
vector registers to SGPR copies in the AMDGPU backend, ensuring correct
code generation.
We can enforce this check only after SIFixSGPRCopies pass.
This is half-fix in the pipeline with the help of isSSA MachineFuction
property, the check is happening for passes after phi-node-elimination.
2024-09-19 13:57:44 +05:30

60 lines
2.3 KiB
YAML

# RUN: not --crash llc -march=amdgcn -mcpu=gfx1200 -run-pass=none -o /dev/null %s 2>&1 | FileCheck %s
---
name: fix-illegal-vector-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 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 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 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 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 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 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 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 vector register to SGPR ***
; CHECK: - instruction: $sgpr6_sgpr7 = COPY $agpr0_agpr1
$sgpr6_sgpr7 = COPY $agpr0_agpr1
S_ENDPGM 0
...