-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
AMDGPU: Fix verifier assert with out of bounds subregister indexes (#…
…119799) The manual check for aligned VGPR classes would assert if a virtual register used an index not supported by the register class.
Showing
2 changed files
with
47 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
llvm/test/MachineVerifier/AMDGPU/unsupported-subreg-index-aligned-vgpr-check.mir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# RUN: not --crash llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx942 -run-pass=none -filetype=null %s 2>&1 | FileCheck %s | ||
|
||
# sub16_sub17_sub18_sub19 is outside the bounds of a 512-bit | ||
# register. Make sure the verification doesn't assert. This was only | ||
# broken for targets that require even aligned VGPRs due to the manual | ||
# alignment check. | ||
|
||
--- | ||
name: uses_invalid_subregister_for_regclass | ||
tracksRegLiveness: true | ||
body: | | ||
bb.0: | ||
%0:vgpr_32 = V_MOV_B32_e32 0, implicit $exec | ||
S_NOP 0, implicit-def %1:vreg_512_align2 | ||
; CHECK: *** Bad machine code: Invalid subregister index for virtual register *** | ||
; CHECK-NEXT: - function: uses_invalid_subregister_for_regclass | ||
; CHECK-NEXT: - basic block: %bb.0 | ||
; CHECK-NEXT: - instruction: GLOBAL_STORE_DWORDX4_SADDR %0:vgpr_32, %1.sub16_sub17_sub18_sub19:vreg_512_align2, undef $sgpr8_sgpr9, 80, 0, implicit $exec :: (store (s128), addrspace 1) | ||
; CHECK-NEXT: - operand 1: %1.sub16_sub17_sub18_sub19:vreg_512_align2 | ||
; CHECK-NEXT: Register class VReg_512_Align2 does not support subreg index 166 | ||
; CHECK: *** Bad machine code: Subtarget requires even aligned vector registers *** | ||
; CHECK-NEXT: - function: uses_invalid_subregister_for_regclass | ||
; CHECK-NEXT: - basic block: %bb.0 | ||
; CHECK-NEXT: - instruction: GLOBAL_STORE_DWORDX4_SADDR %0:vgpr_32, %2.sub16_sub17_sub18_sub19:vreg_512, undef $sgpr8_sgpr9, 80, 0, implicit $exec :: (store (s128), addrspace 1) | ||
GLOBAL_STORE_DWORDX4_SADDR %0, %1.sub16_sub17_sub18_sub19, undef $sgpr8_sgpr9, 80, 0, implicit $exec :: (store (s128), addrspace 1) | ||
; Test with unaligned class | ||
; CHECK: *** Bad machine code: Invalid subregister index for virtual register *** | ||
; CHECK-NEXT: - function: uses_invalid_subregister_for_regclass | ||
; CHECK-NEXT: - basic block: %bb.0 | ||
; CHECK-NEXT: - instruction: GLOBAL_STORE_DWORDX4_SADDR %0:vgpr_32, %2.sub16_sub17_sub18_sub19:vreg_512, undef $sgpr8_sgpr9, 80, 0, implicit $exec :: (store (s128), addrspace 1) | ||
; CHECK-NEXT: - operand 1: %2.sub16_sub17_sub18_sub19:vreg_512 | ||
; CHECK-NEXT: Register class VReg_512 does not support subreg index 166 | ||
S_NOP 0, implicit-def %2:vreg_512 | ||
GLOBAL_STORE_DWORDX4_SADDR %0, %2.sub16_sub17_sub18_sub19, undef $sgpr8_sgpr9, 80, 0, implicit $exec :: (store (s128), addrspace 1) | ||
S_ENDPGM 0 | ||
... |