1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
| ; RUN: llvm-as < %s | llvm-dis | FileCheck %s
declare void @callee0()
declare void @callee1(i32,i32)
define void @f0(i32* %ptr) {
; CHECK-LABEL: @f0(
entry:
%l = load i32, i32* %ptr
%x = add i32 42, 1
call void @callee0() [ "foo"(i32 42, i64 100, i32 %x), "bar"(float 0.000000e+00, i64 100, i32 %l) ]
; CHECK: call void @callee0() [ "foo"(i32 42, i64 100, i32 %x), "bar"(float 0.000000e+00, i64 100, i32 %l) ]
ret void
}
define void @f1(i32* %ptr) {
; CHECK-LABEL: @f1(
entry:
%l = load i32, i32* %ptr
%x = add i32 42, 1
call void @callee0()
call void @callee0() [ "foo"() ]
call void @callee0() [ "foo"(i32 42, i64 100, i32 %x), "bar"(float 0.000000e+00, i64 100, i32 %l) ]
; CHECK: @callee0(){{$}}
; CHECK-NEXT: call void @callee0() [ "foo"() ]
; CHECK-NEXT: call void @callee0() [ "foo"(i32 42, i64 100, i32 %x), "bar"(float 0.000000e+00, i64 100, i32 %l) ]
ret void
}
define void @f2(i32* %ptr) {
; CHECK-LABEL: @f2(
entry:
call void @callee0() [ "foo"() ]
; CHECK: call void @callee0() [ "foo"() ]
ret void
}
define void @f3(i32* %ptr) {
; CHECK-LABEL: @f3(
entry:
%l = load i32, i32* %ptr
%x = add i32 42, 1
call void @callee0() [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ]
; CHECK: call void @callee0() [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ]
ret void
}
define void @f4(i32* %ptr) {
; CHECK-LABEL: @f4(
entry:
%l = load i32, i32* %ptr
%x = add i32 42, 1
call void @callee1(i32 10, i32 %x) [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ]
; CHECK: call void @callee1(i32 10, i32 %x) [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ]
ret void
}
; Invoke versions of the above tests:
define void @g0(i32* %ptr) personality i8 3 {
; CHECK-LABEL: @g0(
entry:
%l = load i32, i32* %ptr
%x = add i32 42, 1
invoke void @callee0() [ "foo"(i32 42, i64 100, i32 %x), "bar"(float 0.000000e+00, i64 100, i32 %l) ] to label %normal unwind label %exception
; CHECK: invoke void @callee0() [ "foo"(i32 42, i64 100, i32 %x), "bar"(float 0.000000e+00, i64 100, i32 %l) ]
exception:
%cleanup = landingpad i8 cleanup
br label %normal
normal:
ret void
}
define void @g1(i32* %ptr) personality i8 3 {
; CHECK-LABEL: @g1(
entry:
%l = load i32, i32* %ptr
%x = add i32 42, 1
invoke void @callee0() to label %normal unwind label %exception
; CHECK: invoke void @callee0(){{$}}
exception:
%cleanup = landingpad i8 cleanup
br label %normal
normal:
invoke void @callee0() [ "foo"() ] to label %normal1 unwind label %exception1
; CHECK: invoke void @callee0() [ "foo"() ]
exception1:
%cleanup1 = landingpad i8 cleanup
br label %normal1
normal1:
invoke void @callee0() [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ] to label %normal2 unwind label %exception2
; CHECK: invoke void @callee0() [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ]
exception2:
%cleanup2 = landingpad i8 cleanup
br label %normal2
normal2:
ret void
}
define void @g2(i32* %ptr) personality i8 3 {
; CHECK-LABEL: @g2(
entry:
invoke void @callee0() [ "foo"() ] to label %normal unwind label %exception
; CHECK: invoke void @callee0() [ "foo"() ]
exception:
%cleanup = landingpad i8 cleanup
br label %normal
normal:
ret void
}
define void @g3(i32* %ptr) personality i8 3 {
; CHECK-LABEL: @g3(
entry:
%l = load i32, i32* %ptr
%x = add i32 42, 1
invoke void @callee0() [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ] to label %normal unwind label %exception
; CHECK: invoke void @callee0() [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ]
exception:
%cleanup = landingpad i8 cleanup
br label %normal
normal:
ret void
}
define void @g4(i32* %ptr) personality i8 3 {
; CHECK-LABEL: @g4(
entry:
%l = load i32, i32* %ptr
%x = add i32 42, 1
invoke void @callee1(i32 10, i32 %x) [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ]
to label %normal unwind label %exception
; CHECK: invoke void @callee1(i32 10, i32 %x) [ "foo"(i32 42, i64 100, i32 %x), "foo"(i32 42, float 0.000000e+00, i32 %l) ]
exception:
%cleanup = landingpad i8 cleanup
br label %normal
normal:
ret void
}
|