Skip to content

Commit d0eadbf

Browse files
committed
MachineVerifier: Print name of failing subregister index
I'm not sure of a good example to test the "does not fully support" case.
1 parent cb7030d commit d0eadbf

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
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
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# RUN: not --crash llc -mtriple=amdgcn -mcpu=gfx900 -run-pass=none -o /dev/null %s 2>&1 | FileCheck %s
2+
3+
---
4+
name: unsupported_subreg_index
5+
body: |
6+
bb.0:
7+
liveins: $vgpr0_vgpr1, $sgpr0_sgpr1, $agpr0_agpr1_agpr2_agpr3
8+
9+
; CHECK: *** Bad machine code: Invalid subregister index for virtual register ***
10+
undef %0.sub3:vreg_96 = COPY $vgpr0
11+
12+
; CHECK: *** Bad machine code: Invalid subregister index for virtual register ***
13+
$vgpr0 = COPY %0.sub3
14+
15+
...

0 commit comments

Comments
 (0)