[opaque pointer type] Add textual IR support for explicit type parameter to the call...
[oota-llvm.git] / test / Verifier / frameescape.ll
1 ; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s
2
3 declare void @llvm.frameescape(...)
4 declare i8* @llvm.framerecover(i8*, i8*, i32)
5
6 define internal void @f() {
7   %a = alloca i8
8   call void (...) @llvm.frameescape(i8* %a)
9   call void (...) @llvm.frameescape(i8* %a)
10   ret void
11 }
12 ; CHECK: multiple calls to llvm.frameescape in one function
13
14 define internal void @g() {
15 entry:
16   %a = alloca i8
17   br label %not_entry
18 not_entry:
19   call void (...) @llvm.frameescape(i8* %a)
20   ret void
21 }
22 ; CHECK: llvm.frameescape used outside of entry block
23
24 define internal void @h() {
25   call i8* @llvm.framerecover(i8* null, i8* null, i32 0)
26   ret void
27 }
28 ; CHECK: llvm.framerecover first argument must be function defined in this module
29
30 @global = constant i8 0
31
32 declare void @declaration()
33
34 define internal void @i() {
35   call i8* @llvm.framerecover(i8* @global, i8* null, i32 0)
36   ret void
37 }
38 ; CHECK: llvm.framerecover first argument must be function defined in this module
39
40 define internal void @j() {
41   call i8* @llvm.framerecover(i8* bitcast(void()* @declaration to i8*), i8* null, i32 0)
42   ret void
43 }
44 ; CHECK: llvm.framerecover first argument must be function defined in this module
45
46 define internal void @k(i32 %n) {
47   call i8* @llvm.framerecover(i8* bitcast(void()* @f to i8*), i8* null, i32 %n)
48   ret void
49 }
50 ; CHECK: idx argument of llvm.framerecover must be a constant int
51
52 define internal void @l(i8* %b) {
53   %a = alloca i8
54   call void (...) @llvm.frameescape(i8* %a, i8* %b)
55   ret void
56 }
57 ; CHECK: llvm.frameescape only accepts static allocas
58
59 define internal void @m() {
60   %a = alloca i8
61   call void (...) @llvm.frameescape(i8* %a)
62   ret void
63 }
64
65 define internal void @n(i8* %fp) {
66   call i8* @llvm.framerecover(i8* bitcast(void ()* @m to i8*), i8* %fp, i32 1)
67   ret void
68 }
69 ; CHECK: all indices passed to llvm.framerecover must be less than the number of arguments passed ot llvm.frameescape in the parent function