Skip to content

Commit 2f246e2

Browse files
fixup! limit g_splat_vector to scalable types
1 parent 9008a03 commit 2f246e2

File tree

2 files changed

+13
-19
lines changed

2 files changed

+13
-19
lines changed

llvm/lib/CodeGen/MachineVerifier.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1645,8 +1645,8 @@ void MachineVerifier::verifyPreISelGenericInstruction(const MachineInstr *MI) {
16451645
LLT DstTy = MRI->getType(MI->getOperand(0).getReg());
16461646
LLT SrcTy = MRI->getType(MI->getOperand(1).getReg());
16471647

1648-
if (!DstTy.isVector())
1649-
report("Destination type must be a vector", MI);
1648+
if (!DstTy.isScalableVector())
1649+
report("Destination type must be a scalable vector", MI);
16501650

16511651
if (!SrcTy.isScalar())
16521652
report("Source type must be a scalar", MI);

llvm/test/MachineVerifier/test_g_splat_vector.mir

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,22 @@ tracksRegLiveness: true
66
liveins:
77
body: |
88
bb.0:
9-
%0:_(<2 x s32>) = G_IMPLICIT_DEF
10-
%1:_(s32) = G_CONSTANT i32 0
11-
%2:_(s32) = G_CONSTANT i32 1
12-
%3:_(<2 x s32>) = G_BUILD_VECTOR %1, %2
9+
%0:_(s32) = G_CONSTANT i32 0
10+
%1:_(<2 x s32>) = G_IMPLICIT_DEF
11+
%2:_(<vscale x 2 x s32>) = G_IMPLICIT_DEF
1312
14-
; CHECK: Destination type must be a vector
15-
%4:_(s32) = G_SPLAT_VECTOR %1
13+
; CHECK: Destination type must be a scalable vector
14+
%3:_(s32) = G_SPLAT_VECTOR %0
1615
17-
; CHECK: Source type must be a scalar
18-
%5:_(<2 x s32>) = G_SPLAT_VECTOR %3
19-
20-
; CHECK: Element type of the destination must be the same type as the source type
21-
%6:_(<2 x s64>) = G_SPLAT_VECTOR %5
16+
; CHECK: Destination type must be a scalable vector
17+
%4:_(<2 x s32>) = G_SPLAT_VECTOR %0
2218
23-
%7:_(<vscale x 2 x s32>) = G_IMPLICIT_DEF
24-
25-
; CHECK: Destination type must be a vector
26-
%8:_(s32) = G_SPLAT_VECTOR %7
19+
; CHECK: Source type must be a scalar
20+
%5:_(<vscale x 2 x s32>) = G_SPLAT_VECTOR %1
2721
2822
; CHECK: Source type must be a scalar
29-
%9:_(<vscale x 2 x s32>) = G_SPLAT_VECTOR %7
23+
%6:_(<vscale x 2 x s32>) = G_SPLAT_VECTOR %2
3024
3125
; CHECK: Element type of the destination must be the same type as the source type
32-
%10:_(<vscale x 2 x s64>) = G_SPLAT_VECTOR %7
26+
%7:_(<vscale x 2 x s64>) = G_SPLAT_VECTOR %0
3327
...

0 commit comments

Comments
 (0)