mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 12:12:47 +01:00
[MachineVerifier] Make INSERT_SUBREG diagnostic respect operand 2 subregs
This came out of post-commit review: https://reviews.llvm.org/D105953#inline-1012919 Thanks uabelho!
This commit is contained in:
parent
2b759c7f74
commit
48d5dbf972
@ -1783,8 +1783,11 @@ void MachineVerifier::visitMachineInstrBefore(const MachineInstr *MI) {
|
|||||||
// TODO: verify we have properly encoded deopt arguments
|
// TODO: verify we have properly encoded deopt arguments
|
||||||
} break;
|
} break;
|
||||||
case TargetOpcode::INSERT_SUBREG: {
|
case TargetOpcode::INSERT_SUBREG: {
|
||||||
unsigned InsertedSize =
|
unsigned InsertedSize;
|
||||||
TRI->getRegSizeInBits(MI->getOperand(2).getReg(), *MRI);
|
if (unsigned SubIdx = MI->getOperand(2).getSubReg())
|
||||||
|
InsertedSize = TRI->getSubRegIdxSize(SubIdx);
|
||||||
|
else
|
||||||
|
InsertedSize = TRI->getRegSizeInBits(MI->getOperand(2).getReg(), *MRI);
|
||||||
unsigned SubRegSize = TRI->getSubRegIdxSize(MI->getOperand(3).getImm());
|
unsigned SubRegSize = TRI->getSubRegIdxSize(MI->getOperand(3).getImm());
|
||||||
if (SubRegSize < InsertedSize) {
|
if (SubRegSize < InsertedSize) {
|
||||||
report("INSERT_SUBREG expected inserted value to have equal or lesser "
|
report("INSERT_SUBREG expected inserted value to have equal or lesser "
|
||||||
|
@ -10,7 +10,7 @@ tracksRegLiveness: true
|
|||||||
liveins:
|
liveins:
|
||||||
body: |
|
body: |
|
||||||
bb.0:
|
bb.0:
|
||||||
liveins: $s0, $h1
|
liveins: $s0, $h1, $q2
|
||||||
|
|
||||||
%0:fpr32 = COPY $s0
|
%0:fpr32 = COPY $s0
|
||||||
|
|
||||||
@ -28,4 +28,9 @@ body: |
|
|||||||
%7:fpr128 = IMPLICIT_DEF
|
%7:fpr128 = IMPLICIT_DEF
|
||||||
%8:fpr128 = INSERT_SUBREG %7:fpr128, %0:fpr32, %subreg.ssub
|
%8:fpr128 = INSERT_SUBREG %7:fpr128, %0:fpr32, %subreg.ssub
|
||||||
|
|
||||||
|
; CHECK-NOT: *** Bad machine code:
|
||||||
|
%9:fpr128 = COPY $q2
|
||||||
|
%10:fpr128 = IMPLICIT_DEF
|
||||||
|
%11:fpr128 = INSERT_SUBREG %10:fpr128, %9.ssub, %subreg.ssub
|
||||||
|
|
||||||
...
|
...
|
||||||
|
Loading…
Reference in New Issue
Block a user