1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 18:42:46 +02:00

GlobalISel: Verify G_MERGE_VALUES operand sizes

llvm-svn: 364822
This commit is contained in:
Matt Arsenault 2019-07-01 18:01:35 +00:00
parent 116f5ddbbe
commit f7e237142b
2 changed files with 38 additions and 0 deletions

View File

@ -1176,6 +1176,16 @@ void MachineVerifier::verifyPreISelGenericInstruction(const MachineInstr *MI) {
LLT SrcTy = MRI->getType(MI->getOperand(1).getReg());
if (DstTy.isVector() || SrcTy.isVector())
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;
}
case TargetOpcode::G_UNMERGE_VALUES: {

View File

@ -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
...