150
|
1 ; RUN: opt < %s -globalopt -S | FileCheck %s
|
|
2
|
173
|
3 declare token @llvm.call.preallocated.setup(i32)
|
|
4 declare i8* @llvm.call.preallocated.arg(token, i32)
|
|
5
|
150
|
6 define internal i32 @f(i32* %m) {
|
|
7 ; CHECK-LABEL: define internal fastcc i32 @f
|
|
8 %v = load i32, i32* %m
|
|
9 ret i32 %v
|
|
10 }
|
|
11
|
|
12 define internal x86_thiscallcc i32 @g(i32* %m) {
|
|
13 ; CHECK-LABEL: define internal fastcc i32 @g
|
|
14 %v = load i32, i32* %m
|
|
15 ret i32 %v
|
|
16 }
|
|
17
|
|
18 ; Leave this one alone, because the user went out of their way to request this
|
|
19 ; convention.
|
|
20 define internal coldcc i32 @h(i32* %m) {
|
|
21 ; CHECK-LABEL: define internal coldcc i32 @h
|
|
22 %v = load i32, i32* %m
|
|
23 ret i32 %v
|
|
24 }
|
|
25
|
|
26 define internal i32 @j(i32* %m) {
|
|
27 ; CHECK-LABEL: define internal i32 @j
|
|
28 %v = load i32, i32* %m
|
|
29 ret i32 %v
|
|
30 }
|
|
31
|
|
32 define internal i32 @inalloca(i32* inalloca %p) {
|
|
33 ; CHECK-LABEL: define internal fastcc i32 @inalloca(i32* %p)
|
|
34 %rv = load i32, i32* %p
|
|
35 ret i32 %rv
|
|
36 }
|
|
37
|
173
|
38 define internal i32 @preallocated(i32* preallocated(i32) %p) {
|
|
39 ; TODO: handle preallocated:
|
|
40 ; CHECK-NOT-LABEL: define internal fastcc i32 @preallocated(i32* %p)
|
|
41 %rv = load i32, i32* %p
|
|
42 ret i32 %rv
|
|
43 }
|
|
44
|
150
|
45 define void @call_things() {
|
|
46 %m = alloca i32
|
|
47 call i32 @f(i32* %m)
|
|
48 call x86_thiscallcc i32 @g(i32* %m)
|
|
49 call coldcc i32 @h(i32* %m)
|
|
50 call i32 @j(i32* %m)
|
|
51 %args = alloca inalloca i32
|
|
52 call i32 @inalloca(i32* inalloca %args)
|
173
|
53 ; TODO: handle preallocated
|
|
54 ;%c = call token @llvm.call.preallocated.setup(i32 1)
|
|
55 ;%N = call i8* @llvm.call.preallocated.arg(token %c, i32 0) preallocated(i32)
|
|
56 ;%n = bitcast i8* %N to i32*
|
|
57 ;call i32 @preallocated(i32* preallocated(i32) %n) ["preallocated"(token %c)]
|
150
|
58 ret void
|
|
59 }
|
|
60
|
|
61 @llvm.used = appending global [1 x i8*] [
|
|
62 i8* bitcast (i32(i32*)* @j to i8*)
|
|
63 ], section "llvm.metadata"
|
|
64
|
|
65 ; CHECK-LABEL: define void @call_things()
|
|
66 ; CHECK: call fastcc i32 @f
|
|
67 ; CHECK: call fastcc i32 @g
|
|
68 ; CHECK: call coldcc i32 @h
|
|
69 ; CHECK: call i32 @j
|
|
70 ; CHECK: call fastcc i32 @inalloca(i32* %args)
|