diff options
Diffstat (limited to 'test/Verifier')
19 files changed, 153 insertions, 16 deletions
diff --git a/test/Verifier/2010-08-07-PointerIntrinsic.ll b/test/Verifier/2010-08-07-PointerIntrinsic.ll index a668d04..427eb66 100644 --- a/test/Verifier/2010-08-07-PointerIntrinsic.ll +++ b/test/Verifier/2010-08-07-PointerIntrinsic.ll @@ -1,6 +1,5 @@ -; RUN: not llvm-as < %s 2> %t -; RUN: FileCheck %s --input-file=%t -; CHECK: Broken module +; RUN: not llvm-as < %s 2>&1 | FileCheck %s +; CHECK: assembly parsed, but does not verify as correct ; PR7316 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:32" diff --git a/test/Verifier/alias.ll b/test/Verifier/alias.ll new file mode 100644 index 0000000..e3636bc --- /dev/null +++ b/test/Verifier/alias.ll @@ -0,0 +1,12 @@ +; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s + + +declare void @f() +@fa = alias void ()* @f +; CHECK: Alias must point to a definition +; CHECK-NEXT: @fa + +@g = external global i32 +@ga = alias i32* @g +; CHECK: Alias must point to a definition +; CHECK-NEXT: @ga diff --git a/test/Verifier/bitcast-address-space-nested-global-cycle.ll b/test/Verifier/bitcast-address-space-nested-global-cycle.ll index 0cee726..3c67aa9e 100644 --- a/test/Verifier/bitcast-address-space-nested-global-cycle.ll +++ b/test/Verifier/bitcast-address-space-nested-global-cycle.ll @@ -1,4 +1,6 @@ -; RUN: not llvm-as -verify -disable-output %s +; RUN: not llvm-as -disable-output %s 2>&1 | FileCheck %s + +; CHECK: error: invalid cast opcode for cast from '%struct.Self1*' to '%struct.Self1 addrspace(1)*' target datalayout = "e-p:32:32:32-p1:16:16:16-p2:8:8:8-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n8:16:32" diff --git a/test/Verifier/bitcast-address-space-nested-global.ll b/test/Verifier/bitcast-address-space-nested-global.ll index abe9d94..a796690 100644 --- a/test/Verifier/bitcast-address-space-nested-global.ll +++ b/test/Verifier/bitcast-address-space-nested-global.ll @@ -1,4 +1,6 @@ -; RUN: not llvm-as -verify -disable-output %s +; RUN: not llvm-as -disable-output %s 2>&1 | FileCheck %s + +; CHECK: error: invalid cast opcode for cast from '%struct.Self1*' to '%struct.Self1 addrspace(1)*' target datalayout = "e-p:32:32:32-p1:16:16:16-p2:8:8:8-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n8:16:32" diff --git a/test/Verifier/bitcast-address-space-through-constant-inttoptr-inside-gep-instruction.ll b/test/Verifier/bitcast-address-space-through-constant-inttoptr-inside-gep-instruction.ll index ed71afa..ef38d37 100644 --- a/test/Verifier/bitcast-address-space-through-constant-inttoptr-inside-gep-instruction.ll +++ b/test/Verifier/bitcast-address-space-through-constant-inttoptr-inside-gep-instruction.ll @@ -1,6 +1,9 @@ -; RUN: not llvm-as -verify -disable-output < %s +; RUN: not llvm-as -disable-output %s 2>&1 | FileCheck %s + target datalayout = "e-p:32:32:32-p1:16:16:16-p2:8:8:8-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n8:16:32" +; CHECK: error: invalid cast opcode for cast from 'i32 addrspace(1)*' to 'i32 addrspace(2)*' + ; Check that we can find inttoptr -> illegal bitcasts when hidden ; inside constantexpr pointer operands define i32 addrspace(2)* @illegal_bitcast_inttoptr_as_1_to_2_inside_gep() { diff --git a/test/Verifier/bitcast-address-space-through-constant-inttoptr.ll b/test/Verifier/bitcast-address-space-through-constant-inttoptr.ll index e65c71e..1affda4 100644 --- a/test/Verifier/bitcast-address-space-through-constant-inttoptr.ll +++ b/test/Verifier/bitcast-address-space-through-constant-inttoptr.ll @@ -1,10 +1,12 @@ -; RUN: not llvm-as -verify -disable-output %s +; RUN: not llvm-as -disable-output %s 2>&1 | FileCheck %s target datalayout = "e-p:32:32:32-p1:16:16:16-p2:8:8:8-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n8:16:32" %struct.Foo = type { i32 addrspace(1)* } +; CHECK: error: invalid cast opcode for cast from 'i32 addrspace(2)*' to 'i32 addrspace(1)*' + ; Make sure we still reject the bitcast when the source is a inttoptr (constant int) in a global initializer @bitcast_after_constant_inttoptr_initializer = global %struct.Foo { i32 addrspace(1)* bitcast (i32 addrspace(2)* inttoptr (i8 7 to i32 addrspace(2)*) to i32 addrspace(1)*) } diff --git a/test/Verifier/bitcast-address-space-through-gep-2.ll b/test/Verifier/bitcast-address-space-through-gep-2.ll index 3b77d9a..2ee3942 100644 --- a/test/Verifier/bitcast-address-space-through-gep-2.ll +++ b/test/Verifier/bitcast-address-space-through-gep-2.ll @@ -1,4 +1,6 @@ -; RUN: not llvm-as -verify -disable-output %s +; RUN: not llvm-as -disable-output %s 2>&1 | FileCheck %s + +; CHECK: error: invalid cast opcode for cast from 'i32 addrspace(2)*' to 'i32 addrspace(3)*' target datalayout = "e-p:32:32:32-p1:16:16:16-p2:8:8:8-p3:8:8:8-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n8:16:32" diff --git a/test/Verifier/bitcast-address-space-through-gep.ll b/test/Verifier/bitcast-address-space-through-gep.ll index 8e950dc..9494420 100644 --- a/test/Verifier/bitcast-address-space-through-gep.ll +++ b/test/Verifier/bitcast-address-space-through-gep.ll @@ -1,4 +1,4 @@ -; RUN: not llvm-as -verify -disable-output %s +; RUN: not llvm-as -disable-output %s 2>&1 | FileCheck %s target datalayout = "e-p:32:32:32-p1:16:16:16-p2:8:8:8-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n8:16:32" @@ -7,6 +7,8 @@ target datalayout = "e-p:32:32:32-p1:16:16:16-p2:8:8:8-i1:8:32-i8:8:32-i16:16:32 @as2_array = addrspace(2) global [32 x i32] zeroinitializer +; CHECK: error: invalid cast opcode for cast from 'i32 addrspace(2)*' to 'i32 addrspace(1)*' + ; Make sure we still reject the bitcast after the value is accessed through a GEP @bitcast_after_gep = global %struct.Foo { i32 addrspace(1)* bitcast (i32 addrspace(2)* getelementptr ([32 x i32] addrspace(2)* @as2_array, i32 0, i32 8) to i32 addrspace(1)*) } diff --git a/test/Verifier/bitcast-address-space-through-inttoptr.ll b/test/Verifier/bitcast-address-space-through-inttoptr.ll index bec4048..5e7b66f 100644 --- a/test/Verifier/bitcast-address-space-through-inttoptr.ll +++ b/test/Verifier/bitcast-address-space-through-inttoptr.ll @@ -1,7 +1,8 @@ -; RUN: not llvm-as -verify -disable-output %s +; RUN: not llvm-as -disable-output %s 2>&1 | FileCheck %s target datalayout = "e-p:32:32:32-p1:16:16:16-p2:8:8:8-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n8:16:32" +; CHECK: error: invalid cast opcode for cast from 'i32 addrspace(1)*' to 'i32 addrspace(2)*' define i32 addrspace(2)* @illegal_bitcast_as_1_to_2_inttoptr() { %cast = bitcast i32 addrspace(1)* inttoptr (i32 5 to i32 addrspace(1)*) to i32 addrspace(2)* ret i32 addrspace(2)* %cast diff --git a/test/Verifier/bitcast-address-spaces.ll b/test/Verifier/bitcast-address-spaces.ll index 4508417..7f37df6 100644 --- a/test/Verifier/bitcast-address-spaces.ll +++ b/test/Verifier/bitcast-address-spaces.ll @@ -1,7 +1,8 @@ -; RUN: not llvm-as -verify -disable-output %s +; RUN: not llvm-as -disable-output %s 2>&1 | FileCheck %s target datalayout = "e-p:32:32:32-p1:16:16:16-p2:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n8:16:32" +; CHECK: error: invalid cast opcode for cast from 'i32*' to 'i32 addrspace(1)*' define i32 addrspace(1)* @illegal_bitcast_as_0_to_1(i32 addrspace(0) *%p) { %cast = bitcast i32 addrspace(0)* %p to i32 addrspace(1)* ret i32 addrspace(1)* %cast diff --git a/test/Verifier/bitcast-alias-address-space.ll b/test/Verifier/bitcast-alias-address-space.ll index 9cad8ab..d9794d9 100644 --- a/test/Verifier/bitcast-alias-address-space.ll +++ b/test/Verifier/bitcast-alias-address-space.ll @@ -1,4 +1,6 @@ -; RUN: not llvm-as -verify -disable-output %s +; RUN: not llvm-as -disable-output %s 2>&1 | FileCheck %s + +; CHECK: error: invalid cast opcode for cast from 'i32 addrspace(2)*' to 'i32 addrspace(1)*' target datalayout = "e-p:32:32:32-p1:16:16:16-p2:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n8:16:32" diff --git a/test/Verifier/bitcast-vector-pointer-as.ll b/test/Verifier/bitcast-vector-pointer-as.ll index 89070e5..bbf6ace 100644 --- a/test/Verifier/bitcast-vector-pointer-as.ll +++ b/test/Verifier/bitcast-vector-pointer-as.ll @@ -1,7 +1,9 @@ -; RUN: not llvm-as -verify -disable-output %s +; RUN: not llvm-as -disable-output %s 2>&1 | FileCheck %s target datalayout = "e-p:32:32:32-p1:16:16:16-p2:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n8:16:32" +; CHECK: error: invalid cast opcode for cast from '<4 x i32*>' to '<4 x i32 addrspace(1)*>' + define <4 x i32 addrspace(1)*> @vector_illegal_bitcast_as_0_to_1(<4 x i32 addrspace(0)*> %p) { %cast = bitcast <4 x i32 addrspace(0)*> %p to <4 x i32 addrspace(1)*> ret <4 x i32 addrspace(1)*> %cast diff --git a/test/Verifier/inalloca-vararg.ll b/test/Verifier/inalloca-vararg.ll new file mode 100755 index 0000000..5099fd1 --- /dev/null +++ b/test/Verifier/inalloca-vararg.ll @@ -0,0 +1,9 @@ +; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s + +declare void @h(i32, ...) +define void @i() { + %args = alloca inalloca i32 + call void (i32, ...)* @h(i32 1, i32* inalloca %args, i32 3) +; CHECK: inalloca isn't on the last argument! + ret void +} diff --git a/test/Verifier/inalloca1.ll b/test/Verifier/inalloca1.ll new file mode 100644 index 0000000..38b5507 --- /dev/null +++ b/test/Verifier/inalloca1.ll @@ -0,0 +1,22 @@ +; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s + +declare void @a(i64* byval inalloca %p) +; CHECK: Attributes {{.*}} are incompatible + +declare void @b(i64* inreg inalloca %p) +; CHECK: Attributes {{.*}} are incompatible + +declare void @c(i64* sret inalloca %p) +; CHECK: Attributes {{.*}} are incompatible + +declare void @d(i64* nest inalloca %p) +; CHECK: Attributes {{.*}} are incompatible + +declare void @e(i64* readonly inalloca %p) +; CHECK: Attributes {{.*}} are incompatible + +declare void @f(void ()* inalloca %p) +; CHECK: do not support unsized types + +declare void @g(i32* inalloca %p, i32 %p2) +; CHECK: inalloca isn't on the last parameter! diff --git a/test/Verifier/inalloca2.ll b/test/Verifier/inalloca2.ll new file mode 100644 index 0000000..12a4549 --- /dev/null +++ b/test/Verifier/inalloca2.ll @@ -0,0 +1,39 @@ +; This used to be invalid, but now it's valid. Ensure the verifier +; doesn't reject it. +; RUN: llvm-as %s -o /dev/null + +declare void @doit(i64* inalloca %a) + +define void @a() { +entry: + %a = alloca inalloca [2 x i32] + %b = bitcast [2 x i32]* %a to i64* + call void @doit(i64* inalloca %b) + ret void +} + +define void @b() { +entry: + %a = alloca inalloca i64 + call void @doit(i64* inalloca %a) + call void @doit(i64* inalloca %a) + ret void +} + +define void @c(i1 %cond) { +entry: + br i1 %cond, label %if, label %else + +if: + %a = alloca inalloca i64 + br label %call + +else: + %b = alloca inalloca i64 + br label %call + +call: + %args = phi i64* [ %a, %if ], [ %b, %else ] + call void @doit(i64* inalloca %args) + ret void +} diff --git a/test/Verifier/recursive-type-1.ll b/test/Verifier/recursive-type-1.ll new file mode 100644 index 0000000..4a39957 --- /dev/null +++ b/test/Verifier/recursive-type-1.ll @@ -0,0 +1,12 @@ +; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s + +%rt2 = type { i32, { i8, %rt2, i8 }, i32 } + +define i32 @main() nounwind { +entry: + ; Check that recursive types trigger an error instead of segfaulting, when + ; the recursion isn't through a pointer to the type. + ; CHECK: Cannot allocate unsized type + %0 = alloca %rt2 + ret i32 0 +} diff --git a/test/Verifier/recursive-type-2.ll b/test/Verifier/recursive-type-2.ll new file mode 100644 index 0000000..5f2f66f --- /dev/null +++ b/test/Verifier/recursive-type-2.ll @@ -0,0 +1,14 @@ +; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s + +%rt1 = type { i32, { i8, %rt2, i8 }, i32 } +%rt2 = type { i64, { i6, %rt3 } } +%rt3 = type { %rt1 } + +define i32 @main() nounwind { +entry: + ; Check that mutually recursive types trigger an error instead of segfaulting, + ; when the recursion isn't through a pointer to the type. + ; CHECK: Cannot allocate unsized type + %0 = alloca %rt2 + ret i32 0 +} diff --git a/test/Verifier/recursive-type-3.ll b/test/Verifier/recursive-type-3.ll new file mode 100644 index 0000000..8968fb5 --- /dev/null +++ b/test/Verifier/recursive-type-3.ll @@ -0,0 +1,11 @@ +; RUN: llvm-as %s -o /dev/null 2>&1 + +%rt2 = type { i32, { i8, %rt2*, i8 }, i32 } + +define i32 @main() nounwind { +entry: + ; Check that linked-list-style recursive types where the recursion is through + ; a pointer of the type is valid for an alloca. + %0 = alloca %rt2 + ret i32 0 +} diff --git a/test/Verifier/varargs-intrinsic.ll b/test/Verifier/varargs-intrinsic.ll index f6d0a70..2fff1db 100644 --- a/test/Verifier/varargs-intrinsic.ll +++ b/test/Verifier/varargs-intrinsic.ll @@ -1,16 +1,16 @@ ; RUN: not llvm-as < %s -o /dev/null 2>&1 | FileCheck %s -declare void @llvm.experimental.stackmap(i32, i32) +declare void @llvm.experimental.stackmap(i64, i32) declare void @llvm.donothing(...) define void @foo1() { - call void @llvm.experimental.stackmap(i32 0, i32 12) + call void @llvm.experimental.stackmap(i64 0, i32 12) ; CHECK: Callsite was not defined with variable arguments! ret void } define void @foo2() { - call void (...)* @llvm.donothing(i32 0, i64 1) + call void (...)* @llvm.donothing(i64 0, i64 1) ; CHECK: Intrinsic was not defined with variable arguments! ret void } |