1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
2; 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
4; 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
5; 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
6
7target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
8declare void @f(i32)
9declare token @llvm.call.preallocated.setup(i32)
10declare i8* @llvm.call.preallocated.arg(token, i32)
11
12; Test1: Replace argument with constant
13;.
14; CHECK: @[[S:[a-zA-Z0-9_$"\\.-]+]] = external global [[STRUCT_X:%.*]]
15;.
16define internal void @test1(i32 %a) {
17; CHECK-LABEL: define {{[^@]+}}@test1() {
18; CHECK-NEXT:    tail call void @f(i32 noundef 1)
19; CHECK-NEXT:    ret void
20;
21  tail call void @f(i32 %a)
22  ret void
23}
24
25define void @test1_helper() {
26; CHECK-LABEL: define {{[^@]+}}@test1_helper() {
27; CHECK-NEXT:    tail call void @test1()
28; CHECK-NEXT:    ret void
29;
30  tail call void @test1(i32 1)
31  ret void
32}
33
34; TEST 2 : Simplify return value
35define i32 @return0() {
36; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
37; IS__TUNIT____-LABEL: define {{[^@]+}}@return0
38; IS__TUNIT____-SAME: () #[[ATTR1:[0-9]+]] {
39; IS__TUNIT____-NEXT:    ret i32 0
40;
41; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
42; IS__CGSCC____-LABEL: define {{[^@]+}}@return0
43; IS__CGSCC____-SAME: () #[[ATTR1:[0-9]+]] {
44; IS__CGSCC____-NEXT:    ret i32 0
45;
46  ret i32 0
47}
48
49define i32 @return1() {
50; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
51; IS__TUNIT____-LABEL: define {{[^@]+}}@return1
52; IS__TUNIT____-SAME: () #[[ATTR1]] {
53; IS__TUNIT____-NEXT:    ret i32 1
54;
55; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
56; IS__CGSCC____-LABEL: define {{[^@]+}}@return1
57; IS__CGSCC____-SAME: () #[[ATTR1]] {
58; IS__CGSCC____-NEXT:    ret i32 1
59;
60  ret i32 1
61}
62
63define i32 @test2_1(i1 %c) {
64; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
65; IS__TUNIT____-LABEL: define {{[^@]+}}@test2_1
66; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
67; 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
79; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
80; 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
89;
90  br i1 %c, label %if.true, label %if.false
91if.true:
92  %call = tail call i32 @return0()
93  %ret0 = add i32 %call, 1
94  br label %end
95if.false:
96  %ret1 = tail call i32 @return1()
97  br label %end
98end:
99
100  %ret = phi i32 [ %ret0, %if.true ], [ %ret1, %if.false ]
101
102  ret i32 1
103}
104
105
106
107define i32 @test2_2(i1 %c) {
108; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
109; IS__TUNIT____-LABEL: define {{[^@]+}}@test2_2
110; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
111; 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
115; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
116; IS__CGSCC____-NEXT:    ret i32 1
117;
118  %ret = tail call i32 @test2_1(i1 %c)
119  ret i32 %ret
120}
121
122declare void @use(i32)
123define void @test3(i1 %c) {
124; CHECK-LABEL: define {{[^@]+}}@test3
125; CHECK-SAME: (i1 [[C:%.*]]) {
126; 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]] ]
133; CHECK-NEXT:    tail call void @use(i32 noundef 1)
134; CHECK-NEXT:    ret void
135;
136  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
144  %r = phi i32 [ 1, %if.true ], [ %ret1, %if.false ]
145
146  tail call void @use(i32 %r)
147  ret void
148}
149
150define void @test-select-phi(i1 %c) {
151; CHECK-LABEL: define {{[^@]+}}@test-select-phi
152; CHECK-SAME: (i1 [[C:%.*]]) {
153; CHECK-NEXT:    tail call void @use(i32 noundef 1)
154; CHECK-NEXT:    [[SELECT_NOT_SAME:%.*]] = select i1 [[C]], i32 1, i32 0
155; CHECK-NEXT:    tail call void @use(i32 noundef [[SELECT_NOT_SAME]])
156; 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
167; 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)
170; 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;
174  %select-same = select i1 %c, i32 1, i32 1
175  tail call void @use(i32 %select-same)
176
177  %select-not-same = select i1 %c, i32 1, i32 0
178  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
192  tail call void @use(i32 %phi-same)
193
194  tail call void @use(i32 %phi-not-same)
195
196  tail call void @use(i32 %phi-same-prop)
197
198  tail call void @use(i32 %phi-same-undef)
199
200  tail call void @use(i32 %select-not-same-undef)
201
202  ret void
203
204}
205
206define i32 @ipccp1(i32 %a) {
207; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
208; IS__TUNIT____-LABEL: define {{[^@]+}}@ipccp1
209; IS__TUNIT____-SAME: (i32 returned [[A:%.*]]) #[[ATTR1]] {
210; 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
218; IS__CGSCC____-SAME: (i32 returned [[A:%.*]]) #[[ATTR1]] {
219; 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
224;
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) {
234; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
235; IS__CGSCC____-LABEL: define {{[^@]+}}@ipccp2i
236; IS__CGSCC____-SAME: () #[[ATTR1]] {
237; IS__CGSCC____-NEXT:    br label [[T:%.*]]
238; IS__CGSCC____:       t:
239; IS__CGSCC____-NEXT:    ret i1 undef
240; IS__CGSCC____:       f:
241; IS__CGSCC____-NEXT:    unreachable
242;
243  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() {
252; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
253; IS__TUNIT____-LABEL: define {{[^@]+}}@ipccp2
254; IS__TUNIT____-SAME: () #[[ATTR1]] {
255; IS__TUNIT____-NEXT:    ret i1 true
256;
257; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
258; IS__CGSCC____-LABEL: define {{[^@]+}}@ipccp2
259; IS__CGSCC____-SAME: () #[[ATTR1]] {
260; IS__CGSCC____-NEXT:    ret i1 true
261;
262  %r = call i1 @ipccp2i(i1 true)
263  ret i1 %r
264}
265
266define internal i1 @ipccp2ib(i1 %a) {
267; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
268; IS__CGSCC____-LABEL: define {{[^@]+}}@ipccp2ib
269; IS__CGSCC____-SAME: () #[[ATTR1]] {
270; IS__CGSCC____-NEXT:    br label [[T:%.*]]
271; IS__CGSCC____:       t:
272; IS__CGSCC____-NEXT:    ret i1 undef
273; IS__CGSCC____:       f:
274; IS__CGSCC____-NEXT:    unreachable
275;
276  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() {
285; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
286; IS__TUNIT____-LABEL: define {{[^@]+}}@ipccp2b
287; IS__TUNIT____-SAME: () #[[ATTR1]] {
288; IS__TUNIT____-NEXT:    ret i1 true
289;
290; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
291; IS__CGSCC____-LABEL: define {{[^@]+}}@ipccp2b
292; IS__CGSCC____-SAME: () #[[ATTR1]] {
293; IS__CGSCC____-NEXT:    ret i1 true
294;
295  %r = call i1 @ipccp2ib(i1 true)
296  ret i1 %r
297}
298
299define internal i32 @ipccp3i(i32 %a) {
300; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
301; IS__CGSCC____-LABEL: define {{[^@]+}}@ipccp3i
302; IS__CGSCC____-SAME: () #[[ATTR1]] {
303; IS__CGSCC____-NEXT:    br label [[T:%.*]]
304; IS__CGSCC____:       t:
305; IS__CGSCC____-NEXT:    ret i32 undef
306; IS__CGSCC____:       f:
307; IS__CGSCC____-NEXT:    unreachable
308;
309  %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() {
319; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
320; IS__TUNIT____-LABEL: define {{[^@]+}}@ipccp3
321; IS__TUNIT____-SAME: () #[[ATTR1]] {
322; IS__TUNIT____-NEXT:    ret i32 7
323;
324; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
325; IS__CGSCC____-LABEL: define {{[^@]+}}@ipccp3
326; IS__CGSCC____-SAME: () #[[ATTR1]] {
327; IS__CGSCC____-NEXT:    ret i32 7
328;
329  %r = call i32 @ipccp3i(i32 7)
330  ret i32 %r
331}
332
333; Do not touch complicated arguments (for now)
334%struct.X = type { i8* }
335define internal i32* @test_inalloca(i32* inalloca %a) {
336; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
337; IS__TUNIT____-LABEL: define {{[^@]+}}@test_inalloca
338; IS__TUNIT____-SAME: (i32* inalloca noalias nofree nonnull returned writeonly dereferenceable(4) "no-capture-maybe-returned" [[A:%.*]]) #[[ATTR1]] {
339; 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
343; IS__CGSCC____-SAME: (i32* inalloca noalias nofree noundef nonnull returned writeonly dereferenceable(4) "no-capture-maybe-returned" [[A:%.*]]) #[[ATTR1]] {
344; IS__CGSCC____-NEXT:    ret i32* [[A]]
345;
346  ret i32* %a
347}
348define i32* @complicated_args_inalloca(i32* %arg) {
349; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
350; IS__TUNIT____-LABEL: define {{[^@]+}}@complicated_args_inalloca
351; 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]]
353; IS__TUNIT____-NEXT:    ret i32* [[CALL]]
354;
355; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
356; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@complicated_args_inalloca
357; 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]+]]
359; 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
363; 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]+]]
365; IS__CGSCC_NPM-NEXT:    ret i32* [[CALL]]
366;
367  %call = call i32* @test_inalloca(i32* %arg)
368  ret i32* %call
369}
370
371define internal i32* @test_preallocated(i32* preallocated(i32) %a) {
372; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
373; IS__TUNIT____-LABEL: define {{[^@]+}}@test_preallocated
374; IS__TUNIT____-SAME: (i32* noalias nofree noundef nonnull returned writeonly preallocated(i32) align 536870912 dereferenceable(4) "no-capture-maybe-returned" [[A:%.*]]) #[[ATTR1]] {
375; 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
379; IS__CGSCC____-SAME: (i32* noalias nofree noundef nonnull returned writeonly preallocated(i32) align 536870912 dereferenceable(4) "no-capture-maybe-returned" [[A:%.*]]) #[[ATTR1]] {
380; IS__CGSCC____-NEXT:    ret i32* [[A]]
381;
382  ret i32* %a
383}
384define i32* @complicated_args_preallocated() {
385; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind willreturn
386; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@complicated_args_preallocated
387; 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]]) ]
390; IS__TUNIT_OPM-NEXT:    ret i32* [[CALL]]
391;
392; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind willreturn
393; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@complicated_args_preallocated
394; 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]]) ]
397; IS__TUNIT_NPM-NEXT:    ret i32* [[CALL]]
398;
399; IS__CGSCC_OPM: Function Attrs: nofree nosync nounwind willreturn
400; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@complicated_args_preallocated
401; IS__CGSCC_OPM-SAME: () #[[ATTR0:[0-9]+]] {
402; 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]]) ]
404; IS__CGSCC_OPM-NEXT:    ret i32* [[CALL]]
405;
406; IS__CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
407; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@complicated_args_preallocated
408; IS__CGSCC_NPM-SAME: () #[[ATTR0:[0-9]+]] {
409; 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]]) ]
411; IS__CGSCC_NPM-NEXT:    ret i32* [[CALL]]
412;
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
418define internal void @test_sret(%struct.X* sret(%struct.X) %a, %struct.X** %b) {
419;
420; IS__TUNIT____: Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly
421; IS__TUNIT____-LABEL: define {{[^@]+}}@test_sret
422; 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]+]] {
423; 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
428; 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]+]] {
429; IS__CGSCC____-NEXT:    store %struct.X* [[A]], %struct.X** [[B]], align 8
430; IS__CGSCC____-NEXT:    ret void
431;
432  store %struct.X* %a, %struct.X** %b
433  ret void
434}
435; FIXME: Alignment and dereferenceability are not propagated to the argument
436define void @complicated_args_sret(%struct.X** %b) {
437;
438; IS__TUNIT_OPM: Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly
439; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@complicated_args_sret
440; 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]+]]
442; 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
446; 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]+]]
448; IS__TUNIT_NPM-NEXT:    ret void
449;
450; IS__CGSCC____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
451; IS__CGSCC____-LABEL: define {{[^@]+}}@complicated_args_sret
452; IS__CGSCC____-SAME: (%struct.X** nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[B:%.*]]) #[[ATTR2]] {
453; IS__CGSCC____-NEXT:    unreachable
454;
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) {
460; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
461; IS__TUNIT____-LABEL: define {{[^@]+}}@test_nest
462; IS__TUNIT____-SAME: (%struct.X* nest noalias nofree noundef readnone returned align 536870912 "no-capture-maybe-returned" [[A:%.*]]) #[[ATTR1]] {
463; 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
467; IS__CGSCC____-SAME: (%struct.X* nest noalias nofree noundef readnone returned align 536870912 "no-capture-maybe-returned" [[A:%.*]]) #[[ATTR1]] {
468; IS__CGSCC____-NEXT:    ret %struct.X* [[A]]
469;
470  ret %struct.X* %a
471}
472define %struct.X* @complicated_args_nest() {
473; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
474; IS__TUNIT____-LABEL: define {{[^@]+}}@complicated_args_nest
475; 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]]
477; IS__TUNIT____-NEXT:    ret %struct.X* [[CALL]]
478;
479; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
480; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@complicated_args_nest
481; 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]]
483; 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
487; 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]]
489; IS__CGSCC_NPM-NEXT:    ret %struct.X* [[CALL]]
490;
491  %call = call %struct.X* @test_nest(%struct.X* null)
492  ret %struct.X* %call
493}
494
495@S = external global %struct.X
496define internal void @test_byval(%struct.X* byval(%struct.X) %a) {
497; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
498; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@test_byval
499; 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
501; IS__CGSCC_OPM-NEXT:    store i8* null, i8** [[G0]], align 8
502; IS__CGSCC_OPM-NEXT:    ret void
503;
504; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
505; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@test_byval
506; IS__CGSCC_NPM-SAME: (i8* noalias nocapture nofree readnone [[TMP0:%.*]]) #[[ATTR1]] {
507; IS__CGSCC_NPM-NEXT:    [[A_PRIV:%.*]] = alloca [[STRUCT_X:%.*]], align 8
508; IS__CGSCC_NPM-NEXT:    [[A_PRIV_CAST:%.*]] = bitcast %struct.X* [[A_PRIV]] to i8**
509; IS__CGSCC_NPM-NEXT:    store i8* [[TMP0]], i8** [[A_PRIV_CAST]], align 8
510; 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;
514  %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() {
519; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
520; IS__TUNIT____-LABEL: define {{[^@]+}}@complicated_args_byval
521; IS__TUNIT____-SAME: () #[[ATTR1]] {
522; IS__TUNIT____-NEXT:    ret void
523;
524; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
525; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@complicated_args_byval
526; IS__CGSCC_OPM-SAME: () #[[ATTR1]] {
527; IS__CGSCC_OPM-NEXT:    ret void
528;
529; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readonly willreturn
530; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@complicated_args_byval
531; IS__CGSCC_NPM-SAME: () #[[ATTR3:[0-9]+]] {
532; IS__CGSCC_NPM-NEXT:    ret void
533;
534  call void @test_byval(%struct.X* @S)
535  ret void
536}
537
538define internal i8*@test_byval2(%struct.X* byval(%struct.X) %a) {
539; IS__TUNIT____: Function Attrs: nofree nosync nounwind readonly willreturn
540; IS__TUNIT____-LABEL: define {{[^@]+}}@test_byval2
541; IS__TUNIT____-SAME: () #[[ATTR3:[0-9]+]] {
542; 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
547; IS__CGSCC____-LABEL: define {{[^@]+}}@test_byval2
548; IS__CGSCC____-SAME: () #[[ATTR3:[0-9]+]] {
549; 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]]
552;
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() {
558; IS__TUNIT____: Function Attrs: nofree nosync nounwind readonly willreturn
559; IS__TUNIT____-LABEL: define {{[^@]+}}@complicated_args_byval2
560; IS__TUNIT____-SAME: () #[[ATTR3]] {
561; IS__TUNIT____-NEXT:    [[C:%.*]] = call i8* @test_byval2() #[[ATTR3]]
562; IS__TUNIT____-NEXT:    ret i8* [[C]]
563;
564; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readonly willreturn
565; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@complicated_args_byval2
566; IS__CGSCC_OPM-SAME: () #[[ATTR3]] {
567; IS__CGSCC_OPM-NEXT:    [[C:%.*]] = call i8* @test_byval2() #[[ATTR8:[0-9]+]]
568; 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
572; IS__CGSCC_NPM-SAME: () #[[ATTR3]] {
573; IS__CGSCC_NPM-NEXT:    [[C:%.*]] = call i8* @test_byval2() #[[ATTR7:[0-9]+]]
574; IS__CGSCC_NPM-NEXT:    ret i8* [[C]]
575;
576  %c = call i8* @test_byval2(%struct.X* @S)
577  ret i8* %c
578}
579
580define void @fixpoint_changed(i32* %p) {
581; IS__TUNIT_OPM: Function Attrs: argmemonly nofree nosync nounwind writeonly
582; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@fixpoint_changed
583; IS__TUNIT_OPM-SAME: (i32* nocapture nofree writeonly [[P:%.*]]) #[[ATTR4:[0-9]+]] {
584; 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
606; IS__TUNIT_NPM-SAME: (i32* nocapture nofree writeonly [[P:%.*]]) #[[ATTR2]] {
607; 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
629; IS__CGSCC_OPM-SAME: (i32* nocapture nofree writeonly [[P:%.*]]) #[[ATTR4:[0-9]+]] {
630; 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
652; IS__CGSCC_NPM-SAME: (i32* nocapture nofree writeonly [[P:%.*]]) #[[ATTR2]] {
653; 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
672;
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
699; Check we merge undef and a constant properly.
700define i8 @caller0() {
701; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
702; IS__TUNIT____-LABEL: define {{[^@]+}}@caller0
703; IS__TUNIT____-SAME: () #[[ATTR1]] {
704; IS__TUNIT____-NEXT:    ret i8 49
705;
706; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
707; IS__CGSCC____-LABEL: define {{[^@]+}}@caller0
708; IS__CGSCC____-SAME: () #[[ATTR1]] {
709; IS__CGSCC____-NEXT:    ret i8 49
710;
711  %c = call i8 @callee(i8 undef)
712  ret i8 %c
713}
714define i8 @caller1() {
715; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
716; IS__TUNIT____-LABEL: define {{[^@]+}}@caller1
717; IS__TUNIT____-SAME: () #[[ATTR1]] {
718; IS__TUNIT____-NEXT:    ret i8 49
719;
720; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
721; IS__CGSCC____-LABEL: define {{[^@]+}}@caller1
722; IS__CGSCC____-SAME: () #[[ATTR1]] {
723; IS__CGSCC____-NEXT:    ret i8 49
724;
725  %c = call i8 @callee(i8 undef)
726  ret i8 %c
727}
728define i8 @caller2() {
729; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
730; IS__TUNIT____-LABEL: define {{[^@]+}}@caller2
731; IS__TUNIT____-SAME: () #[[ATTR1]] {
732; IS__TUNIT____-NEXT:    ret i8 49
733;
734; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
735; IS__CGSCC____-LABEL: define {{[^@]+}}@caller2
736; IS__CGSCC____-SAME: () #[[ATTR1]] {
737; IS__CGSCC____-NEXT:    ret i8 49
738;
739  %c = call i8 @callee(i8 undef)
740  ret i8 %c
741}
742define i8 @caller_middle() {
743; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
744; IS__TUNIT____-LABEL: define {{[^@]+}}@caller_middle
745; IS__TUNIT____-SAME: () #[[ATTR1]] {
746; IS__TUNIT____-NEXT:    ret i8 49
747;
748; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
749; IS__CGSCC____-LABEL: define {{[^@]+}}@caller_middle
750; IS__CGSCC____-SAME: () #[[ATTR1]] {
751; IS__CGSCC____-NEXT:    ret i8 49
752;
753  %c = call i8 @callee(i8 42)
754  ret i8 %c
755}
756define i8 @caller3() {
757; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
758; IS__TUNIT____-LABEL: define {{[^@]+}}@caller3
759; IS__TUNIT____-SAME: () #[[ATTR1]] {
760; IS__TUNIT____-NEXT:    ret i8 49
761;
762; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
763; IS__CGSCC____-LABEL: define {{[^@]+}}@caller3
764; IS__CGSCC____-SAME: () #[[ATTR1]] {
765; IS__CGSCC____-NEXT:    ret i8 49
766;
767  %c = call i8 @callee(i8 undef)
768  ret i8 %c
769}
770define i8 @caller4() {
771; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
772; IS__TUNIT____-LABEL: define {{[^@]+}}@caller4
773; IS__TUNIT____-SAME: () #[[ATTR1]] {
774; IS__TUNIT____-NEXT:    ret i8 49
775;
776; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
777; IS__CGSCC____-LABEL: define {{[^@]+}}@caller4
778; IS__CGSCC____-SAME: () #[[ATTR1]] {
779; IS__CGSCC____-NEXT:    ret i8 49
780;
781  %c = call i8 @callee(i8 undef)
782  ret i8 %c
783}
784define internal i8 @callee(i8 %a) {
785; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
786; IS__CGSCC____-LABEL: define {{[^@]+}}@callee
787; IS__CGSCC____-SAME: () #[[ATTR1]] {
788; IS__CGSCC____-NEXT:    ret i8 undef
789;
790  %c = add i8 %a, 7
791  ret i8 %c
792}
793
794
795define i1 @icmp() {
796; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
797; IS__TUNIT____-LABEL: define {{[^@]+}}@icmp
798; IS__TUNIT____-SAME: () #[[ATTR1]] {
799; IS__TUNIT____-NEXT:    ret i1 true
800;
801; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
802; IS__CGSCC____-LABEL: define {{[^@]+}}@icmp
803; IS__CGSCC____-SAME: () #[[ATTR1]] {
804; IS__CGSCC____-NEXT:    ret i1 true
805;
806  %c = icmp eq i8* null, null
807  ret i1 %c
808}
809;.
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 }
830; 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 }
834;.
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 }
839; 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 }
843;.
844