blob: 41fa16c0284a88b3d7e5d0e71f9e8e8bc2a63a20 [file] [log] [blame]
Johannes Doerfert25de3422021-03-11 23:21:32 -06001; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
Johannes Doerfert3de06ff2021-03-01 17:04:49 -06002; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=16 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM
3; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=16 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM
Arthur Eubanks5a8075e2020-07-28 17:57:21 -07004; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM
Johannes Doerfert7a8805f2020-04-17 21:09:16 -05005; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM
Johannes Doerfert7827ca22019-11-01 13:42:54 -05006
Hideto Uenof2a55592019-09-07 07:03:05 +00007target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
8declare void @f(i32)
Arthur Eubanks670ec512020-03-16 12:32:36 -07009declare token @llvm.call.preallocated.setup(i32)
10declare i8* @llvm.call.preallocated.arg(token, i32)
Hideto Uenof2a55592019-09-07 07:03:05 +000011
12; Test1: Replace argument with constant
Johannes Doerfert25de3422021-03-11 23:21:32 -060013;.
14; CHECK: @[[S:[a-zA-Z0-9_$"\\.-]+]] = external global [[STRUCT_X:%.*]]
15;.
Hideto Uenof2a55592019-09-07 07:03:05 +000016define internal void @test1(i32 %a) {
sstefan1a9329d92020-08-29 19:31:13 +020017; CHECK-LABEL: define {{[^@]+}}@test1() {
Shinji Okumura555294d2020-08-30 05:34:24 +090018; CHECK-NEXT: tail call void @f(i32 noundef 1)
Johannes Doerfert75e7dc52020-04-08 19:04:57 -050019; CHECK-NEXT: ret void
20;
Hideto Uenof2a55592019-09-07 07:03:05 +000021 tail call void @f(i32 %a)
22 ret void
23}
24
25define void @test1_helper() {
sstefan1a9329d92020-08-29 19:31:13 +020026; CHECK-LABEL: define {{[^@]+}}@test1_helper() {
Johannes Doerfert75e7dc52020-04-08 19:04:57 -050027; CHECK-NEXT: tail call void @test1()
28; CHECK-NEXT: ret void
29;
Hideto Uenof2a55592019-09-07 07:03:05 +000030 tail call void @test1(i32 1)
31 ret void
32}
33
34; TEST 2 : Simplify return value
35define i32 @return0() {
sstefan135cfe172020-07-19 21:55:43 +020036; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
sstefan1a9329d92020-08-29 19:31:13 +020037; IS__TUNIT____-LABEL: define {{[^@]+}}@return0
Johannes Doerfert25de3422021-03-11 23:21:32 -060038; IS__TUNIT____-SAME: () #[[ATTR1:[0-9]+]] {
sstefan135cfe172020-07-19 21:55:43 +020039; IS__TUNIT____-NEXT: ret i32 0
40;
41; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
sstefan1a9329d92020-08-29 19:31:13 +020042; IS__CGSCC____-LABEL: define {{[^@]+}}@return0
Johannes Doerfert25de3422021-03-11 23:21:32 -060043; IS__CGSCC____-SAME: () #[[ATTR1:[0-9]+]] {
sstefan135cfe172020-07-19 21:55:43 +020044; IS__CGSCC____-NEXT: ret i32 0
Johannes Doerfert75e7dc52020-04-08 19:04:57 -050045;
Hideto Uenof2a55592019-09-07 07:03:05 +000046 ret i32 0
47}
48
49define i32 @return1() {
sstefan135cfe172020-07-19 21:55:43 +020050; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
sstefan1a9329d92020-08-29 19:31:13 +020051; IS__TUNIT____-LABEL: define {{[^@]+}}@return1
Johannes Doerfert25de3422021-03-11 23:21:32 -060052; IS__TUNIT____-SAME: () #[[ATTR1]] {
sstefan135cfe172020-07-19 21:55:43 +020053; IS__TUNIT____-NEXT: ret i32 1
54;
55; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
sstefan1a9329d92020-08-29 19:31:13 +020056; IS__CGSCC____-LABEL: define {{[^@]+}}@return1
Johannes Doerfert25de3422021-03-11 23:21:32 -060057; IS__CGSCC____-SAME: () #[[ATTR1]] {
sstefan135cfe172020-07-19 21:55:43 +020058; IS__CGSCC____-NEXT: ret i32 1
Johannes Doerfert75e7dc52020-04-08 19:04:57 -050059;
Hideto Uenof2a55592019-09-07 07:03:05 +000060 ret i32 1
61}
62
Hideto Uenof2a55592019-09-07 07:03:05 +000063define i32 @test2_1(i1 %c) {
sstefan135cfe172020-07-19 21:55:43 +020064; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
65; IS__TUNIT____-LABEL: define {{[^@]+}}@test2_1
Johannes Doerfert25de3422021-03-11 23:21:32 -060066; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
sstefan135cfe172020-07-19 21:55:43 +020067; IS__TUNIT____-NEXT: br i1 [[C]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
68; IS__TUNIT____: if.true:
69; IS__TUNIT____-NEXT: [[RET0:%.*]] = add i32 0, 1
70; IS__TUNIT____-NEXT: br label [[END:%.*]]
71; IS__TUNIT____: if.false:
72; IS__TUNIT____-NEXT: br label [[END]]
73; IS__TUNIT____: end:
74; IS__TUNIT____-NEXT: [[RET:%.*]] = phi i32 [ [[RET0]], [[IF_TRUE]] ], [ 1, [[IF_FALSE]] ]
75; IS__TUNIT____-NEXT: ret i32 1
76;
77; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
78; IS__CGSCC____-LABEL: define {{[^@]+}}@test2_1
Johannes Doerfert25de3422021-03-11 23:21:32 -060079; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
sstefan135cfe172020-07-19 21:55:43 +020080; IS__CGSCC____-NEXT: br i1 [[C]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
81; IS__CGSCC____: if.true:
82; IS__CGSCC____-NEXT: [[RET0:%.*]] = add i32 0, 1
83; IS__CGSCC____-NEXT: br label [[END:%.*]]
84; IS__CGSCC____: if.false:
85; IS__CGSCC____-NEXT: br label [[END]]
86; IS__CGSCC____: end:
87; IS__CGSCC____-NEXT: [[RET:%.*]] = phi i32 [ [[RET0]], [[IF_TRUE]] ], [ 1, [[IF_FALSE]] ]
88; IS__CGSCC____-NEXT: ret i32 1
Johannes Doerfert75e7dc52020-04-08 19:04:57 -050089;
Hideto Uenof2a55592019-09-07 07:03:05 +000090 br i1 %c, label %if.true, label %if.false
91if.true:
92 %call = tail call i32 @return0()
Hideto Uenof2a55592019-09-07 07:03:05 +000093 %ret0 = add i32 %call, 1
94 br label %end
95if.false:
96 %ret1 = tail call i32 @return1()
97 br label %end
98end:
99
Hideto Uenof2a55592019-09-07 07:03:05 +0000100 %ret = phi i32 [ %ret0, %if.true ], [ %ret1, %if.false ]
101
Hideto Uenocf3129442020-01-15 15:25:52 +0900102 ret i32 1
Hideto Uenof2a55592019-09-07 07:03:05 +0000103}
104
105
106
Hideto Uenof2a55592019-09-07 07:03:05 +0000107define i32 @test2_2(i1 %c) {
sstefan135cfe172020-07-19 21:55:43 +0200108; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
109; IS__TUNIT____-LABEL: define {{[^@]+}}@test2_2
Johannes Doerfert25de3422021-03-11 23:21:32 -0600110; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
sstefan135cfe172020-07-19 21:55:43 +0200111; IS__TUNIT____-NEXT: ret i32 1
112;
113; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
114; IS__CGSCC____-LABEL: define {{[^@]+}}@test2_2
Johannes Doerfert25de3422021-03-11 23:21:32 -0600115; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
sstefan135cfe172020-07-19 21:55:43 +0200116; IS__CGSCC____-NEXT: ret i32 1
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500117;
Hideto Uenof2a55592019-09-07 07:03:05 +0000118 %ret = tail call i32 @test2_1(i1 %c)
Hideto Uenof2a55592019-09-07 07:03:05 +0000119 ret i32 %ret
120}
121
122declare void @use(i32)
Hideto Uenof2a55592019-09-07 07:03:05 +0000123define void @test3(i1 %c) {
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500124; CHECK-LABEL: define {{[^@]+}}@test3
sstefan1a9329d92020-08-29 19:31:13 +0200125; CHECK-SAME: (i1 [[C:%.*]]) {
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500126; CHECK-NEXT: br i1 [[C]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
127; CHECK: if.true:
128; CHECK-NEXT: br label [[END:%.*]]
129; CHECK: if.false:
130; CHECK-NEXT: br label [[END]]
131; CHECK: end:
132; CHECK-NEXT: [[R:%.*]] = phi i32 [ 1, [[IF_TRUE]] ], [ 1, [[IF_FALSE]] ]
Shinji Okumura555294d2020-08-30 05:34:24 +0900133; CHECK-NEXT: tail call void @use(i32 noundef 1)
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500134; CHECK-NEXT: ret void
135;
Hideto Uenof2a55592019-09-07 07:03:05 +0000136 br i1 %c, label %if.true, label %if.false
137if.true:
138 br label %end
139if.false:
140 %ret1 = tail call i32 @return1()
141 br label %end
142end:
143
Hideto Uenof2a55592019-09-07 07:03:05 +0000144 %r = phi i32 [ 1, %if.true ], [ %ret1, %if.false ]
145
Hideto Uenof2a55592019-09-07 07:03:05 +0000146 tail call void @use(i32 %r)
147 ret void
148}
149
150define void @test-select-phi(i1 %c) {
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500151; CHECK-LABEL: define {{[^@]+}}@test-select-phi
sstefan1a9329d92020-08-29 19:31:13 +0200152; CHECK-SAME: (i1 [[C:%.*]]) {
Shinji Okumura555294d2020-08-30 05:34:24 +0900153; CHECK-NEXT: tail call void @use(i32 noundef 1)
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500154; CHECK-NEXT: [[SELECT_NOT_SAME:%.*]] = select i1 [[C]], i32 1, i32 0
Shinji Okumura555294d2020-08-30 05:34:24 +0900155; CHECK-NEXT: tail call void @use(i32 noundef [[SELECT_NOT_SAME]])
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500156; CHECK-NEXT: br i1 [[C]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
157; CHECK: if-true:
158; CHECK-NEXT: br label [[END:%.*]]
159; CHECK: if-false:
160; CHECK-NEXT: br label [[END]]
161; CHECK: end:
162; CHECK-NEXT: [[PHI_SAME:%.*]] = phi i32 [ 1, [[IF_TRUE]] ], [ 1, [[IF_FALSE]] ]
163; CHECK-NEXT: [[PHI_NOT_SAME:%.*]] = phi i32 [ 0, [[IF_TRUE]] ], [ 1, [[IF_FALSE]] ]
164; CHECK-NEXT: [[PHI_SAME_PROP:%.*]] = phi i32 [ 1, [[IF_TRUE]] ], [ 1, [[IF_FALSE]] ]
165; CHECK-NEXT: [[PHI_SAME_UNDEF:%.*]] = phi i32 [ 1, [[IF_TRUE]] ], [ undef, [[IF_FALSE]] ]
166; CHECK-NEXT: [[SELECT_NOT_SAME_UNDEF:%.*]] = select i1 [[C]], i32 [[PHI_NOT_SAME]], i32 undef
Shinji Okumura555294d2020-08-30 05:34:24 +0900167; CHECK-NEXT: tail call void @use(i32 noundef 1)
168; CHECK-NEXT: tail call void @use(i32 noundef [[PHI_NOT_SAME]])
169; CHECK-NEXT: tail call void @use(i32 noundef 1)
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500170; CHECK-NEXT: tail call void @use(i32 1)
171; CHECK-NEXT: tail call void @use(i32 [[SELECT_NOT_SAME_UNDEF]])
172; CHECK-NEXT: ret void
173;
Hideto Uenof2a55592019-09-07 07:03:05 +0000174 %select-same = select i1 %c, i32 1, i32 1
Hideto Uenof2a55592019-09-07 07:03:05 +0000175 tail call void @use(i32 %select-same)
176
177 %select-not-same = select i1 %c, i32 1, i32 0
Hideto Uenof2a55592019-09-07 07:03:05 +0000178 tail call void @use(i32 %select-not-same)
179 br i1 %c, label %if-true, label %if-false
180if-true:
181 br label %end
182if-false:
183 br label %end
184end:
185 %phi-same = phi i32 [ 1, %if-true ], [ 1, %if-false ]
186 %phi-not-same = phi i32 [ 0, %if-true ], [ 1, %if-false ]
187 %phi-same-prop = phi i32 [ 1, %if-true ], [ %select-same, %if-false ]
188 %phi-same-undef = phi i32 [ 1, %if-true ], [ undef, %if-false ]
189 %select-not-same-undef = select i1 %c, i32 %phi-not-same, i32 undef
190
191
Hideto Uenof2a55592019-09-07 07:03:05 +0000192 tail call void @use(i32 %phi-same)
193
Hideto Uenof2a55592019-09-07 07:03:05 +0000194 tail call void @use(i32 %phi-not-same)
195
Hideto Uenof2a55592019-09-07 07:03:05 +0000196 tail call void @use(i32 %phi-same-prop)
197
Hideto Uenof2a55592019-09-07 07:03:05 +0000198 tail call void @use(i32 %phi-same-undef)
199
Hideto Uenof2a55592019-09-07 07:03:05 +0000200 tail call void @use(i32 %select-not-same-undef)
201
202 ret void
203
204}
Johannes Doerferta027e8d2019-10-29 11:47:47 -0500205
206define i32 @ipccp1(i32 %a) {
sstefan135cfe172020-07-19 21:55:43 +0200207; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
208; IS__TUNIT____-LABEL: define {{[^@]+}}@ipccp1
Johannes Doerfert25de3422021-03-11 23:21:32 -0600209; IS__TUNIT____-SAME: (i32 returned [[A:%.*]]) #[[ATTR1]] {
sstefan135cfe172020-07-19 21:55:43 +0200210; IS__TUNIT____-NEXT: br i1 true, label [[T:%.*]], label [[F:%.*]]
211; IS__TUNIT____: t:
212; IS__TUNIT____-NEXT: ret i32 [[A]]
213; IS__TUNIT____: f:
214; IS__TUNIT____-NEXT: unreachable
215;
216; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
217; IS__CGSCC____-LABEL: define {{[^@]+}}@ipccp1
Johannes Doerfert25de3422021-03-11 23:21:32 -0600218; IS__CGSCC____-SAME: (i32 returned [[A:%.*]]) #[[ATTR1]] {
sstefan135cfe172020-07-19 21:55:43 +0200219; IS__CGSCC____-NEXT: br i1 true, label [[T:%.*]], label [[F:%.*]]
220; IS__CGSCC____: t:
221; IS__CGSCC____-NEXT: ret i32 [[A]]
222; IS__CGSCC____: f:
223; IS__CGSCC____-NEXT: unreachable
Johannes Doerferta027e8d2019-10-29 11:47:47 -0500224;
225 br i1 true, label %t, label %f
226t:
227 ret i32 %a
228f:
229 %r = call i32 @ipccp1(i32 5)
230 ret i32 %r
231}
232
233define internal i1 @ipccp2i(i1 %a) {
sstefan135cfe172020-07-19 21:55:43 +0200234; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
sstefan1a9329d92020-08-29 19:31:13 +0200235; IS__CGSCC____-LABEL: define {{[^@]+}}@ipccp2i
Johannes Doerfert25de3422021-03-11 23:21:32 -0600236; IS__CGSCC____-SAME: () #[[ATTR1]] {
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500237; IS__CGSCC____-NEXT: br label [[T:%.*]]
238; IS__CGSCC____: t:
sstefan1fd903782020-08-30 10:29:07 +0200239; IS__CGSCC____-NEXT: ret i1 undef
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500240; IS__CGSCC____: f:
241; IS__CGSCC____-NEXT: unreachable
242;
Johannes Doerferta027e8d2019-10-29 11:47:47 -0500243 br i1 %a, label %t, label %f
244t:
245 ret i1 %a
246f:
247 %r = call i1 @ipccp2i(i1 false)
248 ret i1 %r
249}
250
251define i1 @ipccp2() {
sstefan135cfe172020-07-19 21:55:43 +0200252; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
sstefan1a9329d92020-08-29 19:31:13 +0200253; IS__TUNIT____-LABEL: define {{[^@]+}}@ipccp2
Johannes Doerfert25de3422021-03-11 23:21:32 -0600254; IS__TUNIT____-SAME: () #[[ATTR1]] {
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500255; IS__TUNIT____-NEXT: ret i1 true
256;
sstefan1fd903782020-08-30 10:29:07 +0200257; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
258; IS__CGSCC____-LABEL: define {{[^@]+}}@ipccp2
Johannes Doerfert25de3422021-03-11 23:21:32 -0600259; IS__CGSCC____-SAME: () #[[ATTR1]] {
sstefan1fd903782020-08-30 10:29:07 +0200260; IS__CGSCC____-NEXT: ret i1 true
Johannes Doerferta027e8d2019-10-29 11:47:47 -0500261;
262 %r = call i1 @ipccp2i(i1 true)
263 ret i1 %r
264}
265
Johannes Doerfertb9b3cef2020-01-23 17:12:56 -0600266define internal i1 @ipccp2ib(i1 %a) {
sstefan135cfe172020-07-19 21:55:43 +0200267; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
sstefan1a9329d92020-08-29 19:31:13 +0200268; IS__CGSCC____-LABEL: define {{[^@]+}}@ipccp2ib
Johannes Doerfert25de3422021-03-11 23:21:32 -0600269; IS__CGSCC____-SAME: () #[[ATTR1]] {
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500270; IS__CGSCC____-NEXT: br label [[T:%.*]]
271; IS__CGSCC____: t:
sstefan1fd903782020-08-30 10:29:07 +0200272; IS__CGSCC____-NEXT: ret i1 undef
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500273; IS__CGSCC____: f:
274; IS__CGSCC____-NEXT: unreachable
275;
Johannes Doerfertb9b3cef2020-01-23 17:12:56 -0600276 br i1 %a, label %t, label %f
277t:
278 ret i1 true
279f:
280 %r = call i1 @ipccp2ib(i1 false)
281 ret i1 %r
282}
283
284define i1 @ipccp2b() {
sstefan135cfe172020-07-19 21:55:43 +0200285; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
sstefan1a9329d92020-08-29 19:31:13 +0200286; IS__TUNIT____-LABEL: define {{[^@]+}}@ipccp2b
Johannes Doerfert25de3422021-03-11 23:21:32 -0600287; IS__TUNIT____-SAME: () #[[ATTR1]] {
sstefan135cfe172020-07-19 21:55:43 +0200288; IS__TUNIT____-NEXT: ret i1 true
289;
290; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
sstefan1a9329d92020-08-29 19:31:13 +0200291; IS__CGSCC____-LABEL: define {{[^@]+}}@ipccp2b
Johannes Doerfert25de3422021-03-11 23:21:32 -0600292; IS__CGSCC____-SAME: () #[[ATTR1]] {
sstefan135cfe172020-07-19 21:55:43 +0200293; IS__CGSCC____-NEXT: ret i1 true
Johannes Doerferta027e8d2019-10-29 11:47:47 -0500294;
Johannes Doerfertb9b3cef2020-01-23 17:12:56 -0600295 %r = call i1 @ipccp2ib(i1 true)
296 ret i1 %r
297}
298
299define internal i32 @ipccp3i(i32 %a) {
sstefan135cfe172020-07-19 21:55:43 +0200300; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
sstefan1a9329d92020-08-29 19:31:13 +0200301; IS__CGSCC____-LABEL: define {{[^@]+}}@ipccp3i
Johannes Doerfert25de3422021-03-11 23:21:32 -0600302; IS__CGSCC____-SAME: () #[[ATTR1]] {
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500303; IS__CGSCC____-NEXT: br label [[T:%.*]]
304; IS__CGSCC____: t:
sstefan1fd903782020-08-30 10:29:07 +0200305; IS__CGSCC____-NEXT: ret i32 undef
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500306; IS__CGSCC____: f:
307; IS__CGSCC____-NEXT: unreachable
308;
Johannes Doerferta027e8d2019-10-29 11:47:47 -0500309 %c = icmp eq i32 %a, 7
310 br i1 %c, label %t, label %f
311t:
312 ret i32 %a
313f:
314 %r = call i32 @ipccp3i(i32 5)
315 ret i32 %r
316}
317
318define i32 @ipccp3() {
sstefan135cfe172020-07-19 21:55:43 +0200319; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
sstefan1a9329d92020-08-29 19:31:13 +0200320; IS__TUNIT____-LABEL: define {{[^@]+}}@ipccp3
Johannes Doerfert25de3422021-03-11 23:21:32 -0600321; IS__TUNIT____-SAME: () #[[ATTR1]] {
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500322; IS__TUNIT____-NEXT: ret i32 7
323;
sstefan1fd903782020-08-30 10:29:07 +0200324; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
325; IS__CGSCC____-LABEL: define {{[^@]+}}@ipccp3
Johannes Doerfert25de3422021-03-11 23:21:32 -0600326; IS__CGSCC____-SAME: () #[[ATTR1]] {
sstefan1fd903782020-08-30 10:29:07 +0200327; IS__CGSCC____-NEXT: ret i32 7
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500328;
Johannes Doerferta027e8d2019-10-29 11:47:47 -0500329 %r = call i32 @ipccp3i(i32 7)
330 ret i32 %r
331}
Johannes Doerfert7827ca22019-11-01 13:42:54 -0500332
Johannes Doerfert7827ca22019-11-01 13:42:54 -0500333; Do not touch complicated arguments (for now)
334%struct.X = type { i8* }
Nico Weber01c9b9c2021-03-28 13:02:52 -0400335define internal i32* @test_inalloca(i32* inalloca %a) {
sstefan135cfe172020-07-19 21:55:43 +0200336; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
337; IS__TUNIT____-LABEL: define {{[^@]+}}@test_inalloca
Nico Weber01c9b9c2021-03-28 13:02:52 -0400338; IS__TUNIT____-SAME: (i32* inalloca noalias nofree nonnull returned writeonly dereferenceable(4) "no-capture-maybe-returned" [[A:%.*]]) #[[ATTR1]] {
sstefan135cfe172020-07-19 21:55:43 +0200339; IS__TUNIT____-NEXT: ret i32* [[A]]
340;
341; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
342; IS__CGSCC____-LABEL: define {{[^@]+}}@test_inalloca
Nico Weber01c9b9c2021-03-28 13:02:52 -0400343; IS__CGSCC____-SAME: (i32* inalloca noalias nofree noundef nonnull returned writeonly dereferenceable(4) "no-capture-maybe-returned" [[A:%.*]]) #[[ATTR1]] {
sstefan135cfe172020-07-19 21:55:43 +0200344; IS__CGSCC____-NEXT: ret i32* [[A]]
Johannes Doerfert7827ca22019-11-01 13:42:54 -0500345;
346 ret i32* %a
347}
Matt Arsenaulta4188272020-06-25 19:17:24 -0400348define i32* @complicated_args_inalloca(i32* %arg) {
sstefan135cfe172020-07-19 21:55:43 +0200349; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
sstefan1a9329d92020-08-29 19:31:13 +0200350; IS__TUNIT____-LABEL: define {{[^@]+}}@complicated_args_inalloca
Johannes Doerfert25de3422021-03-11 23:21:32 -0600351; IS__TUNIT____-SAME: (i32* nofree readnone returned "no-capture-maybe-returned" [[ARG:%.*]]) #[[ATTR1]] {
352; IS__TUNIT____-NEXT: [[CALL:%.*]] = call i32* @test_inalloca(i32* noalias nofree writeonly "no-capture-maybe-returned" [[ARG]]) #[[ATTR1]]
sstefan135cfe172020-07-19 21:55:43 +0200353; IS__TUNIT____-NEXT: ret i32* [[CALL]]
354;
sstefan1a9329d92020-08-29 19:31:13 +0200355; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
356; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@complicated_args_inalloca
Johannes Doerfert25de3422021-03-11 23:21:32 -0600357; IS__CGSCC_OPM-SAME: (i32* nofree noundef nonnull readnone returned dereferenceable(4) "no-capture-maybe-returned" [[ARG:%.*]]) #[[ATTR1]] {
358; IS__CGSCC_OPM-NEXT: [[CALL:%.*]] = call i32* @test_inalloca(i32* noalias nofree noundef nonnull writeonly dereferenceable(4) "no-capture-maybe-returned" [[ARG]]) #[[ATTR5:[0-9]+]]
sstefan1a9329d92020-08-29 19:31:13 +0200359; IS__CGSCC_OPM-NEXT: ret i32* [[CALL]]
360;
361; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
362; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@complicated_args_inalloca
Johannes Doerfert25de3422021-03-11 23:21:32 -0600363; IS__CGSCC_NPM-SAME: (i32* nofree noundef nonnull readnone returned dereferenceable(4) "no-capture-maybe-returned" [[ARG:%.*]]) #[[ATTR1]] {
364; IS__CGSCC_NPM-NEXT: [[CALL:%.*]] = call i32* @test_inalloca(i32* noalias nofree noundef nonnull writeonly dereferenceable(4) "no-capture-maybe-returned" [[ARG]]) #[[ATTR4:[0-9]+]]
sstefan1a9329d92020-08-29 19:31:13 +0200365; IS__CGSCC_NPM-NEXT: ret i32* [[CALL]]
Johannes Doerfert7827ca22019-11-01 13:42:54 -0500366;
Matt Arsenaulta4188272020-06-25 19:17:24 -0400367 %call = call i32* @test_inalloca(i32* %arg)
Johannes Doerfert7827ca22019-11-01 13:42:54 -0500368 ret i32* %call
369}
370
Arthur Eubanks670ec512020-03-16 12:32:36 -0700371define internal i32* @test_preallocated(i32* preallocated(i32) %a) {
sstefan135cfe172020-07-19 21:55:43 +0200372; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
373; IS__TUNIT____-LABEL: define {{[^@]+}}@test_preallocated
Johannes Doerfert25de3422021-03-11 23:21:32 -0600374; IS__TUNIT____-SAME: (i32* noalias nofree noundef nonnull returned writeonly preallocated(i32) align 536870912 dereferenceable(4) "no-capture-maybe-returned" [[A:%.*]]) #[[ATTR1]] {
sstefan135cfe172020-07-19 21:55:43 +0200375; IS__TUNIT____-NEXT: ret i32* [[A]]
376;
377; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
378; IS__CGSCC____-LABEL: define {{[^@]+}}@test_preallocated
Johannes Doerfert25de3422021-03-11 23:21:32 -0600379; IS__CGSCC____-SAME: (i32* noalias nofree noundef nonnull returned writeonly preallocated(i32) align 536870912 dereferenceable(4) "no-capture-maybe-returned" [[A:%.*]]) #[[ATTR1]] {
sstefan135cfe172020-07-19 21:55:43 +0200380; IS__CGSCC____-NEXT: ret i32* [[A]]
Arthur Eubanks670ec512020-03-16 12:32:36 -0700381;
382 ret i32* %a
383}
384define i32* @complicated_args_preallocated() {
sstefan16520cb92020-10-15 13:04:36 +0200385; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind willreturn
sstefan1a9329d92020-08-29 19:31:13 +0200386; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@complicated_args_preallocated
Johannes Doerfert25de3422021-03-11 23:21:32 -0600387; IS__TUNIT_OPM-SAME: () #[[ATTR0:[0-9]+]] {
388; IS__TUNIT_OPM-NEXT: [[C:%.*]] = call token @llvm.call.preallocated.setup(i32 noundef 1) #[[ATTR5:[0-9]+]]
389; IS__TUNIT_OPM-NEXT: [[CALL:%.*]] = call i32* @test_preallocated(i32* noalias nocapture nofree noundef writeonly preallocated(i32) align 536870912 null) #[[ATTR1]] [ "preallocated"(token [[C]]) ]
Johannes Doerfert12a8ab12020-07-10 10:37:31 -0500390; IS__TUNIT_OPM-NEXT: ret i32* [[CALL]]
391;
sstefan16520cb92020-10-15 13:04:36 +0200392; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind willreturn
sstefan1a9329d92020-08-29 19:31:13 +0200393; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@complicated_args_preallocated
Johannes Doerfert25de3422021-03-11 23:21:32 -0600394; IS__TUNIT_NPM-SAME: () #[[ATTR0:[0-9]+]] {
395; IS__TUNIT_NPM-NEXT: [[C:%.*]] = call token @llvm.call.preallocated.setup(i32 noundef 1) #[[ATTR4:[0-9]+]]
396; IS__TUNIT_NPM-NEXT: [[CALL:%.*]] = call i32* @test_preallocated(i32* noalias nocapture nofree noundef writeonly preallocated(i32) align 536870912 null) #[[ATTR1]] [ "preallocated"(token [[C]]) ]
Johannes Doerfert12a8ab12020-07-10 10:37:31 -0500397; IS__TUNIT_NPM-NEXT: ret i32* [[CALL]]
398;
sstefan16520cb92020-10-15 13:04:36 +0200399; IS__CGSCC_OPM: Function Attrs: nofree nosync nounwind willreturn
sstefan1a9329d92020-08-29 19:31:13 +0200400; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@complicated_args_preallocated
Johannes Doerfert25de3422021-03-11 23:21:32 -0600401; IS__CGSCC_OPM-SAME: () #[[ATTR0:[0-9]+]] {
Johannes Doerfert979d5c62021-01-05 16:55:54 -0600402; IS__CGSCC_OPM-NEXT: [[C:%.*]] = call token @llvm.call.preallocated.setup(i32 noundef 1) #[[ATTR6:[0-9]+]]
403; IS__CGSCC_OPM-NEXT: [[CALL:%.*]] = call i32* @test_preallocated(i32* noalias nocapture nofree noundef writeonly preallocated(i32) align 536870912 null) #[[ATTR7:[0-9]+]] [ "preallocated"(token [[C]]) ]
Johannes Doerfert12a8ab12020-07-10 10:37:31 -0500404; IS__CGSCC_OPM-NEXT: ret i32* [[CALL]]
405;
sstefan16520cb92020-10-15 13:04:36 +0200406; IS__CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
sstefan1a9329d92020-08-29 19:31:13 +0200407; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@complicated_args_preallocated
Johannes Doerfert25de3422021-03-11 23:21:32 -0600408; IS__CGSCC_NPM-SAME: () #[[ATTR0:[0-9]+]] {
Johannes Doerfert979d5c62021-01-05 16:55:54 -0600409; IS__CGSCC_NPM-NEXT: [[C:%.*]] = call token @llvm.call.preallocated.setup(i32 noundef 1) #[[ATTR5:[0-9]+]]
410; IS__CGSCC_NPM-NEXT: [[CALL:%.*]] = call i32* @test_preallocated(i32* noalias nocapture nofree noundef writeonly preallocated(i32) align 536870912 null) #[[ATTR6:[0-9]+]] [ "preallocated"(token [[C]]) ]
Johannes Doerfert12a8ab12020-07-10 10:37:31 -0500411; IS__CGSCC_NPM-NEXT: ret i32* [[CALL]]
Arthur Eubanks670ec512020-03-16 12:32:36 -0700412;
413 %c = call token @llvm.call.preallocated.setup(i32 1)
414 %call = call i32* @test_preallocated(i32* preallocated(i32) null) ["preallocated"(token %c)]
415 ret i32* %call
416}
417
Matt Arsenaulta4985e72020-09-29 09:33:55 -0400418define internal void @test_sret(%struct.X* sret(%struct.X) %a, %struct.X** %b) {
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500419;
sstefan135cfe172020-07-19 21:55:43 +0200420; IS__TUNIT____: Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly
421; IS__TUNIT____-LABEL: define {{[^@]+}}@test_sret
Johannes Doerfert25de3422021-03-11 23:21:32 -0600422; IS__TUNIT____-SAME: (%struct.X* noalias nofree noundef nonnull writeonly sret([[STRUCT_X:%.*]]) align 536870912 dereferenceable(8) [[A:%.*]], %struct.X** nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[B:%.*]]) #[[ATTR2:[0-9]+]] {
sstefan135cfe172020-07-19 21:55:43 +0200423; IS__TUNIT____-NEXT: store %struct.X* [[A]], %struct.X** [[B]], align 8
424; IS__TUNIT____-NEXT: ret void
425;
426; IS__CGSCC____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
427; IS__CGSCC____-LABEL: define {{[^@]+}}@test_sret
Johannes Doerfert25de3422021-03-11 23:21:32 -0600428; IS__CGSCC____-SAME: (%struct.X* noalias nofree noundef nonnull writeonly sret([[STRUCT_X:%.*]]) align 536870912 dereferenceable(8) [[A:%.*]], %struct.X** nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[B:%.*]]) #[[ATTR2:[0-9]+]] {
sstefan135cfe172020-07-19 21:55:43 +0200429; IS__CGSCC____-NEXT: store %struct.X* [[A]], %struct.X** [[B]], align 8
430; IS__CGSCC____-NEXT: ret void
Johannes Doerfert7827ca22019-11-01 13:42:54 -0500431;
432 store %struct.X* %a, %struct.X** %b
433 ret void
434}
Johannes Doerfert1fc82b72020-04-01 21:46:03 -0500435; FIXME: Alignment and dereferenceability are not propagated to the argument
Johannes Doerfert7827ca22019-11-01 13:42:54 -0500436define void @complicated_args_sret(%struct.X** %b) {
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500437;
sstefan1a9329d92020-08-29 19:31:13 +0200438; IS__TUNIT_OPM: Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly
439; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@complicated_args_sret
Johannes Doerfert25de3422021-03-11 23:21:32 -0600440; IS__TUNIT_OPM-SAME: (%struct.X** nocapture nofree writeonly [[B:%.*]]) #[[ATTR2]] {
441; IS__TUNIT_OPM-NEXT: call void @test_sret(%struct.X* noalias nocapture nofree noundef writeonly align 536870912 null, %struct.X** nocapture nofree writeonly align 8 [[B]]) #[[ATTR6:[0-9]+]]
sstefan1a9329d92020-08-29 19:31:13 +0200442; IS__TUNIT_OPM-NEXT: ret void
443;
444; IS__TUNIT_NPM: Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly
445; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@complicated_args_sret
Johannes Doerfert25de3422021-03-11 23:21:32 -0600446; IS__TUNIT_NPM-SAME: (%struct.X** nocapture nofree writeonly [[B:%.*]]) #[[ATTR2]] {
447; IS__TUNIT_NPM-NEXT: call void @test_sret(%struct.X* noalias nocapture nofree noundef writeonly align 536870912 null, %struct.X** nocapture nofree writeonly align 8 [[B]]) #[[ATTR5:[0-9]+]]
sstefan1a9329d92020-08-29 19:31:13 +0200448; IS__TUNIT_NPM-NEXT: ret void
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500449;
sstefan135cfe172020-07-19 21:55:43 +0200450; IS__CGSCC____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500451; IS__CGSCC____-LABEL: define {{[^@]+}}@complicated_args_sret
Johannes Doerfert25de3422021-03-11 23:21:32 -0600452; IS__CGSCC____-SAME: (%struct.X** nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[B:%.*]]) #[[ATTR2]] {
Shinji Okumura95004ff2020-08-18 18:04:47 +0900453; IS__CGSCC____-NEXT: unreachable
Johannes Doerfert7827ca22019-11-01 13:42:54 -0500454;
455 call void @test_sret(%struct.X* null, %struct.X** %b)
456 ret void
457}
458
459define internal %struct.X* @test_nest(%struct.X* nest %a) {
sstefan135cfe172020-07-19 21:55:43 +0200460; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
461; IS__TUNIT____-LABEL: define {{[^@]+}}@test_nest
Johannes Doerfert25de3422021-03-11 23:21:32 -0600462; IS__TUNIT____-SAME: (%struct.X* nest noalias nofree noundef readnone returned align 536870912 "no-capture-maybe-returned" [[A:%.*]]) #[[ATTR1]] {
sstefan135cfe172020-07-19 21:55:43 +0200463; IS__TUNIT____-NEXT: ret %struct.X* [[A]]
464;
465; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
466; IS__CGSCC____-LABEL: define {{[^@]+}}@test_nest
Johannes Doerfert25de3422021-03-11 23:21:32 -0600467; IS__CGSCC____-SAME: (%struct.X* nest noalias nofree noundef readnone returned align 536870912 "no-capture-maybe-returned" [[A:%.*]]) #[[ATTR1]] {
sstefan135cfe172020-07-19 21:55:43 +0200468; IS__CGSCC____-NEXT: ret %struct.X* [[A]]
Johannes Doerfert7827ca22019-11-01 13:42:54 -0500469;
470 ret %struct.X* %a
471}
472define %struct.X* @complicated_args_nest() {
sstefan135cfe172020-07-19 21:55:43 +0200473; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
sstefan1a9329d92020-08-29 19:31:13 +0200474; IS__TUNIT____-LABEL: define {{[^@]+}}@complicated_args_nest
Johannes Doerfert25de3422021-03-11 23:21:32 -0600475; IS__TUNIT____-SAME: () #[[ATTR1]] {
476; IS__TUNIT____-NEXT: [[CALL:%.*]] = call %struct.X* @test_nest(%struct.X* noalias nocapture nofree noundef readnone align 536870912 null) #[[ATTR1]]
sstefan135cfe172020-07-19 21:55:43 +0200477; IS__TUNIT____-NEXT: ret %struct.X* [[CALL]]
478;
sstefan1a9329d92020-08-29 19:31:13 +0200479; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
480; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@complicated_args_nest
Johannes Doerfert25de3422021-03-11 23:21:32 -0600481; IS__CGSCC_OPM-SAME: () #[[ATTR1]] {
482; IS__CGSCC_OPM-NEXT: [[CALL:%.*]] = call %struct.X* @test_nest(%struct.X* noalias nocapture nofree noundef readnone align 536870912 null) #[[ATTR5]]
sstefan1a9329d92020-08-29 19:31:13 +0200483; IS__CGSCC_OPM-NEXT: ret %struct.X* [[CALL]]
484;
485; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
486; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@complicated_args_nest
Johannes Doerfert25de3422021-03-11 23:21:32 -0600487; IS__CGSCC_NPM-SAME: () #[[ATTR1]] {
488; IS__CGSCC_NPM-NEXT: [[CALL:%.*]] = call %struct.X* @test_nest(%struct.X* noalias nocapture nofree noundef readnone align 536870912 null) #[[ATTR4]]
sstefan1a9329d92020-08-29 19:31:13 +0200489; IS__CGSCC_NPM-NEXT: ret %struct.X* [[CALL]]
Johannes Doerfert7827ca22019-11-01 13:42:54 -0500490;
491 %call = call %struct.X* @test_nest(%struct.X* null)
492 ret %struct.X* %call
493}
494
495@S = external global %struct.X
Matt Arsenault2a6a4302020-11-20 10:52:27 -0500496define internal void @test_byval(%struct.X* byval(%struct.X) %a) {
sstefan135cfe172020-07-19 21:55:43 +0200497; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500498; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@test_byval
Johannes Doerfert25de3422021-03-11 23:21:32 -0600499; IS__CGSCC_OPM-SAME: (%struct.X* noalias nocapture nofree noundef nonnull writeonly byval([[STRUCT_X:%.*]]) align 8 dereferenceable(8) [[A:%.*]]) #[[ATTR1]] {
500; IS__CGSCC_OPM-NEXT: [[G0:%.*]] = getelementptr [[STRUCT_X]], %struct.X* [[A]], i32 0, i32 0
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500501; IS__CGSCC_OPM-NEXT: store i8* null, i8** [[G0]], align 8
502; IS__CGSCC_OPM-NEXT: ret void
503;
sstefan135cfe172020-07-19 21:55:43 +0200504; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500505; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@test_byval
Johannes Doerfert25de3422021-03-11 23:21:32 -0600506; IS__CGSCC_NPM-SAME: (i8* noalias nocapture nofree readnone [[TMP0:%.*]]) #[[ATTR1]] {
Eli Friedman292e2d92020-05-15 13:23:14 -0700507; IS__CGSCC_NPM-NEXT: [[A_PRIV:%.*]] = alloca [[STRUCT_X:%.*]], align 8
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500508; IS__CGSCC_NPM-NEXT: [[A_PRIV_CAST:%.*]] = bitcast %struct.X* [[A_PRIV]] to i8**
Johannes Doerfertd0b9c542020-04-22 17:49:58 -0500509; IS__CGSCC_NPM-NEXT: store i8* [[TMP0]], i8** [[A_PRIV_CAST]], align 8
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500510; IS__CGSCC_NPM-NEXT: [[G0:%.*]] = getelementptr [[STRUCT_X]], %struct.X* [[A_PRIV]], i32 0, i32 0
511; IS__CGSCC_NPM-NEXT: store i8* null, i8** [[G0]], align 8
512; IS__CGSCC_NPM-NEXT: ret void
513;
Johannes Doerfert7827ca22019-11-01 13:42:54 -0500514 %g0 = getelementptr %struct.X, %struct.X* %a, i32 0, i32 0
515 store i8* null, i8** %g0
516 ret void
517}
518define void @complicated_args_byval() {
sstefan135cfe172020-07-19 21:55:43 +0200519; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
sstefan1a9329d92020-08-29 19:31:13 +0200520; IS__TUNIT____-LABEL: define {{[^@]+}}@complicated_args_byval
Johannes Doerfert25de3422021-03-11 23:21:32 -0600521; IS__TUNIT____-SAME: () #[[ATTR1]] {
sstefan135cfe172020-07-19 21:55:43 +0200522; IS__TUNIT____-NEXT: ret void
523;
524; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
sstefan1a9329d92020-08-29 19:31:13 +0200525; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@complicated_args_byval
Johannes Doerfert25de3422021-03-11 23:21:32 -0600526; IS__CGSCC_OPM-SAME: () #[[ATTR1]] {
sstefan135cfe172020-07-19 21:55:43 +0200527; IS__CGSCC_OPM-NEXT: ret void
528;
529; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readonly willreturn
sstefan1a9329d92020-08-29 19:31:13 +0200530; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@complicated_args_byval
Johannes Doerfert25de3422021-03-11 23:21:32 -0600531; IS__CGSCC_NPM-SAME: () #[[ATTR3:[0-9]+]] {
sstefan135cfe172020-07-19 21:55:43 +0200532; IS__CGSCC_NPM-NEXT: ret void
Johannes Doerfert7827ca22019-11-01 13:42:54 -0500533;
534 call void @test_byval(%struct.X* @S)
535 ret void
536}
537
Matt Arsenault2a6a4302020-11-20 10:52:27 -0500538define internal i8*@test_byval2(%struct.X* byval(%struct.X) %a) {
sstefan135cfe172020-07-19 21:55:43 +0200539; IS__TUNIT____: Function Attrs: nofree nosync nounwind readonly willreturn
sstefan1a9329d92020-08-29 19:31:13 +0200540; IS__TUNIT____-LABEL: define {{[^@]+}}@test_byval2
Johannes Doerfert25de3422021-03-11 23:21:32 -0600541; IS__TUNIT____-SAME: () #[[ATTR3:[0-9]+]] {
sstefan135cfe172020-07-19 21:55:43 +0200542; IS__TUNIT____-NEXT: [[G0:%.*]] = getelementptr [[STRUCT_X:%.*]], %struct.X* @S, i32 0, i32 0
543; IS__TUNIT____-NEXT: [[L:%.*]] = load i8*, i8** [[G0]], align 8
544; IS__TUNIT____-NEXT: ret i8* [[L]]
545;
546; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readonly willreturn
sstefan1a9329d92020-08-29 19:31:13 +0200547; IS__CGSCC____-LABEL: define {{[^@]+}}@test_byval2
Johannes Doerfert25de3422021-03-11 23:21:32 -0600548; IS__CGSCC____-SAME: () #[[ATTR3:[0-9]+]] {
sstefan135cfe172020-07-19 21:55:43 +0200549; IS__CGSCC____-NEXT: [[G0:%.*]] = getelementptr [[STRUCT_X:%.*]], %struct.X* @S, i32 0, i32 0
550; IS__CGSCC____-NEXT: [[L:%.*]] = load i8*, i8** [[G0]], align 8
551; IS__CGSCC____-NEXT: ret i8* [[L]]
Johannes Doerfert9dec24a2020-01-26 02:51:57 -0600552;
553 %g0 = getelementptr %struct.X, %struct.X* %a, i32 0, i32 0
554 %l = load i8*, i8** %g0
555 ret i8* %l
556}
557define i8* @complicated_args_byval2() {
sstefan135cfe172020-07-19 21:55:43 +0200558; IS__TUNIT____: Function Attrs: nofree nosync nounwind readonly willreturn
sstefan1a9329d92020-08-29 19:31:13 +0200559; IS__TUNIT____-LABEL: define {{[^@]+}}@complicated_args_byval2
Johannes Doerfert25de3422021-03-11 23:21:32 -0600560; IS__TUNIT____-SAME: () #[[ATTR3]] {
561; IS__TUNIT____-NEXT: [[C:%.*]] = call i8* @test_byval2() #[[ATTR3]]
sstefan135cfe172020-07-19 21:55:43 +0200562; IS__TUNIT____-NEXT: ret i8* [[C]]
563;
sstefan1a9329d92020-08-29 19:31:13 +0200564; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readonly willreturn
565; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@complicated_args_byval2
Johannes Doerfert25de3422021-03-11 23:21:32 -0600566; IS__CGSCC_OPM-SAME: () #[[ATTR3]] {
Johannes Doerfert979d5c62021-01-05 16:55:54 -0600567; IS__CGSCC_OPM-NEXT: [[C:%.*]] = call i8* @test_byval2() #[[ATTR8:[0-9]+]]
sstefan1a9329d92020-08-29 19:31:13 +0200568; IS__CGSCC_OPM-NEXT: ret i8* [[C]]
569;
570; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readonly willreturn
571; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@complicated_args_byval2
Johannes Doerfert25de3422021-03-11 23:21:32 -0600572; IS__CGSCC_NPM-SAME: () #[[ATTR3]] {
Johannes Doerfert979d5c62021-01-05 16:55:54 -0600573; IS__CGSCC_NPM-NEXT: [[C:%.*]] = call i8* @test_byval2() #[[ATTR7:[0-9]+]]
sstefan1a9329d92020-08-29 19:31:13 +0200574; IS__CGSCC_NPM-NEXT: ret i8* [[C]]
Johannes Doerfert9dec24a2020-01-26 02:51:57 -0600575;
576 %c = call i8* @test_byval2(%struct.X* @S)
577 ret i8* %c
578}
579
Johannes Doerferta989e5d2019-12-31 13:25:47 -0600580define void @fixpoint_changed(i32* %p) {
sstefan135cfe172020-07-19 21:55:43 +0200581; IS__TUNIT_OPM: Function Attrs: argmemonly nofree nosync nounwind writeonly
582; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@fixpoint_changed
Johannes Doerfert25de3422021-03-11 23:21:32 -0600583; IS__TUNIT_OPM-SAME: (i32* nocapture nofree writeonly [[P:%.*]]) #[[ATTR4:[0-9]+]] {
sstefan135cfe172020-07-19 21:55:43 +0200584; IS__TUNIT_OPM-NEXT: entry:
585; IS__TUNIT_OPM-NEXT: br label [[FOR_COND:%.*]]
586; IS__TUNIT_OPM: for.cond:
587; IS__TUNIT_OPM-NEXT: [[J_0:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INC:%.*]], [[SW_EPILOG:%.*]] ]
588; IS__TUNIT_OPM-NEXT: [[CMP:%.*]] = icmp slt i32 [[J_0]], 30
589; IS__TUNIT_OPM-NEXT: br i1 [[CMP]], label [[FOR_BODY:%.*]], label [[FOR_END:%.*]]
590; IS__TUNIT_OPM: for.body:
591; IS__TUNIT_OPM-NEXT: switch i32 [[J_0]], label [[SW_EPILOG]] [
592; IS__TUNIT_OPM-NEXT: i32 1, label [[SW_BB:%.*]]
593; IS__TUNIT_OPM-NEXT: ]
594; IS__TUNIT_OPM: sw.bb:
595; IS__TUNIT_OPM-NEXT: br label [[SW_EPILOG]]
596; IS__TUNIT_OPM: sw.epilog:
597; IS__TUNIT_OPM-NEXT: [[X_0:%.*]] = phi i32 [ 255, [[FOR_BODY]] ], [ 253, [[SW_BB]] ]
598; IS__TUNIT_OPM-NEXT: store i32 [[X_0]], i32* [[P]], align 4
599; IS__TUNIT_OPM-NEXT: [[INC]] = add nsw i32 [[J_0]], 1
600; IS__TUNIT_OPM-NEXT: br label [[FOR_COND]]
601; IS__TUNIT_OPM: for.end:
602; IS__TUNIT_OPM-NEXT: ret void
603;
604; IS__TUNIT_NPM: Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly
605; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@fixpoint_changed
Johannes Doerfert25de3422021-03-11 23:21:32 -0600606; IS__TUNIT_NPM-SAME: (i32* nocapture nofree writeonly [[P:%.*]]) #[[ATTR2]] {
sstefan135cfe172020-07-19 21:55:43 +0200607; IS__TUNIT_NPM-NEXT: entry:
608; IS__TUNIT_NPM-NEXT: br label [[FOR_COND:%.*]]
609; IS__TUNIT_NPM: for.cond:
610; IS__TUNIT_NPM-NEXT: [[J_0:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INC:%.*]], [[SW_EPILOG:%.*]] ]
611; IS__TUNIT_NPM-NEXT: [[CMP:%.*]] = icmp slt i32 [[J_0]], 30
612; IS__TUNIT_NPM-NEXT: br i1 [[CMP]], label [[FOR_BODY:%.*]], label [[FOR_END:%.*]]
613; IS__TUNIT_NPM: for.body:
614; IS__TUNIT_NPM-NEXT: switch i32 [[J_0]], label [[SW_EPILOG]] [
615; IS__TUNIT_NPM-NEXT: i32 1, label [[SW_BB:%.*]]
616; IS__TUNIT_NPM-NEXT: ]
617; IS__TUNIT_NPM: sw.bb:
618; IS__TUNIT_NPM-NEXT: br label [[SW_EPILOG]]
619; IS__TUNIT_NPM: sw.epilog:
620; IS__TUNIT_NPM-NEXT: [[X_0:%.*]] = phi i32 [ 255, [[FOR_BODY]] ], [ 253, [[SW_BB]] ]
621; IS__TUNIT_NPM-NEXT: store i32 [[X_0]], i32* [[P]], align 4
622; IS__TUNIT_NPM-NEXT: [[INC]] = add nsw i32 [[J_0]], 1
623; IS__TUNIT_NPM-NEXT: br label [[FOR_COND]]
624; IS__TUNIT_NPM: for.end:
625; IS__TUNIT_NPM-NEXT: ret void
626;
627; IS__CGSCC_OPM: Function Attrs: argmemonly nofree norecurse nosync nounwind writeonly
628; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@fixpoint_changed
Johannes Doerfert25de3422021-03-11 23:21:32 -0600629; IS__CGSCC_OPM-SAME: (i32* nocapture nofree writeonly [[P:%.*]]) #[[ATTR4:[0-9]+]] {
sstefan135cfe172020-07-19 21:55:43 +0200630; IS__CGSCC_OPM-NEXT: entry:
631; IS__CGSCC_OPM-NEXT: br label [[FOR_COND:%.*]]
632; IS__CGSCC_OPM: for.cond:
633; IS__CGSCC_OPM-NEXT: [[J_0:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INC:%.*]], [[SW_EPILOG:%.*]] ]
634; IS__CGSCC_OPM-NEXT: [[CMP:%.*]] = icmp slt i32 [[J_0]], 30
635; IS__CGSCC_OPM-NEXT: br i1 [[CMP]], label [[FOR_BODY:%.*]], label [[FOR_END:%.*]]
636; IS__CGSCC_OPM: for.body:
637; IS__CGSCC_OPM-NEXT: switch i32 [[J_0]], label [[SW_EPILOG]] [
638; IS__CGSCC_OPM-NEXT: i32 1, label [[SW_BB:%.*]]
639; IS__CGSCC_OPM-NEXT: ]
640; IS__CGSCC_OPM: sw.bb:
641; IS__CGSCC_OPM-NEXT: br label [[SW_EPILOG]]
642; IS__CGSCC_OPM: sw.epilog:
643; IS__CGSCC_OPM-NEXT: [[X_0:%.*]] = phi i32 [ 255, [[FOR_BODY]] ], [ 253, [[SW_BB]] ]
644; IS__CGSCC_OPM-NEXT: store i32 [[X_0]], i32* [[P]], align 4
645; IS__CGSCC_OPM-NEXT: [[INC]] = add nsw i32 [[J_0]], 1
646; IS__CGSCC_OPM-NEXT: br label [[FOR_COND]]
647; IS__CGSCC_OPM: for.end:
648; IS__CGSCC_OPM-NEXT: ret void
649;
650; IS__CGSCC_NPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
651; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@fixpoint_changed
Johannes Doerfert25de3422021-03-11 23:21:32 -0600652; IS__CGSCC_NPM-SAME: (i32* nocapture nofree writeonly [[P:%.*]]) #[[ATTR2]] {
sstefan135cfe172020-07-19 21:55:43 +0200653; IS__CGSCC_NPM-NEXT: entry:
654; IS__CGSCC_NPM-NEXT: br label [[FOR_COND:%.*]]
655; IS__CGSCC_NPM: for.cond:
656; IS__CGSCC_NPM-NEXT: [[J_0:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INC:%.*]], [[SW_EPILOG:%.*]] ]
657; IS__CGSCC_NPM-NEXT: [[CMP:%.*]] = icmp slt i32 [[J_0]], 30
658; IS__CGSCC_NPM-NEXT: br i1 [[CMP]], label [[FOR_BODY:%.*]], label [[FOR_END:%.*]]
659; IS__CGSCC_NPM: for.body:
660; IS__CGSCC_NPM-NEXT: switch i32 [[J_0]], label [[SW_EPILOG]] [
661; IS__CGSCC_NPM-NEXT: i32 1, label [[SW_BB:%.*]]
662; IS__CGSCC_NPM-NEXT: ]
663; IS__CGSCC_NPM: sw.bb:
664; IS__CGSCC_NPM-NEXT: br label [[SW_EPILOG]]
665; IS__CGSCC_NPM: sw.epilog:
666; IS__CGSCC_NPM-NEXT: [[X_0:%.*]] = phi i32 [ 255, [[FOR_BODY]] ], [ 253, [[SW_BB]] ]
667; IS__CGSCC_NPM-NEXT: store i32 [[X_0]], i32* [[P]], align 4
668; IS__CGSCC_NPM-NEXT: [[INC]] = add nsw i32 [[J_0]], 1
669; IS__CGSCC_NPM-NEXT: br label [[FOR_COND]]
670; IS__CGSCC_NPM: for.end:
671; IS__CGSCC_NPM-NEXT: ret void
Johannes Doerferta989e5d2019-12-31 13:25:47 -0600672;
673entry:
674 br label %for.cond
675
676for.cond:
677 %j.0 = phi i32 [ 0, %entry ], [ %inc, %sw.epilog ]
678 %cmp = icmp slt i32 %j.0, 30
679 br i1 %cmp, label %for.body, label %for.end
680
681for.body:
682 switch i32 %j.0, label %sw.epilog [
683 i32 1, label %sw.bb
684 ]
685
686sw.bb:
687 br label %sw.epilog
688
689sw.epilog:
690 %x.0 = phi i32 [ 255, %for.body ], [ 253, %sw.bb ]
691 store i32 %x.0, i32* %p
692 %inc = add nsw i32 %j.0, 1
693 br label %for.cond
694
695for.end:
696 ret void
697}
698
Johannes Doerfert4647aa02020-02-14 20:11:22 -0600699; Check we merge undef and a constant properly.
Johannes Doerfert4647aa02020-02-14 20:11:22 -0600700define i8 @caller0() {
sstefan135cfe172020-07-19 21:55:43 +0200701; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
sstefan1a9329d92020-08-29 19:31:13 +0200702; IS__TUNIT____-LABEL: define {{[^@]+}}@caller0
Johannes Doerfert25de3422021-03-11 23:21:32 -0600703; IS__TUNIT____-SAME: () #[[ATTR1]] {
Shinji Okumurab8711cb2020-08-27 16:30:29 +0900704; IS__TUNIT____-NEXT: ret i8 49
sstefan135cfe172020-07-19 21:55:43 +0200705;
sstefan1fd903782020-08-30 10:29:07 +0200706; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
707; IS__CGSCC____-LABEL: define {{[^@]+}}@caller0
Johannes Doerfert25de3422021-03-11 23:21:32 -0600708; IS__CGSCC____-SAME: () #[[ATTR1]] {
sstefan1fd903782020-08-30 10:29:07 +0200709; IS__CGSCC____-NEXT: ret i8 49
Johannes Doerfert4647aa02020-02-14 20:11:22 -0600710;
711 %c = call i8 @callee(i8 undef)
712 ret i8 %c
713}
714define i8 @caller1() {
sstefan135cfe172020-07-19 21:55:43 +0200715; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
sstefan1a9329d92020-08-29 19:31:13 +0200716; IS__TUNIT____-LABEL: define {{[^@]+}}@caller1
Johannes Doerfert25de3422021-03-11 23:21:32 -0600717; IS__TUNIT____-SAME: () #[[ATTR1]] {
Shinji Okumurab8711cb2020-08-27 16:30:29 +0900718; IS__TUNIT____-NEXT: ret i8 49
sstefan135cfe172020-07-19 21:55:43 +0200719;
sstefan1fd903782020-08-30 10:29:07 +0200720; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
721; IS__CGSCC____-LABEL: define {{[^@]+}}@caller1
Johannes Doerfert25de3422021-03-11 23:21:32 -0600722; IS__CGSCC____-SAME: () #[[ATTR1]] {
sstefan1fd903782020-08-30 10:29:07 +0200723; IS__CGSCC____-NEXT: ret i8 49
Johannes Doerfert4647aa02020-02-14 20:11:22 -0600724;
725 %c = call i8 @callee(i8 undef)
726 ret i8 %c
727}
728define i8 @caller2() {
sstefan135cfe172020-07-19 21:55:43 +0200729; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
sstefan1a9329d92020-08-29 19:31:13 +0200730; IS__TUNIT____-LABEL: define {{[^@]+}}@caller2
Johannes Doerfert25de3422021-03-11 23:21:32 -0600731; IS__TUNIT____-SAME: () #[[ATTR1]] {
Shinji Okumurab8711cb2020-08-27 16:30:29 +0900732; IS__TUNIT____-NEXT: ret i8 49
sstefan135cfe172020-07-19 21:55:43 +0200733;
sstefan1fd903782020-08-30 10:29:07 +0200734; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
735; IS__CGSCC____-LABEL: define {{[^@]+}}@caller2
Johannes Doerfert25de3422021-03-11 23:21:32 -0600736; IS__CGSCC____-SAME: () #[[ATTR1]] {
sstefan1fd903782020-08-30 10:29:07 +0200737; IS__CGSCC____-NEXT: ret i8 49
Johannes Doerfert4647aa02020-02-14 20:11:22 -0600738;
739 %c = call i8 @callee(i8 undef)
740 ret i8 %c
741}
742define i8 @caller_middle() {
sstefan135cfe172020-07-19 21:55:43 +0200743; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
sstefan1a9329d92020-08-29 19:31:13 +0200744; IS__TUNIT____-LABEL: define {{[^@]+}}@caller_middle
Johannes Doerfert25de3422021-03-11 23:21:32 -0600745; IS__TUNIT____-SAME: () #[[ATTR1]] {
Shinji Okumurab8711cb2020-08-27 16:30:29 +0900746; IS__TUNIT____-NEXT: ret i8 49
sstefan135cfe172020-07-19 21:55:43 +0200747;
sstefan1fd903782020-08-30 10:29:07 +0200748; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
749; IS__CGSCC____-LABEL: define {{[^@]+}}@caller_middle
Johannes Doerfert25de3422021-03-11 23:21:32 -0600750; IS__CGSCC____-SAME: () #[[ATTR1]] {
sstefan1fd903782020-08-30 10:29:07 +0200751; IS__CGSCC____-NEXT: ret i8 49
Johannes Doerfert4647aa02020-02-14 20:11:22 -0600752;
753 %c = call i8 @callee(i8 42)
754 ret i8 %c
755}
756define i8 @caller3() {
sstefan135cfe172020-07-19 21:55:43 +0200757; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
sstefan1a9329d92020-08-29 19:31:13 +0200758; IS__TUNIT____-LABEL: define {{[^@]+}}@caller3
Johannes Doerfert25de3422021-03-11 23:21:32 -0600759; IS__TUNIT____-SAME: () #[[ATTR1]] {
Shinji Okumurab8711cb2020-08-27 16:30:29 +0900760; IS__TUNIT____-NEXT: ret i8 49
sstefan135cfe172020-07-19 21:55:43 +0200761;
sstefan1fd903782020-08-30 10:29:07 +0200762; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
763; IS__CGSCC____-LABEL: define {{[^@]+}}@caller3
Johannes Doerfert25de3422021-03-11 23:21:32 -0600764; IS__CGSCC____-SAME: () #[[ATTR1]] {
sstefan1fd903782020-08-30 10:29:07 +0200765; IS__CGSCC____-NEXT: ret i8 49
Johannes Doerfert4647aa02020-02-14 20:11:22 -0600766;
767 %c = call i8 @callee(i8 undef)
768 ret i8 %c
769}
770define i8 @caller4() {
sstefan135cfe172020-07-19 21:55:43 +0200771; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
sstefan1a9329d92020-08-29 19:31:13 +0200772; IS__TUNIT____-LABEL: define {{[^@]+}}@caller4
Johannes Doerfert25de3422021-03-11 23:21:32 -0600773; IS__TUNIT____-SAME: () #[[ATTR1]] {
Shinji Okumurab8711cb2020-08-27 16:30:29 +0900774; IS__TUNIT____-NEXT: ret i8 49
sstefan135cfe172020-07-19 21:55:43 +0200775;
sstefan1fd903782020-08-30 10:29:07 +0200776; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
777; IS__CGSCC____-LABEL: define {{[^@]+}}@caller4
Johannes Doerfert25de3422021-03-11 23:21:32 -0600778; IS__CGSCC____-SAME: () #[[ATTR1]] {
sstefan1fd903782020-08-30 10:29:07 +0200779; IS__CGSCC____-NEXT: ret i8 49
Johannes Doerfert4647aa02020-02-14 20:11:22 -0600780;
781 %c = call i8 @callee(i8 undef)
782 ret i8 %c
783}
784define internal i8 @callee(i8 %a) {
sstefan135cfe172020-07-19 21:55:43 +0200785; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
sstefan1a9329d92020-08-29 19:31:13 +0200786; IS__CGSCC____-LABEL: define {{[^@]+}}@callee
Johannes Doerfert25de3422021-03-11 23:21:32 -0600787; IS__CGSCC____-SAME: () #[[ATTR1]] {
sstefan1fd903782020-08-30 10:29:07 +0200788; IS__CGSCC____-NEXT: ret i8 undef
Johannes Doerfert4647aa02020-02-14 20:11:22 -0600789;
790 %c = add i8 %a, 7
791 ret i8 %c
792}
793
Johannes Doerfertfedbd3b2020-09-09 16:08:20 -0500794
795define i1 @icmp() {
796; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
797; IS__TUNIT____-LABEL: define {{[^@]+}}@icmp
Johannes Doerfert25de3422021-03-11 23:21:32 -0600798; IS__TUNIT____-SAME: () #[[ATTR1]] {
Johannes Doerfertfedbd3b2020-09-09 16:08:20 -0500799; IS__TUNIT____-NEXT: ret i1 true
800;
801; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
802; IS__CGSCC____-LABEL: define {{[^@]+}}@icmp
Johannes Doerfert25de3422021-03-11 23:21:32 -0600803; IS__CGSCC____-SAME: () #[[ATTR1]] {
Johannes Doerfertfedbd3b2020-09-09 16:08:20 -0500804; IS__CGSCC____-NEXT: ret i1 true
805;
806 %c = icmp eq i8* null, null
807 ret i1 %c
808}
Johannes Doerfert25de3422021-03-11 23:21:32 -0600809;.
810; IS__TUNIT_OPM: attributes #[[ATTR0]] = { nofree nosync nounwind willreturn }
811; IS__TUNIT_OPM: attributes #[[ATTR1]] = { nofree nosync nounwind readnone willreturn }
812; IS__TUNIT_OPM: attributes #[[ATTR2]] = { argmemonly nofree nosync nounwind willreturn writeonly }
813; IS__TUNIT_OPM: attributes #[[ATTR3]] = { nofree nosync nounwind readonly willreturn }
814; IS__TUNIT_OPM: attributes #[[ATTR4]] = { argmemonly nofree nosync nounwind writeonly }
815; IS__TUNIT_OPM: attributes #[[ATTR5]] = { willreturn }
816; IS__TUNIT_OPM: attributes #[[ATTR6]] = { nofree nosync nounwind willreturn writeonly }
817;.
818; IS__TUNIT_NPM: attributes #[[ATTR0]] = { nofree nosync nounwind willreturn }
819; IS__TUNIT_NPM: attributes #[[ATTR1]] = { nofree nosync nounwind readnone willreturn }
820; IS__TUNIT_NPM: attributes #[[ATTR2]] = { argmemonly nofree nosync nounwind willreturn writeonly }
821; IS__TUNIT_NPM: attributes #[[ATTR3]] = { nofree nosync nounwind readonly willreturn }
822; IS__TUNIT_NPM: attributes #[[ATTR4]] = { willreturn }
823; IS__TUNIT_NPM: attributes #[[ATTR5]] = { nofree nosync nounwind willreturn writeonly }
824;.
825; IS__CGSCC_OPM: attributes #[[ATTR0]] = { nofree nosync nounwind willreturn }
826; IS__CGSCC_OPM: attributes #[[ATTR1]] = { nofree norecurse nosync nounwind readnone willreturn }
827; IS__CGSCC_OPM: attributes #[[ATTR2]] = { argmemonly nofree norecurse nosync nounwind willreturn writeonly }
828; IS__CGSCC_OPM: attributes #[[ATTR3]] = { nofree norecurse nosync nounwind readonly willreturn }
829; IS__CGSCC_OPM: attributes #[[ATTR4]] = { argmemonly nofree norecurse nosync nounwind writeonly }
Johannes Doerfert979d5c62021-01-05 16:55:54 -0600830; IS__CGSCC_OPM: attributes #[[ATTR5]] = { readnone willreturn }
831; IS__CGSCC_OPM: attributes #[[ATTR6]] = { willreturn }
832; IS__CGSCC_OPM: attributes #[[ATTR7]] = { nounwind readnone willreturn }
833; IS__CGSCC_OPM: attributes #[[ATTR8]] = { readonly willreturn }
Johannes Doerfert25de3422021-03-11 23:21:32 -0600834;.
835; IS__CGSCC_NPM: attributes #[[ATTR0]] = { nofree nosync nounwind willreturn }
836; IS__CGSCC_NPM: attributes #[[ATTR1]] = { nofree norecurse nosync nounwind readnone willreturn }
837; IS__CGSCC_NPM: attributes #[[ATTR2]] = { argmemonly nofree norecurse nosync nounwind willreturn writeonly }
838; IS__CGSCC_NPM: attributes #[[ATTR3]] = { nofree norecurse nosync nounwind readonly willreturn }
Johannes Doerfert979d5c62021-01-05 16:55:54 -0600839; IS__CGSCC_NPM: attributes #[[ATTR4]] = { readnone willreturn }
840; IS__CGSCC_NPM: attributes #[[ATTR5]] = { willreturn }
841; IS__CGSCC_NPM: attributes #[[ATTR6]] = { nounwind readnone willreturn }
842; IS__CGSCC_NPM: attributes #[[ATTR7]] = { readonly willreturn }
Johannes Doerfert25de3422021-03-11 23:21:32 -0600843;.