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