summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Bitcode/compatibility.ll4
-rw-r--r--llvm/test/Verifier/scalable-aggregates.ll31
-rw-r--r--llvm/test/Verifier/scalable-global-vars.ll24
3 files changed, 59 insertions, 0 deletions
diff --git a/llvm/test/Bitcode/compatibility.ll b/llvm/test/Bitcode/compatibility.ll
index 6c3a6887346..06b81fa14a8 100644
--- a/llvm/test/Bitcode/compatibility.ll
+++ b/llvm/test/Bitcode/compatibility.ll
@@ -917,6 +917,10 @@ define void @typesystem() {
; CHECK: %t7 = alloca x86_mmx
%t8 = alloca %opaquety*
; CHECK: %t8 = alloca %opaquety*
+ %t9 = alloca <4 x i32>
+ ; CHECK: %t9 = alloca <4 x i32>
+ %t10 = alloca <vscale x 4 x i32>
+ ; CHECK: %t10 = alloca <vscale x 4 x i32>
ret void
}
diff --git a/llvm/test/Verifier/scalable-aggregates.ll b/llvm/test/Verifier/scalable-aggregates.ll
new file mode 100644
index 00000000000..8d7416bea23
--- /dev/null
+++ b/llvm/test/Verifier/scalable-aggregates.ll
@@ -0,0 +1,31 @@
+; RUN: not opt -S -verify < %s 2>&1 | FileCheck %s
+
+;; Arrays and Structs cannot contain scalable vectors, since we don't
+;; know the size at compile time and the container types need to have
+;; a known size.
+
+; CHECK-DAG: Arrays cannot contain scalable vectors
+; CHECK-DAG: [2 x { i32, <vscale x 1 x i32> }]; ModuleID = '<stdin>'
+; CHECK-DAG: Arrays cannot contain scalable vectors
+; CHECK-DAG: [4 x <vscale x 256 x i1>]; ModuleID = '<stdin>'
+; CHECK-DAG: Arrays cannot contain scalable vectors
+; CHECK-DAG: [2 x <vscale x 4 x i32>]; ModuleID = '<stdin>'
+; CHECK-DAG: Structs cannot contain scalable vectors
+; CHECK-DAG: { i64, [4 x <vscale x 256 x i1>] }; ModuleID = '<stdin>'
+; CHECK-DAG: Structs cannot contain scalable vectors
+; CHECK-DAG: { i32, <vscale x 1 x i32> }; ModuleID = '<stdin>'
+; CHECK-DAG: Structs cannot contain scalable vectors
+; CHECK-DAG: { <vscale x 16 x i8>, <vscale x 2 x double> }; ModuleID = '<stdin>'
+; CHECK-DAG: Structs cannot contain scalable vectors
+; CHECK-DAG: %sty = type { i64, <vscale x 32 x i16> }; ModuleID = '<stdin>'
+
+%sty = type { i64, <vscale x 32 x i16> }
+
+define void @scalable_aggregates() {
+ %array = alloca [2 x <vscale x 4 x i32>]
+ %struct = alloca { <vscale x 16 x i8>, <vscale x 2 x double> }
+ %named_struct = alloca %sty
+ %s_in_a = alloca [2 x { i32, <vscale x 1 x i32> } ]
+ %a_in_s = alloca { i64, [4 x <vscale x 256 x i1> ] }
+ ret void
+} \ No newline at end of file
diff --git a/llvm/test/Verifier/scalable-global-vars.ll b/llvm/test/Verifier/scalable-global-vars.ll
new file mode 100644
index 00000000000..e7834be7799
--- /dev/null
+++ b/llvm/test/Verifier/scalable-global-vars.ll
@@ -0,0 +1,24 @@
+; RUN: not opt -S -verify < %s 2>&1 | FileCheck %s
+
+;; Global variables cannot be scalable vectors, since we don't
+;; know the size at compile time.
+
+; CHECK: Globals cannot contain scalable vectors
+; CHECK-NEXT: <vscale x 4 x i32>* @ScalableVecGlobal
+@ScalableVecGlobal = global <vscale x 4 x i32> zeroinitializer
+
+; CHECK: Globals cannot contain scalable vectors
+; CHECK-NEXT: [64 x <vscale x 2 x double>]* @ScalableVecGlobalArray
+@ScalableVecGlobalArray = global [64 x <vscale x 2 x double>] zeroinitializer
+
+; CHECK: Globals cannot contain scalable vectors
+; CHECK-NEXT: { <vscale x 16 x i64>, <vscale x 16 x i1> }* @ScalableVecGlobalStruct
+@ScalableVecGlobalStruct = global { <vscale x 16 x i64>, <vscale x 16 x i1> } zeroinitializer
+
+; CHECK: Globals cannot contain scalable vectors
+; CHECK-NEXT: { [4 x i32], [2 x { <vscale x 4 x i64>, <vscale x 32 x i8> }] }* @ScalableVecMixed
+@ScalableVecMixed = global { [4 x i32], [2 x { <vscale x 4 x i64>, <vscale x 32 x i8> }]} zeroinitializer
+
+;; Global _pointers_ to scalable vectors are fine
+; CHECK-NOT: Globals cannot contain scalable vectors
+@ScalableVecPtr = global <vscale x 8 x i16>* zeroinitializer
OpenPOWER on IntegriCloud