Skip to content

Commit 4670f0d

Browse files
authored
MachineVerifier: Print name of failing subregister index (#129491)
I'm not sure of a good example to test the "does not fully support" case.
1 parent 12b38c3 commit 4670f0d

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

llvm/lib/CodeGen/MachineVerifier.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2749,13 +2749,15 @@ MachineVerifier::visitMachineOperand(const MachineOperand *MO, unsigned MONum) {
27492749
if (!SRC) {
27502750
report("Invalid subregister index for virtual register", MO, MONum);
27512751
OS << "Register class " << TRI->getRegClassName(RC)
2752-
<< " does not support subreg index " << SubIdx << '\n';
2752+
<< " does not support subreg index "
2753+
<< TRI->getSubRegIndexName(SubIdx) << '\n';
27532754
return;
27542755
}
27552756
if (RC != SRC) {
27562757
report("Invalid register class for subregister index", MO, MONum);
27572758
OS << "Register class " << TRI->getRegClassName(RC)
2758-
<< " does not fully support subreg index " << SubIdx << '\n';
2759+
<< " does not fully support subreg index "
2760+
<< TRI->getSubRegIndexName(SubIdx) << '\n';
27592761
return;
27602762
}
27612763
}

llvm/test/MachineVerifier/AMDGPU/unsupported-subreg-index-aligned-vgpr-check.mir

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ body: |
1919
; CHECK-NEXT: - basic block: %bb.0
2020
; 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)
2121
; CHECK-NEXT: - operand 1: %1.sub16_sub17_sub18_sub19:vreg_512_align2
22-
; CHECK-NEXT: Register class VReg_512_Align2 does not support subreg index 166
22+
; CHECK-NEXT: Register class VReg_512_Align2 does not support subreg index sub16_sub17_sub18_sub19
2323
2424
; CHECK: *** Bad machine code: Subtarget requires even aligned vector registers ***
2525
; CHECK-NEXT: - function: uses_invalid_subregister_for_regclass
@@ -33,7 +33,7 @@ body: |
3333
; CHECK-NEXT: - basic block: %bb.0
3434
; 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)
3535
; CHECK-NEXT: - operand 1: %2.sub16_sub17_sub18_sub19:vreg_512
36-
; CHECK-NEXT: Register class VReg_512 does not support subreg index 166
36+
; CHECK-NEXT: Register class VReg_512 does not support subreg index sub16_sub17_sub18_sub19
3737
S_NOP 0, implicit-def %2:vreg_512
3838
GLOBAL_STORE_DWORDX4_SADDR %0, %2.sub16_sub17_sub18_sub19, undef $sgpr8_sgpr9, 80, 0, implicit $exec :: (store (s128), addrspace 1)
3939
S_ENDPGM 0

0 commit comments

Comments
 (0)