xref: /llvm-project/llvm/test/Verifier/elementtype.ll (revision b05c71814c3b9f91a2e00af891d67a83790a109c)
1; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s
2
3declare void @some_function(ptr)
4
5; CHECK: Attribute 'elementtype(i32)' applied to incompatible type!
6define void @type_mismatch1() {
7  call ptr @llvm.preserve.array.access.index.p0.p0(ptr null, i32 elementtype(i32) 0, i32 0)
8  ret void
9}
10
11; CHECK: Attribute 'elementtype' can only be applied to intrinsics and inline asm.
12define void @not_intrinsic() {
13  call void @some_function(ptr elementtype(i32) null)
14  ret void
15}
16
17; CHECK: Attribute 'elementtype' can only be applied to a callsite.
18define void @llvm.not_call(ptr elementtype(i32)) {
19  ret void
20}
21
22define void @elementtype_required() {
23; CHECK: Intrinsic requires elementtype attribute on first argument.
24  call ptr @llvm.preserve.array.access.index.p0.p0(ptr null, i32 0, i32 0)
25; CHECK: Intrinsic requires elementtype attribute on first argument.
26  call ptr @llvm.preserve.struct.access.index.p0.p0(ptr null, i32 0, i32 0)
27  ret void
28}
29
30declare ptr @llvm.preserve.array.access.index.p0.p0(ptr, i32, i32)
31declare ptr @llvm.preserve.struct.access.index.p0.p0(ptr, i32, i32)
32