forked from OSchip/llvm-project
GlobalISel: Verify G_MERGE_VALUES operand sizes
llvm-svn: 364822
This commit is contained in:
parent
1023a2eca3
commit
03ca176ab3
|
@ -1176,6 +1176,16 @@ void MachineVerifier::verifyPreISelGenericInstruction(const MachineInstr *MI) {
|
||||||
LLT SrcTy = MRI->getType(MI->getOperand(1).getReg());
|
LLT SrcTy = MRI->getType(MI->getOperand(1).getReg());
|
||||||
if (DstTy.isVector() || SrcTy.isVector())
|
if (DstTy.isVector() || SrcTy.isVector())
|
||||||
report("G_MERGE_VALUES cannot operate on vectors", MI);
|
report("G_MERGE_VALUES cannot operate on vectors", MI);
|
||||||
|
|
||||||
|
const unsigned NumOps = MI->getNumOperands();
|
||||||
|
if (DstTy.getSizeInBits() != SrcTy.getSizeInBits() * (NumOps - 1))
|
||||||
|
report("G_MERGE_VALUES result size is inconsistent", MI);
|
||||||
|
|
||||||
|
for (unsigned I = 2; I != NumOps; ++I) {
|
||||||
|
if (MRI->getType(MI->getOperand(I).getReg()) != SrcTy)
|
||||||
|
report("G_MERGE_VALUES source types do not match", MI);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TargetOpcode::G_UNMERGE_VALUES: {
|
case TargetOpcode::G_UNMERGE_VALUES: {
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
# RUN: not llc -o - -march=arm64 -run-pass=none -verify-machineinstrs %s 2>&1 | FileCheck %s
|
||||||
|
# REQUIRES: aarch64-registered-target
|
||||||
|
---
|
||||||
|
name: g_merge_values
|
||||||
|
tracksRegLiveness: true
|
||||||
|
liveins:
|
||||||
|
body: |
|
||||||
|
bb.0:
|
||||||
|
%0:_(s32) = IMPLICIT_DEF
|
||||||
|
%1:_(s32) = IMPLICIT_DEF
|
||||||
|
%2:_(<2 x s32>) = IMPLICIT_DEF
|
||||||
|
%3:_(<2 x s32>) = IMPLICIT_DEF
|
||||||
|
|
||||||
|
; CHECK: Bad machine code: G_MERGE_VALUES cannot operate on vectors
|
||||||
|
%4:_(<4 x s32>) = G_MERGE_VALUES %2, %3
|
||||||
|
|
||||||
|
; CHECK: Bad machine code: G_MERGE_VALUES result size is inconsistent
|
||||||
|
%5:_(s64) = G_MERGE_VALUES %0
|
||||||
|
|
||||||
|
; CHECK: Bad machine code: G_MERGE_VALUES result size is inconsistent
|
||||||
|
%6:_(s64) = G_MERGE_VALUES %0, %1, %1
|
||||||
|
|
||||||
|
%7:_(s16) = IMPLICIT_DEF
|
||||||
|
|
||||||
|
; CHECK: Bad machine code: G_MERGE_VALUES source types do not match
|
||||||
|
%8:_(s64) = G_MERGE_VALUES %0, %7
|
||||||
|
|
||||||
|
...
|
Loading…
Reference in New Issue