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@ConstAS3Ptr = addrspace(3) global i32 0, align 4
13
14;.
15; CHECK: @[[CONSTAS3PTR:[a-zA-Z0-9_$"\\.-]+]] = addrspace(3) global i32 0, align 4
16; CHECK: @[[S:[a-zA-Z0-9_$"\\.-]+]] = external global [[STRUCT_X:%.*]]
17; CHECK: @[[G:[a-zA-Z0-9_$"\\.-]+]] = internal constant { [2 x i8*] } { [2 x i8*] [i8* bitcast (void (i8***)* @f1 to i8*), i8* bitcast (void (i1 (i8*)*)* @f2 to i8*)] }
18;.
19define internal i32 addrspace(3)* @const_ptr_return_as3() {
20; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
21; IS__CGSCC____-LABEL: define {{[^@]+}}@const_ptr_return_as3
22; IS__CGSCC____-SAME: () #[[ATTR1:[0-9]+]] {
23; IS__CGSCC____-NEXT:    ret i32 addrspace(3)* undef
24;
25  ret i32 addrspace(3)* @ConstAS3Ptr
26}
27define internal i32* @const_ptr_return() {
28; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
29; IS__CGSCC____-LABEL: define {{[^@]+}}@const_ptr_return
30; IS__CGSCC____-SAME: () #[[ATTR1]] {
31; IS__CGSCC____-NEXT:    ret i32* undef
32;
33  ret i32* addrspacecast (i32 addrspace(3)* @ConstAS3Ptr to i32*)
34}
35
36; Test1: Replace argument with constant
37define internal void @test1(i32 %a) {
38; CHECK-LABEL: define {{[^@]+}}@test1() {
39; CHECK-NEXT:    tail call void @f(i32 noundef 1)
40; CHECK-NEXT:    ret void
41;
42  tail call void @f(i32 %a)
43  ret void
44}
45
46define void @test1_helper() {
47; CHECK-LABEL: define {{[^@]+}}@test1_helper() {
48; CHECK-NEXT:    tail call void @test1()
49; CHECK-NEXT:    ret void
50;
51  tail call void @test1(i32 1)
52  ret void
53}
54
55; TEST 2 : Simplify return value
56define i32 @return0() {
57; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
58; CHECK-LABEL: define {{[^@]+}}@return0
59; CHECK-SAME: () #[[ATTR1:[0-9]+]] {
60; CHECK-NEXT:    ret i32 0
61;
62  ret i32 0
63}
64
65define i32 @return1() {
66; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
67; CHECK-LABEL: define {{[^@]+}}@return1
68; CHECK-SAME: () #[[ATTR1]] {
69; CHECK-NEXT:    ret i32 1
70;
71  ret i32 1
72}
73
74define i32 @test2_1(i1 %c) {
75; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
76; CHECK-LABEL: define {{[^@]+}}@test2_1
77; CHECK-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
78; CHECK-NEXT:    br i1 [[C]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
79; CHECK:       if.true:
80; CHECK-NEXT:    [[RET0:%.*]] = add i32 0, 1
81; CHECK-NEXT:    br label [[END:%.*]]
82; CHECK:       if.false:
83; CHECK-NEXT:    br label [[END]]
84; CHECK:       end:
85; CHECK-NEXT:    [[RET:%.*]] = phi i32 [ [[RET0]], [[IF_TRUE]] ], [ 1, [[IF_FALSE]] ]
86; CHECK-NEXT:    ret i32 1
87;
88  br i1 %c, label %if.true, label %if.false
89if.true:
90  %call = tail call i32 @return0()
91  %ret0 = add i32 %call, 1
92  br label %end
93if.false:
94  %ret1 = tail call i32 @return1()
95  br label %end
96end:
97
98  %ret = phi i32 [ %ret0, %if.true ], [ %ret1, %if.false ]
99
100  ret i32 1
101}
102
103
104
105define i32 @test2_2(i1 %c) {
106; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
107; CHECK-LABEL: define {{[^@]+}}@test2_2
108; CHECK-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
109; CHECK-NEXT:    ret i32 1
110;
111  %ret = tail call i32 @test2_1(i1 %c)
112  ret i32 %ret
113}
114
115declare void @use(i32)
116define void @test3(i1 %c) {
117; CHECK-LABEL: define {{[^@]+}}@test3
118; CHECK-SAME: (i1 [[C:%.*]]) {
119; CHECK-NEXT:    br i1 [[C]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
120; CHECK:       if.true:
121; CHECK-NEXT:    br label [[END:%.*]]
122; CHECK:       if.false:
123; CHECK-NEXT:    br label [[END]]
124; CHECK:       end:
125; CHECK-NEXT:    [[R:%.*]] = phi i32 [ 1, [[IF_TRUE]] ], [ 1, [[IF_FALSE]] ]
126; CHECK-NEXT:    tail call void @use(i32 noundef 1)
127; CHECK-NEXT:    ret void
128;
129  br i1 %c, label %if.true, label %if.false
130if.true:
131  br label %end
132if.false:
133  %ret1 = tail call i32 @return1()
134  br label %end
135end:
136
137  %r = phi i32 [ 1, %if.true ], [ %ret1, %if.false ]
138
139  tail call void @use(i32 %r)
140  ret void
141}
142
143define void @test-select-phi(i1 %c) {
144; CHECK-LABEL: define {{[^@]+}}@test-select-phi
145; CHECK-SAME: (i1 [[C:%.*]]) {
146; CHECK-NEXT:    tail call void @use(i32 noundef 1)
147; CHECK-NEXT:    [[SELECT_NOT_SAME:%.*]] = select i1 [[C]], i32 1, i32 0
148; CHECK-NEXT:    tail call void @use(i32 noundef [[SELECT_NOT_SAME]])
149; CHECK-NEXT:    br i1 [[C]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
150; CHECK:       if-true:
151; CHECK-NEXT:    br label [[END:%.*]]
152; CHECK:       if-false:
153; CHECK-NEXT:    br label [[END]]
154; CHECK:       end:
155; CHECK-NEXT:    [[PHI_SAME:%.*]] = phi i32 [ 1, [[IF_TRUE]] ], [ 1, [[IF_FALSE]] ]
156; CHECK-NEXT:    [[PHI_NOT_SAME:%.*]] = phi i32 [ 0, [[IF_TRUE]] ], [ 1, [[IF_FALSE]] ]
157; CHECK-NEXT:    [[PHI_SAME_PROP:%.*]] = phi i32 [ 1, [[IF_TRUE]] ], [ 1, [[IF_FALSE]] ]
158; CHECK-NEXT:    [[PHI_SAME_UNDEF:%.*]] = phi i32 [ 1, [[IF_TRUE]] ], [ undef, [[IF_FALSE]] ]
159; CHECK-NEXT:    [[SELECT_NOT_SAME_UNDEF:%.*]] = select i1 [[C]], i32 [[PHI_NOT_SAME]], i32 undef
160; CHECK-NEXT:    tail call void @use(i32 noundef 1)
161; CHECK-NEXT:    tail call void @use(i32 noundef [[PHI_NOT_SAME]])
162; CHECK-NEXT:    tail call void @use(i32 noundef 1)
163; CHECK-NEXT:    tail call void @use(i32 1)
164; CHECK-NEXT:    tail call void @use(i32 [[SELECT_NOT_SAME_UNDEF]])
165; CHECK-NEXT:    ret void
166;
167  %select-same = select i1 %c, i32 1, i32 1
168  tail call void @use(i32 %select-same)
169
170  %select-not-same = select i1 %c, i32 1, i32 0
171  tail call void @use(i32 %select-not-same)
172  br i1 %c, label %if-true, label %if-false
173if-true:
174  br label %end
175if-false:
176  br label %end
177end:
178  %phi-same = phi i32 [ 1, %if-true ], [ 1, %if-false ]
179  %phi-not-same = phi i32 [ 0, %if-true ], [ 1, %if-false ]
180  %phi-same-prop = phi i32 [ 1, %if-true ], [ %select-same, %if-false ]
181  %phi-same-undef = phi i32 [ 1, %if-true ], [ undef, %if-false ]
182  %select-not-same-undef = select i1 %c, i32 %phi-not-same, i32 undef
183
184
185  tail call void @use(i32 %phi-same)
186
187  tail call void @use(i32 %phi-not-same)
188
189  tail call void @use(i32 %phi-same-prop)
190
191  tail call void @use(i32 %phi-same-undef)
192
193  tail call void @use(i32 %select-not-same-undef)
194
195  ret void
196
197}
198
199define i32 @ipccp1(i32 %a) {
200; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
201; CHECK-LABEL: define {{[^@]+}}@ipccp1
202; CHECK-SAME: (i32 returned [[A:%.*]]) #[[ATTR1]] {
203; CHECK-NEXT:    br i1 true, label [[T:%.*]], label [[F:%.*]]
204; CHECK:       t:
205; CHECK-NEXT:    ret i32 [[A]]
206; CHECK:       f:
207; CHECK-NEXT:    unreachable
208;
209  br i1 true, label %t, label %f
210t:
211  ret i32 %a
212f:
213  %r = call i32 @ipccp1(i32 5)
214  ret i32 %r
215}
216
217define internal i1 @ipccp2i(i1 %a) {
218; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
219; IS__CGSCC____-LABEL: define {{[^@]+}}@ipccp2i
220; IS__CGSCC____-SAME: () #[[ATTR1]] {
221; IS__CGSCC____-NEXT:    br label [[T:%.*]]
222; IS__CGSCC____:       t:
223; IS__CGSCC____-NEXT:    ret i1 undef
224; IS__CGSCC____:       f:
225; IS__CGSCC____-NEXT:    unreachable
226;
227  br i1 %a, label %t, label %f
228t:
229  ret i1 %a
230f:
231  %r = call i1 @ipccp2i(i1 false)
232  ret i1 %r
233}
234
235define i1 @ipccp2() {
236; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
237; CHECK-LABEL: define {{[^@]+}}@ipccp2
238; CHECK-SAME: () #[[ATTR1]] {
239; CHECK-NEXT:    ret i1 true
240;
241  %r = call i1 @ipccp2i(i1 true)
242  ret i1 %r
243}
244
245define internal i1 @ipccp2ib(i1 %a) {
246; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
247; IS__CGSCC____-LABEL: define {{[^@]+}}@ipccp2ib
248; IS__CGSCC____-SAME: () #[[ATTR1]] {
249; IS__CGSCC____-NEXT:    br label [[T:%.*]]
250; IS__CGSCC____:       t:
251; IS__CGSCC____-NEXT:    ret i1 undef
252; IS__CGSCC____:       f:
253; IS__CGSCC____-NEXT:    unreachable
254;
255  br i1 %a, label %t, label %f
256t:
257  ret i1 true
258f:
259  %r = call i1 @ipccp2ib(i1 false)
260  ret i1 %r
261}
262
263define i1 @ipccp2b() {
264; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
265; CHECK-LABEL: define {{[^@]+}}@ipccp2b
266; CHECK-SAME: () #[[ATTR1]] {
267; CHECK-NEXT:    ret i1 true
268;
269  %r = call i1 @ipccp2ib(i1 true)
270  ret i1 %r
271}
272
273define internal i32 @ipccp3i(i32 %a) {
274; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
275; IS__CGSCC____-LABEL: define {{[^@]+}}@ipccp3i
276; IS__CGSCC____-SAME: () #[[ATTR1]] {
277; IS__CGSCC____-NEXT:    br label [[T:%.*]]
278; IS__CGSCC____:       t:
279; IS__CGSCC____-NEXT:    ret i32 undef
280; IS__CGSCC____:       f:
281; IS__CGSCC____-NEXT:    unreachable
282;
283  %c = icmp eq i32 %a, 7
284  br i1 %c, label %t, label %f
285t:
286  ret i32 %a
287f:
288  %r = call i32 @ipccp3i(i32 5)
289  ret i32 %r
290}
291
292define i32 @ipccp3() {
293; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
294; CHECK-LABEL: define {{[^@]+}}@ipccp3
295; CHECK-SAME: () #[[ATTR1]] {
296; CHECK-NEXT:    ret i32 7
297;
298  %r = call i32 @ipccp3i(i32 7)
299  ret i32 %r
300}
301
302define internal i32 @ipccp4ia(i1 %c) {
303; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
304; IS__CGSCC____-LABEL: define {{[^@]+}}@ipccp4ia
305; IS__CGSCC____-SAME: () #[[ATTR1]] {
306; IS__CGSCC____-NEXT:    br label [[T:%.*]]
307; IS__CGSCC____:       t:
308; IS__CGSCC____-NEXT:    ret i32 undef
309; IS__CGSCC____:       f:
310; IS__CGSCC____-NEXT:    unreachable
311;
312  br i1 %c, label %t, label %f
313t:
314  ret i32 0
315f:
316  ret i32 1
317}
318define internal i32 @ipccp4ib(i32 %a) {
319; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
320; IS__CGSCC____-LABEL: define {{[^@]+}}@ipccp4ib
321; IS__CGSCC____-SAME: () #[[ATTR1]] {
322; IS__CGSCC____-NEXT:    [[C:%.*]] = icmp eq i32 7, 7
323; IS__CGSCC____-NEXT:    br i1 true, label [[T:%.*]], label [[F:%.*]]
324; IS__CGSCC____:       t:
325; IS__CGSCC____-NEXT:    ret i32 undef
326; IS__CGSCC____:       f:
327; IS__CGSCC____-NEXT:    unreachable
328;
329  %c = icmp eq i32 %a, 7
330  br i1 %c, label %t, label %f
331t:
332  %r = call i32 @ipccp4ia(i1 %c)
333  ret i32 %r
334f:
335  ret i32 1
336}
337
338define i32 @ipccp4(i1 %c) {
339; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
340; CHECK-LABEL: define {{[^@]+}}@ipccp4
341; CHECK-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
342; CHECK-NEXT:    br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
343; CHECK:       t:
344; CHECK-NEXT:    br label [[F]]
345; CHECK:       f:
346; CHECK-NEXT:    ret i32 0
347;
348  br i1 %c, label %t, label %f
349t:
350  %q = call i32 @ipccp4ia(i1 undef)
351  br label %f
352f:
353  %r = call i32 @ipccp4ib(i32 7)
354  ret i32 %r
355}
356
357; Do not touch complicated arguments (for now)
358%struct.X = type { i8* }
359define internal i32* @test_inalloca(i32* inalloca(i32) %a) {
360; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
361; IS__TUNIT____-LABEL: define {{[^@]+}}@test_inalloca
362; IS__TUNIT____-SAME: (i32* noalias nofree nonnull returned writeonly inalloca(i32) dereferenceable(4) "no-capture-maybe-returned" [[A:%.*]]) #[[ATTR1]] {
363; IS__TUNIT____-NEXT:    ret i32* [[A]]
364;
365; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
366; IS__CGSCC____-LABEL: define {{[^@]+}}@test_inalloca
367; IS__CGSCC____-SAME: (i32* noalias nofree noundef nonnull returned writeonly inalloca(i32) dereferenceable(4) "no-capture-maybe-returned" [[A:%.*]]) #[[ATTR1]] {
368; IS__CGSCC____-NEXT:    ret i32* [[A]]
369;
370  ret i32* %a
371}
372define i32* @complicated_args_inalloca(i32* %arg) {
373; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
374; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@complicated_args_inalloca
375; IS__TUNIT_OPM-SAME: (i32* nofree readnone "no-capture-maybe-returned" [[ARG:%.*]]) #[[ATTR1]] {
376; IS__TUNIT_OPM-NEXT:    [[CALL:%.*]] = call nonnull dereferenceable(4) i32* @test_inalloca(i32* noalias nofree writeonly inalloca(i32) "no-capture-maybe-returned" [[ARG]]) #[[ATTR5:[0-9]+]]
377; IS__TUNIT_OPM-NEXT:    ret i32* [[CALL]]
378;
379; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
380; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@complicated_args_inalloca
381; IS__TUNIT_NPM-SAME: (i32* nofree readnone "no-capture-maybe-returned" [[ARG:%.*]]) #[[ATTR1]] {
382; IS__TUNIT_NPM-NEXT:    [[CALL:%.*]] = call nonnull dereferenceable(4) i32* @test_inalloca(i32* noalias nofree writeonly inalloca(i32) "no-capture-maybe-returned" [[ARG]]) #[[ATTR4:[0-9]+]]
383; IS__TUNIT_NPM-NEXT:    ret i32* [[CALL]]
384;
385; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
386; IS__CGSCC____-LABEL: define {{[^@]+}}@complicated_args_inalloca
387; IS__CGSCC____-SAME: (i32* nofree noundef nonnull readnone returned dereferenceable(4) "no-capture-maybe-returned" [[ARG:%.*]]) #[[ATTR1]] {
388; IS__CGSCC____-NEXT:    ret i32* [[ARG]]
389;
390  %call = call i32* @test_inalloca(i32* inalloca(i32) %arg)
391  ret i32* %call
392}
393
394define internal i32* @test_preallocated(i32* preallocated(i32) %a) {
395; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
396; CHECK-LABEL: define {{[^@]+}}@test_preallocated
397; CHECK-SAME: (i32* noalias nofree noundef nonnull returned writeonly preallocated(i32) align 4294967296 dereferenceable(4) "no-capture-maybe-returned" [[A:%.*]]) #[[ATTR1]] {
398; CHECK-NEXT:    ret i32* [[A]]
399;
400  ret i32* %a
401}
402define i32* @complicated_args_preallocated() {
403; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind willreturn
404; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@complicated_args_preallocated
405; IS__TUNIT_OPM-SAME: () #[[ATTR0:[0-9]+]] {
406; IS__TUNIT_OPM-NEXT:    [[C:%.*]] = call token @llvm.call.preallocated.setup(i32 noundef 1) #[[ATTR6:[0-9]+]]
407; IS__TUNIT_OPM-NEXT:    [[CALL:%.*]] = call noundef nonnull align 4294967296 dereferenceable(4) i32* @test_preallocated(i32* noalias nocapture nofree noundef writeonly preallocated(i32) align 4294967296 null) #[[ATTR5]] [ "preallocated"(token [[C]]) ]
408; IS__TUNIT_OPM-NEXT:    ret i32* [[CALL]]
409;
410; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind willreturn
411; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@complicated_args_preallocated
412; IS__TUNIT_NPM-SAME: () #[[ATTR0:[0-9]+]] {
413; IS__TUNIT_NPM-NEXT:    [[C:%.*]] = call token @llvm.call.preallocated.setup(i32 noundef 1) #[[ATTR5:[0-9]+]]
414; IS__TUNIT_NPM-NEXT:    [[CALL:%.*]] = call noundef nonnull align 4294967296 dereferenceable(4) i32* @test_preallocated(i32* noalias nocapture nofree noundef writeonly preallocated(i32) align 4294967296 null) #[[ATTR4]] [ "preallocated"(token [[C]]) ]
415; IS__TUNIT_NPM-NEXT:    ret i32* [[CALL]]
416;
417; IS__CGSCC_OPM: Function Attrs: nofree nosync nounwind willreturn
418; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@complicated_args_preallocated
419; IS__CGSCC_OPM-SAME: () #[[ATTR0:[0-9]+]] {
420; IS__CGSCC_OPM-NEXT:    [[C:%.*]] = call token @llvm.call.preallocated.setup(i32 noundef 1) #[[ATTR5:[0-9]+]]
421; IS__CGSCC_OPM-NEXT:    ret i32* null
422;
423; IS__CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
424; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@complicated_args_preallocated
425; IS__CGSCC_NPM-SAME: () #[[ATTR0:[0-9]+]] {
426; IS__CGSCC_NPM-NEXT:    [[C:%.*]] = call token @llvm.call.preallocated.setup(i32 noundef 1) #[[ATTR4:[0-9]+]]
427; IS__CGSCC_NPM-NEXT:    ret i32* null
428;
429  %c = call token @llvm.call.preallocated.setup(i32 1)
430  %call = call i32* @test_preallocated(i32* preallocated(i32) null) ["preallocated"(token %c)]
431  ret i32* %call
432}
433
434define internal void @test_sret(%struct.X* sret(%struct.X) %a, %struct.X** %b) {
435;
436; CHECK: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
437; CHECK-LABEL: define {{[^@]+}}@test_sret
438; CHECK-SAME: (%struct.X* noalias nofree noundef nonnull writeonly sret([[STRUCT_X:%.*]]) align 4294967296 dereferenceable(8) [[A:%.*]], %struct.X** nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[B:%.*]]) #[[ATTR2:[0-9]+]] {
439; CHECK-NEXT:    store %struct.X* [[A]], %struct.X** [[B]], align 8
440; CHECK-NEXT:    ret void
441;
442  store %struct.X* %a, %struct.X** %b
443  ret void
444}
445; FIXME: Alignment and dereferenceability are not propagated to the argument
446define void @complicated_args_sret(%struct.X** %b) {
447;
448;
449; IS__TUNIT_OPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
450; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@complicated_args_sret
451; IS__TUNIT_OPM-SAME: (%struct.X** nocapture nofree writeonly [[B:%.*]]) #[[ATTR2]] {
452; IS__TUNIT_OPM-NEXT:    call void @test_sret(%struct.X* noalias nocapture nofree noundef writeonly sret([[STRUCT_X:%.*]]) align 4294967296 null, %struct.X** nocapture nofree writeonly align 8 [[B]]) #[[ATTR7:[0-9]+]]
453; IS__TUNIT_OPM-NEXT:    ret void
454;
455; IS__TUNIT_NPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
456; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@complicated_args_sret
457; IS__TUNIT_NPM-SAME: (%struct.X** nocapture nofree writeonly [[B:%.*]]) #[[ATTR2]] {
458; IS__TUNIT_NPM-NEXT:    call void @test_sret(%struct.X* noalias nocapture nofree noundef writeonly sret([[STRUCT_X:%.*]]) align 4294967296 null, %struct.X** nocapture nofree writeonly align 8 [[B]]) #[[ATTR6:[0-9]+]]
459; IS__TUNIT_NPM-NEXT:    ret void
460;
461; IS__CGSCC____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
462; IS__CGSCC____-LABEL: define {{[^@]+}}@complicated_args_sret
463; IS__CGSCC____-SAME: (%struct.X** nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[B:%.*]]) #[[ATTR2]] {
464; IS__CGSCC____-NEXT:    unreachable
465;
466  call void @test_sret(%struct.X* sret(%struct.X) null, %struct.X** %b)
467  ret void
468}
469
470define internal %struct.X* @test_nest(%struct.X* nest %a) {
471; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
472; IS__CGSCC____-LABEL: define {{[^@]+}}@test_nest
473; IS__CGSCC____-SAME: (%struct.X* nest noalias nocapture nofree readnone align 4294967296 [[A:%.*]]) #[[ATTR1]] {
474; IS__CGSCC____-NEXT:    ret %struct.X* undef
475;
476  ret %struct.X* %a
477}
478define %struct.X* @complicated_args_nest() {
479; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
480; CHECK-LABEL: define {{[^@]+}}@complicated_args_nest
481; CHECK-SAME: () #[[ATTR1]] {
482; CHECK-NEXT:    ret %struct.X* null
483;
484  %call = call %struct.X* @test_nest(%struct.X* null)
485  ret %struct.X* %call
486}
487
488@S = external global %struct.X
489define internal void @test_byval(%struct.X* byval(%struct.X) %a) {
490; IS________OPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
491; IS________OPM-LABEL: define {{[^@]+}}@test_byval
492; IS________OPM-SAME: (%struct.X* noalias nocapture nofree noundef nonnull writeonly byval([[STRUCT_X:%.*]]) align 8 dereferenceable(8) [[A:%.*]]) #[[ATTR2]] {
493; IS________OPM-NEXT:    [[G0:%.*]] = getelementptr [[STRUCT_X]], %struct.X* [[A]], i32 0, i32 0
494; IS________OPM-NEXT:    store i8* null, i8** [[G0]], align 8
495; IS________OPM-NEXT:    ret void
496;
497; IS__TUNIT_NPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
498; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@test_byval
499; IS__TUNIT_NPM-SAME: (i8* [[TMP0:%.*]]) #[[ATTR2]] {
500; IS__TUNIT_NPM-NEXT:    [[A_PRIV:%.*]] = alloca [[STRUCT_X:%.*]], align 8
501; IS__TUNIT_NPM-NEXT:    [[A_PRIV_CAST:%.*]] = bitcast %struct.X* [[A_PRIV]] to i8**
502; IS__TUNIT_NPM-NEXT:    store i8* [[TMP0]], i8** [[A_PRIV_CAST]], align 8
503; IS__TUNIT_NPM-NEXT:    [[G0:%.*]] = getelementptr [[STRUCT_X]], %struct.X* [[A_PRIV]], i32 0, i32 0
504; IS__TUNIT_NPM-NEXT:    store i8* null, i8** [[G0]], align 8
505; IS__TUNIT_NPM-NEXT:    ret void
506;
507; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
508; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@test_byval
509; IS__CGSCC_NPM-SAME: (i8* noalias nocapture nofree readnone [[TMP0:%.*]]) #[[ATTR1]] {
510; IS__CGSCC_NPM-NEXT:    [[A_PRIV:%.*]] = alloca [[STRUCT_X:%.*]], align 8
511; IS__CGSCC_NPM-NEXT:    [[A_PRIV_CAST:%.*]] = bitcast %struct.X* [[A_PRIV]] to i8**
512; IS__CGSCC_NPM-NEXT:    [[G0:%.*]] = getelementptr [[STRUCT_X]], %struct.X* [[A_PRIV]], i32 0, i32 0
513; IS__CGSCC_NPM-NEXT:    ret void
514;
515  %g0 = getelementptr %struct.X, %struct.X* %a, i32 0, i32 0
516  store i8* null, i8** %g0
517  ret void
518}
519define void @complicated_args_byval() {
520; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind willreturn writeonly
521; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@complicated_args_byval
522; IS__TUNIT_OPM-SAME: () #[[ATTR3:[0-9]+]] {
523; IS__TUNIT_OPM-NEXT:    call void @test_byval(%struct.X* nocapture nofree noundef nonnull readonly byval([[STRUCT_X:%.*]]) align 8 dereferenceable(8) @S) #[[ATTR7]]
524; IS__TUNIT_OPM-NEXT:    ret void
525;
526; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind willreturn writeonly
527; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@complicated_args_byval
528; IS__TUNIT_NPM-SAME: () #[[ATTR3:[0-9]+]] {
529; IS__TUNIT_NPM-NEXT:    [[S_CAST:%.*]] = bitcast %struct.X* @S to i8**
530; IS__TUNIT_NPM-NEXT:    [[TMP1:%.*]] = load i8*, i8** [[S_CAST]], align 8
531; IS__TUNIT_NPM-NEXT:    call void @test_byval(i8* [[TMP1]]) #[[ATTR6]]
532; IS__TUNIT_NPM-NEXT:    ret void
533;
534; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
535; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@complicated_args_byval
536; IS__CGSCC_OPM-SAME: () #[[ATTR1]] {
537; IS__CGSCC_OPM-NEXT:    call void @test_byval(%struct.X* noalias nocapture nofree noundef nonnull readnone byval([[STRUCT_X:%.*]]) align 8 dereferenceable(8) @S) #[[ATTR6:[0-9]+]]
538; IS__CGSCC_OPM-NEXT:    ret void
539;
540; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
541; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@complicated_args_byval
542; IS__CGSCC_NPM-SAME: () #[[ATTR1]] {
543; IS__CGSCC_NPM-NEXT:    ret void
544;
545  call void @test_byval(%struct.X* byval(%struct.X) @S)
546  ret void
547}
548
549declare void @sync()
550; Make sure we *do not* load @S here!
551define internal i8*@test_byval2(%struct.X* byval(%struct.X) %a) {
552; IS________OPM-LABEL: define {{[^@]+}}@test_byval2
553; IS________OPM-SAME: (%struct.X* noalias nocapture nofree noundef nonnull readonly byval([[STRUCT_X:%.*]]) align 8 dereferenceable(8) [[A:%.*]]) {
554; IS________OPM-NEXT:    call void @sync()
555; IS________OPM-NEXT:    [[G0:%.*]] = getelementptr [[STRUCT_X]], %struct.X* [[A]], i32 0, i32 0
556; IS________OPM-NEXT:    [[L:%.*]] = load i8*, i8** [[G0]], align 8
557; IS________OPM-NEXT:    ret i8* [[L]]
558;
559; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@test_byval2
560; IS__TUNIT_NPM-SAME: (i8* [[TMP0:%.*]]) {
561; IS__TUNIT_NPM-NEXT:    [[A_PRIV:%.*]] = alloca [[STRUCT_X:%.*]], align 8
562; IS__TUNIT_NPM-NEXT:    [[A_PRIV_CAST:%.*]] = bitcast %struct.X* [[A_PRIV]] to i8**
563; IS__TUNIT_NPM-NEXT:    store i8* [[TMP0]], i8** [[A_PRIV_CAST]], align 8
564; IS__TUNIT_NPM-NEXT:    call void @sync()
565; IS__TUNIT_NPM-NEXT:    [[G0:%.*]] = getelementptr [[STRUCT_X]], %struct.X* [[A_PRIV]], i32 0, i32 0
566; IS__TUNIT_NPM-NEXT:    [[L:%.*]] = load i8*, i8** [[G0]], align 8
567; IS__TUNIT_NPM-NEXT:    ret i8* [[L]]
568;
569; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@test_byval2
570; IS__CGSCC_NPM-SAME: (i8* noalias nofree readnone returned "no-capture-maybe-returned" [[TMP0:%.*]]) {
571; IS__CGSCC_NPM-NEXT:    [[A_PRIV:%.*]] = alloca [[STRUCT_X:%.*]], align 8
572; IS__CGSCC_NPM-NEXT:    [[A_PRIV_CAST:%.*]] = bitcast %struct.X* [[A_PRIV]] to i8**
573; IS__CGSCC_NPM-NEXT:    store i8* [[TMP0]], i8** [[A_PRIV_CAST]], align 8
574; IS__CGSCC_NPM-NEXT:    call void @sync()
575; IS__CGSCC_NPM-NEXT:    [[G0:%.*]] = getelementptr [[STRUCT_X]], %struct.X* [[A_PRIV]], i32 0, i32 0
576; IS__CGSCC_NPM-NEXT:    [[L:%.*]] = load i8*, i8** [[G0]], align 8
577; IS__CGSCC_NPM-NEXT:    ret i8* [[TMP0]]
578;
579  call void @sync()
580  %g0 = getelementptr %struct.X, %struct.X* %a, i32 0, i32 0
581  %l = load i8*, i8** %g0
582  ret i8* %l
583}
584define i8* @complicated_args_byval2() {
585;
586; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@complicated_args_byval2() {
587; IS__TUNIT_OPM-NEXT:    [[C:%.*]] = call i8* @test_byval2(%struct.X* nocapture nofree noundef nonnull readonly byval([[STRUCT_X:%.*]]) align 8 dereferenceable(8) @S)
588; IS__TUNIT_OPM-NEXT:    ret i8* [[C]]
589;
590; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@complicated_args_byval2() {
591; IS__TUNIT_NPM-NEXT:    [[S_CAST:%.*]] = bitcast %struct.X* @S to i8**
592; IS__TUNIT_NPM-NEXT:    [[TMP1:%.*]] = load i8*, i8** [[S_CAST]], align 8
593; IS__TUNIT_NPM-NEXT:    [[C:%.*]] = call i8* @test_byval2(i8* [[TMP1]])
594; IS__TUNIT_NPM-NEXT:    ret i8* [[C]]
595;
596; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@complicated_args_byval2() {
597; IS__CGSCC_OPM-NEXT:    [[C:%.*]] = call i8* @test_byval2(%struct.X* noalias nocapture nofree noundef nonnull readonly byval([[STRUCT_X:%.*]]) align 8 dereferenceable(8) @S)
598; IS__CGSCC_OPM-NEXT:    ret i8* [[C]]
599;
600; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@complicated_args_byval2() {
601; IS__CGSCC_NPM-NEXT:    [[TMP1:%.*]] = load i8*, i8** getelementptr inbounds ([[STRUCT_X:%.*]], %struct.X* @S, i32 0, i32 0), align 8
602; IS__CGSCC_NPM-NEXT:    [[C:%.*]] = call i8* @test_byval2(i8* noalias nofree readnone "no-capture-maybe-returned" [[TMP1]])
603; IS__CGSCC_NPM-NEXT:    ret i8* [[TMP1]]
604;
605  %c = call i8* @test_byval2(%struct.X* byval(%struct.X) @S)
606  ret i8* %c
607}
608
609define void @fixpoint_changed(i32* %p) {
610; IS__TUNIT_OPM: Function Attrs: argmemonly nofree norecurse nosync nounwind writeonly
611; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@fixpoint_changed
612; IS__TUNIT_OPM-SAME: (i32* nocapture nofree writeonly [[P:%.*]]) #[[ATTR4:[0-9]+]] {
613; IS__TUNIT_OPM-NEXT:  entry:
614; IS__TUNIT_OPM-NEXT:    br label [[FOR_COND:%.*]]
615; IS__TUNIT_OPM:       for.cond:
616; IS__TUNIT_OPM-NEXT:    [[J_0:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INC:%.*]], [[SW_EPILOG:%.*]] ]
617; IS__TUNIT_OPM-NEXT:    [[CMP:%.*]] = icmp slt i32 [[J_0]], 30
618; IS__TUNIT_OPM-NEXT:    br i1 [[CMP]], label [[FOR_BODY:%.*]], label [[FOR_END:%.*]]
619; IS__TUNIT_OPM:       for.body:
620; IS__TUNIT_OPM-NEXT:    switch i32 [[J_0]], label [[SW_EPILOG]] [
621; IS__TUNIT_OPM-NEXT:    i32 1, label [[SW_BB:%.*]]
622; IS__TUNIT_OPM-NEXT:    ]
623; IS__TUNIT_OPM:       sw.bb:
624; IS__TUNIT_OPM-NEXT:    br label [[SW_EPILOG]]
625; IS__TUNIT_OPM:       sw.epilog:
626; IS__TUNIT_OPM-NEXT:    [[X_0:%.*]] = phi i32 [ 255, [[FOR_BODY]] ], [ 253, [[SW_BB]] ]
627; IS__TUNIT_OPM-NEXT:    store i32 [[X_0]], i32* [[P]], align 4
628; IS__TUNIT_OPM-NEXT:    [[INC]] = add nsw i32 [[J_0]], 1
629; IS__TUNIT_OPM-NEXT:    br label [[FOR_COND]]
630; IS__TUNIT_OPM:       for.end:
631; IS__TUNIT_OPM-NEXT:    ret void
632;
633; IS________NPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
634; IS________NPM-LABEL: define {{[^@]+}}@fixpoint_changed
635; IS________NPM-SAME: (i32* nocapture nofree writeonly [[P:%.*]]) #[[ATTR2]] {
636; IS________NPM-NEXT:  entry:
637; IS________NPM-NEXT:    br label [[FOR_COND:%.*]]
638; IS________NPM:       for.cond:
639; IS________NPM-NEXT:    [[J_0:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INC:%.*]], [[SW_EPILOG:%.*]] ]
640; IS________NPM-NEXT:    [[CMP:%.*]] = icmp slt i32 [[J_0]], 30
641; IS________NPM-NEXT:    br i1 [[CMP]], label [[FOR_BODY:%.*]], label [[FOR_END:%.*]]
642; IS________NPM:       for.body:
643; IS________NPM-NEXT:    switch i32 [[J_0]], label [[SW_EPILOG]] [
644; IS________NPM-NEXT:    i32 1, label [[SW_BB:%.*]]
645; IS________NPM-NEXT:    ]
646; IS________NPM:       sw.bb:
647; IS________NPM-NEXT:    br label [[SW_EPILOG]]
648; IS________NPM:       sw.epilog:
649; IS________NPM-NEXT:    [[X_0:%.*]] = phi i32 [ 255, [[FOR_BODY]] ], [ 253, [[SW_BB]] ]
650; IS________NPM-NEXT:    store i32 [[X_0]], i32* [[P]], align 4
651; IS________NPM-NEXT:    [[INC]] = add nsw i32 [[J_0]], 1
652; IS________NPM-NEXT:    br label [[FOR_COND]]
653; IS________NPM:       for.end:
654; IS________NPM-NEXT:    ret void
655;
656; IS__CGSCC_OPM: Function Attrs: argmemonly nofree norecurse nosync nounwind writeonly
657; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@fixpoint_changed
658; IS__CGSCC_OPM-SAME: (i32* nocapture nofree writeonly [[P:%.*]]) #[[ATTR3:[0-9]+]] {
659; IS__CGSCC_OPM-NEXT:  entry:
660; IS__CGSCC_OPM-NEXT:    br label [[FOR_COND:%.*]]
661; IS__CGSCC_OPM:       for.cond:
662; IS__CGSCC_OPM-NEXT:    [[J_0:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INC:%.*]], [[SW_EPILOG:%.*]] ]
663; IS__CGSCC_OPM-NEXT:    [[CMP:%.*]] = icmp slt i32 [[J_0]], 30
664; IS__CGSCC_OPM-NEXT:    br i1 [[CMP]], label [[FOR_BODY:%.*]], label [[FOR_END:%.*]]
665; IS__CGSCC_OPM:       for.body:
666; IS__CGSCC_OPM-NEXT:    switch i32 [[J_0]], label [[SW_EPILOG]] [
667; IS__CGSCC_OPM-NEXT:    i32 1, label [[SW_BB:%.*]]
668; IS__CGSCC_OPM-NEXT:    ]
669; IS__CGSCC_OPM:       sw.bb:
670; IS__CGSCC_OPM-NEXT:    br label [[SW_EPILOG]]
671; IS__CGSCC_OPM:       sw.epilog:
672; IS__CGSCC_OPM-NEXT:    [[X_0:%.*]] = phi i32 [ 255, [[FOR_BODY]] ], [ 253, [[SW_BB]] ]
673; IS__CGSCC_OPM-NEXT:    store i32 [[X_0]], i32* [[P]], align 4
674; IS__CGSCC_OPM-NEXT:    [[INC]] = add nsw i32 [[J_0]], 1
675; IS__CGSCC_OPM-NEXT:    br label [[FOR_COND]]
676; IS__CGSCC_OPM:       for.end:
677; IS__CGSCC_OPM-NEXT:    ret void
678;
679entry:
680  br label %for.cond
681
682for.cond:
683  %j.0 = phi i32 [ 0, %entry ], [ %inc, %sw.epilog ]
684  %cmp = icmp slt i32 %j.0, 30
685  br i1 %cmp, label %for.body, label %for.end
686
687for.body:
688  switch i32 %j.0, label %sw.epilog [
689  i32 1, label %sw.bb
690  ]
691
692sw.bb:
693  br label %sw.epilog
694
695sw.epilog:
696  %x.0 = phi i32 [ 255, %for.body ], [ 253, %sw.bb ]
697  store i32 %x.0, i32* %p
698  %inc = add nsw i32 %j.0, 1
699  br label %for.cond
700
701for.end:
702  ret void
703}
704
705; Check we merge undef and a constant properly.
706define i8 @caller0() {
707; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
708; CHECK-LABEL: define {{[^@]+}}@caller0
709; CHECK-SAME: () #[[ATTR1]] {
710; CHECK-NEXT:    ret i8 49
711;
712  %c = call i8 @callee(i8 undef)
713  ret i8 %c
714}
715define i8 @caller1() {
716; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
717; CHECK-LABEL: define {{[^@]+}}@caller1
718; CHECK-SAME: () #[[ATTR1]] {
719; CHECK-NEXT:    ret i8 49
720;
721  %c = call i8 @callee(i8 undef)
722  ret i8 %c
723}
724define i8 @caller2() {
725; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
726; CHECK-LABEL: define {{[^@]+}}@caller2
727; CHECK-SAME: () #[[ATTR1]] {
728; CHECK-NEXT:    ret i8 49
729;
730  %c = call i8 @callee(i8 undef)
731  ret i8 %c
732}
733define i8 @caller_middle() {
734; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
735; CHECK-LABEL: define {{[^@]+}}@caller_middle
736; CHECK-SAME: () #[[ATTR1]] {
737; CHECK-NEXT:    ret i8 49
738;
739  %c = call i8 @callee(i8 42)
740  ret i8 %c
741}
742define i8 @caller3() {
743; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
744; CHECK-LABEL: define {{[^@]+}}@caller3
745; CHECK-SAME: () #[[ATTR1]] {
746; CHECK-NEXT:    ret i8 49
747;
748  %c = call i8 @callee(i8 undef)
749  ret i8 %c
750}
751define i8 @caller4() {
752; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
753; CHECK-LABEL: define {{[^@]+}}@caller4
754; CHECK-SAME: () #[[ATTR1]] {
755; CHECK-NEXT:    ret i8 49
756;
757  %c = call i8 @callee(i8 undef)
758  ret i8 %c
759}
760define internal i8 @callee(i8 %a) {
761; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
762; IS__CGSCC____-LABEL: define {{[^@]+}}@callee
763; IS__CGSCC____-SAME: () #[[ATTR1]] {
764; IS__CGSCC____-NEXT:    ret i8 undef
765;
766  %c = add i8 %a, 7
767  ret i8 %c
768}
769
770define void @user_as3() {
771; NOT_CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind willreturn writeonly
772; NOT_CGSCC_OPM-LABEL: define {{[^@]+}}@user_as3
773; NOT_CGSCC_OPM-SAME: () #[[ATTR3:[0-9]+]] {
774; NOT_CGSCC_OPM-NEXT:    store i32 0, i32 addrspace(3)* @ConstAS3Ptr, align 4
775; NOT_CGSCC_OPM-NEXT:    ret void
776;
777; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind willreturn writeonly
778; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@user_as3
779; IS__CGSCC_OPM-SAME: () #[[ATTR4:[0-9]+]] {
780; IS__CGSCC_OPM-NEXT:    store i32 0, i32 addrspace(3)* @ConstAS3Ptr, align 4
781; IS__CGSCC_OPM-NEXT:    ret void
782;
783  %call = call fastcc i32 addrspace(3)* @const_ptr_return_as3()
784  store i32 0, i32 addrspace(3)* %call
785  ret void
786}
787define void @user() {
788; NOT_CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind willreturn writeonly
789; NOT_CGSCC_OPM-LABEL: define {{[^@]+}}@user
790; NOT_CGSCC_OPM-SAME: () #[[ATTR3]] {
791; NOT_CGSCC_OPM-NEXT:    store i32 0, i32* addrspacecast (i32 addrspace(3)* @ConstAS3Ptr to i32*), align 4
792; NOT_CGSCC_OPM-NEXT:    ret void
793;
794; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind willreturn writeonly
795; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@user
796; IS__CGSCC_OPM-SAME: () #[[ATTR4]] {
797; IS__CGSCC_OPM-NEXT:    store i32 0, i32* addrspacecast (i32 addrspace(3)* @ConstAS3Ptr to i32*), align 4
798; IS__CGSCC_OPM-NEXT:    ret void
799;
800  %call = call fastcc i32* @const_ptr_return()
801  store i32 0, i32* %call
802  ret void
803}
804
805
806define i1 @test_merge_with_undef_values_ptr(i1 %c) {
807; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
808; CHECK-LABEL: define {{[^@]+}}@test_merge_with_undef_values_ptr
809; CHECK-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
810; CHECK-NEXT:    ret i1 false
811;
812  %r1 = call i1 @undef_then_null(i1 %c, i32* undef, i32* undef)
813  ret i1 %r1
814}
815define internal i1 @undef_then_null(i1 %c, i32* %i32Aptr, i32* %i32Bptr) {
816; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
817; IS__CGSCC____-LABEL: define {{[^@]+}}@undef_then_null
818; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
819; IS__CGSCC____-NEXT:    br i1 [[C]], label [[A:%.*]], label [[B:%.*]]
820; IS__CGSCC____:       a:
821; IS__CGSCC____-NEXT:    ret i1 undef
822; IS__CGSCC____:       b:
823; IS__CGSCC____-NEXT:    ret i1 undef
824;
825  %cmp1 = icmp eq i32* %i32Aptr, %i32Bptr
826  %cmp2 = icmp eq i1 %cmp1, false
827  %or = or i1 %cmp2, %c
828  br i1 %or, label %a, label %b
829a:
830  %r2 = call i1 @undef_then_null(i1 false, i32* null, i32* null)
831  ret i1 %r2
832b:
833  ret i1 %cmp2
834}
835
836define i1 @test_merge_with_undef_values(i1 %c) {
837; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
838; CHECK-LABEL: define {{[^@]+}}@test_merge_with_undef_values
839; CHECK-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
840; CHECK-NEXT:    ret i1 false
841;
842  %r1 = call i1 @undef_then_1(i1 %c, i32 undef, i32 undef)
843  ret i1 %r1
844}
845define internal i1 @undef_then_1(i1 %c, i32 %i32A, i32 %i32B) {
846;
847; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
848; IS__CGSCC____-LABEL: define {{[^@]+}}@undef_then_1
849; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
850; IS__CGSCC____-NEXT:    br i1 [[C]], label [[A:%.*]], label [[B:%.*]]
851; IS__CGSCC____:       a:
852; IS__CGSCC____-NEXT:    ret i1 undef
853; IS__CGSCC____:       b:
854; IS__CGSCC____-NEXT:    ret i1 undef
855;
856  %cmp1 = icmp eq i32 %i32A, %i32B
857  %cmp2 = icmp eq i1 %cmp1, false
858  %or = or i1 %cmp2, %c
859  br i1 %or, label %a, label %b
860a:
861  %r2 = call i1 @undef_then_1(i1 false, i32 1, i32 1)
862  ret i1 %r2
863b:
864  ret i1 %cmp2
865}
866
867define i32 @test_select(i32 %c) {
868; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
869; CHECK-LABEL: define {{[^@]+}}@test_select
870; CHECK-SAME: (i32 [[C:%.*]]) #[[ATTR1]] {
871; CHECK-NEXT:    ret i32 42
872;
873  %call = call i32 @select(i1 1, i32 42, i32 %c)
874  ret i32 %call
875}
876
877define internal i32 @select(i1 %a, i32 %b, i32 %c) {
878; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
879; IS__CGSCC____-LABEL: define {{[^@]+}}@select
880; IS__CGSCC____-SAME: () #[[ATTR1]] {
881; IS__CGSCC____-NEXT:    ret i32 undef
882;
883  %s = select i1 %a, i32 %b, i32 %c
884  ret i32 %s
885}
886
887define i1 @icmp() {
888; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
889; CHECK-LABEL: define {{[^@]+}}@icmp
890; CHECK-SAME: () #[[ATTR1]] {
891; CHECK-NEXT:    ret i1 true
892;
893  %c = icmp eq i8* null, null
894  ret i1 %c
895}
896
897define void @test_callee_is_undef(void (i32)* %fn) {
898; IS__TUNIT____-LABEL: define {{[^@]+}}@test_callee_is_undef
899; IS__TUNIT____-SAME: (void (i32)* nocapture nofree [[FN:%.*]]) {
900; IS__TUNIT____-NEXT:    call void @callee_is_undef()
901; IS__TUNIT____-NEXT:    call void @unknown_calle_arg_is_undef(void (i32)* nocapture nofree [[FN]])
902; IS__TUNIT____-NEXT:    ret void
903;
904; IS__CGSCC____-LABEL: define {{[^@]+}}@test_callee_is_undef
905; IS__CGSCC____-SAME: (void (i32)* nocapture nofree [[FN:%.*]]) {
906; IS__CGSCC____-NEXT:    call void @callee_is_undef()
907; IS__CGSCC____-NEXT:    call void @unknown_calle_arg_is_undef(void (i32)* nocapture nofree noundef nonnull [[FN]])
908; IS__CGSCC____-NEXT:    ret void
909;
910  call void @callee_is_undef(void ()* undef)
911  call void @unknown_calle_arg_is_undef(void (i32)* %fn, i32 undef)
912  ret void
913}
914define internal void @callee_is_undef(void ()* %fn) {
915;
916; CHECK-LABEL: define {{[^@]+}}@callee_is_undef() {
917; CHECK-NEXT:    call void undef()
918; CHECK-NEXT:    ret void
919;
920  call void %fn()
921  ret void
922}
923define internal void @unknown_calle_arg_is_undef(void (i32)* %fn, i32 %arg) {
924;
925; CHECK-LABEL: define {{[^@]+}}@unknown_calle_arg_is_undef
926; CHECK-SAME: (void (i32)* nocapture nofree noundef nonnull [[FN:%.*]]) {
927; CHECK-NEXT:    call void [[FN]](i32 undef)
928; CHECK-NEXT:    ret void
929;
930  call void %fn(i32 %arg)
931  ret void
932}
933
934; Taken from 50683
935; {{{
936
937@g = internal constant { [2 x i8*] } { [2 x i8*] [i8* bitcast (void (i8***)* @f1 to i8*), i8* bitcast (void (i1 (i8*)*)* @f2 to i8*)] }
938
939define internal void @f1(i8*** %a) {
940; CHECK: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
941; CHECK-LABEL: define {{[^@]+}}@f1
942; CHECK-SAME: (i8*** nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[A:%.*]]) #[[ATTR2]] {
943; CHECK-NEXT:  entry:
944; CHECK-NEXT:    [[X:%.*]] = getelementptr { [2 x i8*] }, { [2 x i8*] }* @g, i32 0, i32 0, i32 0
945; CHECK-NEXT:    store i8** [[X]], i8*** [[A]], align 8
946; CHECK-NEXT:    ret void
947;
948entry:
949  %x = getelementptr { [2 x i8*] }, { [2 x i8*] }* @g, i32 0, i32 0, i32 0
950  store i8** %x , i8*** %a, align 8
951  ret void
952}
953
954define internal void @f2(i1 (i8*)* %a) {
955; CHECK-LABEL: define {{[^@]+}}@f2
956; CHECK-SAME: (i1 (i8*)* [[A:%.*]]) {
957; CHECK-NEXT:  cont461:
958; CHECK-NEXT:    [[C1:%.*]] = bitcast i1 (i8*)* [[A]] to i8*
959; CHECK-NEXT:    call void @f3(i8* [[C1]], i1 (i8*)* nocapture nofree [[A]])
960; CHECK-NEXT:    ret void
961;
962cont461:
963  %c1 = bitcast i1 (i8*)* %a to i8*
964  call void @f3(i8* %c1, i1 (i8*)* %a)
965  ret void
966}
967
968define internal void @f3(i8* %a1, i1 (i8*)* %a) {
969; CHECK-LABEL: define {{[^@]+}}@f3
970; CHECK-SAME: (i8* [[A1:%.*]], i1 (i8*)* nocapture nofree [[A:%.*]]) {
971; CHECK-NEXT:  entry:
972; CHECK-NEXT:    [[CALL20:%.*]] = call i1 @f9()
973; CHECK-NEXT:    br i1 [[CALL20]], label [[LAND_LHS_TRUE:%.*]], label [[IF_END40:%.*]]
974; CHECK:       land.lhs.true:
975; CHECK-NEXT:    [[TMP0:%.*]] = call i1 [[A]](i8* [[A1]])
976; CHECK-NEXT:    br label [[IF_END40]]
977; CHECK:       if.end40:
978; CHECK-NEXT:    ret void
979;
980entry:
981  %call20 = call i1 @f9()
982  br i1 %call20, label %land.lhs.true, label %if.end40
983
984land.lhs.true:
985  call i1 %a(i8* %a1)
986  br label %if.end40
987
988if.end40:
989  ret void
990}
991
992define linkonce_odr i1 @f9() {
993; CHECK-LABEL: define {{[^@]+}}@f9() {
994; CHECK-NEXT:  entry:
995; CHECK-NEXT:    ret i1 false
996;
997entry:
998  ret i1 false
999}
1000
1001; }}}
1002
1003
1004define i1 @test_cmp_null_after_cast() {
1005; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1006; CHECK-LABEL: define {{[^@]+}}@test_cmp_null_after_cast
1007; CHECK-SAME: () #[[ATTR1]] {
1008; CHECK-NEXT:    ret i1 true
1009;
1010  %c = call i1 @cmp_null_after_cast(i32 0, i8 0)
1011  ret i1 %c
1012}
1013define internal i1 @cmp_null_after_cast(i32 %a, i8 %b) {
1014; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1015; IS__CGSCC____-LABEL: define {{[^@]+}}@cmp_null_after_cast
1016; IS__CGSCC____-SAME: () #[[ATTR1]] {
1017; IS__CGSCC____-NEXT:    ret i1 undef
1018;
1019  %t = trunc i32 %a to i8
1020  %c = icmp eq i8 %t, %b
1021  ret i1 %c
1022}
1023
1024
1025declare i8* @m()
1026
1027define i32 @test(i1 %c) {
1028; CHECK-LABEL: define {{[^@]+}}@test
1029; CHECK-SAME: (i1 [[C:%.*]]) {
1030; CHECK-NEXT:    [[R1:%.*]] = call i32 @ctx_test1(i1 [[C]])
1031; CHECK-NEXT:    [[R2:%.*]] = call i32 @ctx_test2(i1 [[C]]), !range [[RNG0:![0-9]+]]
1032; CHECK-NEXT:    [[ADD:%.*]] = add i32 [[R1]], [[R2]]
1033; CHECK-NEXT:    ret i32 [[ADD]]
1034;
1035  %r1 = call i32 @ctx_test1(i1 %c)
1036  %r2 = call i32 @ctx_test2(i1 %c)
1037  %add = add i32 %r1, %r2
1038  ret i32 %add
1039}
1040
1041define internal i32 @ctx_test1(i1 %c) {
1042; CHECK-LABEL: define {{[^@]+}}@ctx_test1
1043; CHECK-SAME: (i1 [[C:%.*]]) {
1044; CHECK-NEXT:  entry:
1045; CHECK-NEXT:    br i1 [[C]], label [[THEN:%.*]], label [[JOIN:%.*]]
1046; CHECK:       then:
1047; CHECK-NEXT:    [[M:%.*]] = tail call i8* @m()
1048; CHECK-NEXT:    [[I:%.*]] = ptrtoint i8* [[M]] to i64
1049; CHECK-NEXT:    br label [[JOIN]]
1050; CHECK:       join:
1051; CHECK-NEXT:    [[PHI:%.*]] = phi i64 [ [[I]], [[THEN]] ], [ undef, [[ENTRY:%.*]] ]
1052; CHECK-NEXT:    [[RET:%.*]] = trunc i64 [[PHI]] to i32
1053; CHECK-NEXT:    ret i32 [[RET]]
1054;
1055entry:
1056  br i1 %c, label %then, label %join
1057
1058then:
1059  %m = tail call i8* @m()
1060  %i = ptrtoint i8* %m to i64
1061  br label %join
1062
1063join:
1064  %phi = phi i64 [ %i, %then ], [ undef, %entry ]
1065  %ret = trunc i64 %phi to i32
1066  ret i32 %ret
1067}
1068
1069define internal i32 @ctx_test2(i1 %c) {
1070; CHECK-LABEL: define {{[^@]+}}@ctx_test2
1071; CHECK-SAME: (i1 [[C:%.*]]) {
1072; CHECK-NEXT:  entry:
1073; CHECK-NEXT:    br i1 [[C]], label [[THEN:%.*]], label [[JOIN:%.*]]
1074; CHECK:       then:
1075; CHECK-NEXT:    [[M:%.*]] = tail call i8* @m()
1076; CHECK-NEXT:    [[I:%.*]] = ptrtoint i8* [[M]] to i32
1077; CHECK-NEXT:    br label [[JOIN]]
1078; CHECK:       join:
1079; CHECK-NEXT:    [[PHI:%.*]] = phi i32 [ [[I]], [[THEN]] ], [ undef, [[ENTRY:%.*]] ]
1080; CHECK-NEXT:    [[RET:%.*]] = lshr i32 [[PHI]], 1
1081; CHECK-NEXT:    ret i32 [[RET]]
1082;
1083entry:
1084  br i1 %c, label %then, label %join
1085
1086then:
1087  %m = tail call i8* @m()
1088  %i = ptrtoint i8* %m to i32
1089  br label %join
1090
1091join:
1092  %phi = phi i32 [ %i, %then ], [ undef, %entry ]
1093  %ret = lshr i32 %phi, 1
1094  ret i32 %ret
1095
1096  uselistorder label %join, { 1, 0 }
1097}
1098
1099define i1 @test_liveness(i1 %c) {
1100; IS__TUNIT_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1101; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@test_liveness
1102; IS__TUNIT_OPM-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
1103; IS__TUNIT_OPM-NEXT:  entry:
1104; IS__TUNIT_OPM-NEXT:    br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
1105; IS__TUNIT_OPM:       t:
1106; IS__TUNIT_OPM-NEXT:    br label [[F]]
1107; IS__TUNIT_OPM:       f:
1108; IS__TUNIT_OPM-NEXT:    [[P:%.*]] = phi i1 [ true, [[ENTRY:%.*]] ], [ false, [[T]] ]
1109; IS__TUNIT_OPM-NEXT:    [[RC1:%.*]] = call noundef i1 @ret(i1 noundef [[P]]) #[[ATTR5]]
1110; IS__TUNIT_OPM-NEXT:    ret i1 [[RC1]]
1111;
1112; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1113; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@test_liveness
1114; IS__TUNIT_NPM-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
1115; IS__TUNIT_NPM-NEXT:  entry:
1116; IS__TUNIT_NPM-NEXT:    br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
1117; IS__TUNIT_NPM:       t:
1118; IS__TUNIT_NPM-NEXT:    br label [[F]]
1119; IS__TUNIT_NPM:       f:
1120; IS__TUNIT_NPM-NEXT:    [[P:%.*]] = phi i1 [ true, [[ENTRY:%.*]] ], [ false, [[T]] ]
1121; IS__TUNIT_NPM-NEXT:    [[RC1:%.*]] = call noundef i1 @ret(i1 noundef [[P]]) #[[ATTR4]]
1122; IS__TUNIT_NPM-NEXT:    ret i1 [[RC1]]
1123;
1124; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1125; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@test_liveness
1126; IS__CGSCC_OPM-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
1127; IS__CGSCC_OPM-NEXT:  entry:
1128; IS__CGSCC_OPM-NEXT:    br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
1129; IS__CGSCC_OPM:       t:
1130; IS__CGSCC_OPM-NEXT:    br label [[F]]
1131; IS__CGSCC_OPM:       f:
1132; IS__CGSCC_OPM-NEXT:    [[P:%.*]] = phi i1 [ true, [[ENTRY:%.*]] ], [ false, [[T]] ]
1133; IS__CGSCC_OPM-NEXT:    [[RC1:%.*]] = call noundef i1 @ret(i1 noundef [[P]]) #[[ATTR7:[0-9]+]]
1134; IS__CGSCC_OPM-NEXT:    ret i1 [[RC1]]
1135;
1136; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1137; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@test_liveness
1138; IS__CGSCC_NPM-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
1139; IS__CGSCC_NPM-NEXT:  entry:
1140; IS__CGSCC_NPM-NEXT:    br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
1141; IS__CGSCC_NPM:       t:
1142; IS__CGSCC_NPM-NEXT:    br label [[F]]
1143; IS__CGSCC_NPM:       f:
1144; IS__CGSCC_NPM-NEXT:    ret i1 false
1145;
1146entry:
1147  br i1 %c, label %t, label %f
1148t:
1149  br label %f
1150f:
1151  %p = phi i1 [true, %entry], [false, %t]
1152  %rc1 = call i1 @ret(i1 %p)
1153  ret i1 %rc1
1154}
1155
1156define internal i1 @ret(i1 %c) {
1157; IS________OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1158; IS________OPM-LABEL: define {{[^@]+}}@ret
1159; IS________OPM-SAME: (i1 noundef [[C:%.*]]) #[[ATTR1]] {
1160; IS________OPM-NEXT:  entry:
1161; IS________OPM-NEXT:    br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
1162; IS________OPM:       t:
1163; IS________OPM-NEXT:    br label [[F]]
1164; IS________OPM:       f:
1165; IS________OPM-NEXT:    [[P:%.*]] = phi i1 [ [[C]], [[ENTRY:%.*]] ], [ false, [[T]] ]
1166; IS________OPM-NEXT:    ret i1 [[P]]
1167;
1168; IS__TUNIT_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1169; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@ret
1170; IS__TUNIT_NPM-SAME: (i1 noundef [[C:%.*]]) #[[ATTR1]] {
1171; IS__TUNIT_NPM-NEXT:  entry:
1172; IS__TUNIT_NPM-NEXT:    br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
1173; IS__TUNIT_NPM:       t:
1174; IS__TUNIT_NPM-NEXT:    br label [[F]]
1175; IS__TUNIT_NPM:       f:
1176; IS__TUNIT_NPM-NEXT:    [[P:%.*]] = phi i1 [ [[C]], [[ENTRY:%.*]] ], [ false, [[T]] ]
1177; IS__TUNIT_NPM-NEXT:    ret i1 false
1178;
1179; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1180; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@ret
1181; IS__CGSCC_NPM-SAME: (i1 noundef [[C:%.*]]) #[[ATTR1]] {
1182; IS__CGSCC_NPM-NEXT:  entry:
1183; IS__CGSCC_NPM-NEXT:    br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
1184; IS__CGSCC_NPM:       t:
1185; IS__CGSCC_NPM-NEXT:    br label [[F]]
1186; IS__CGSCC_NPM:       f:
1187; IS__CGSCC_NPM-NEXT:    [[P:%.*]] = phi i1 [ [[C]], [[ENTRY:%.*]] ], [ false, [[T]] ]
1188; IS__CGSCC_NPM-NEXT:    ret i1 undef
1189;
1190entry:
1191  br i1 %c, label %t, label %f
1192t:
1193  br label %f
1194f:
1195  %p = phi i1 [%c, %entry], [false, %t]
1196  ret i1 %p
1197}
1198
1199;.
1200; IS__TUNIT_OPM: attributes #[[ATTR0]] = { nofree nosync nounwind willreturn }
1201; IS__TUNIT_OPM: attributes #[[ATTR1]] = { nofree norecurse nosync nounwind readnone willreturn }
1202; IS__TUNIT_OPM: attributes #[[ATTR2]] = { argmemonly nofree norecurse nosync nounwind willreturn writeonly }
1203; IS__TUNIT_OPM: attributes #[[ATTR3]] = { nofree norecurse nosync nounwind willreturn writeonly }
1204; IS__TUNIT_OPM: attributes #[[ATTR4]] = { argmemonly nofree norecurse nosync nounwind writeonly }
1205; IS__TUNIT_OPM: attributes #[[ATTR5]] = { nofree nosync nounwind readnone willreturn }
1206; IS__TUNIT_OPM: attributes #[[ATTR6]] = { willreturn }
1207; IS__TUNIT_OPM: attributes #[[ATTR7]] = { nofree nosync nounwind willreturn writeonly }
1208;.
1209; IS__TUNIT_NPM: attributes #[[ATTR0]] = { nofree nosync nounwind willreturn }
1210; IS__TUNIT_NPM: attributes #[[ATTR1]] = { nofree norecurse nosync nounwind readnone willreturn }
1211; IS__TUNIT_NPM: attributes #[[ATTR2]] = { argmemonly nofree norecurse nosync nounwind willreturn writeonly }
1212; IS__TUNIT_NPM: attributes #[[ATTR3]] = { nofree norecurse nosync nounwind willreturn writeonly }
1213; IS__TUNIT_NPM: attributes #[[ATTR4]] = { nofree nosync nounwind readnone willreturn }
1214; IS__TUNIT_NPM: attributes #[[ATTR5]] = { willreturn }
1215; IS__TUNIT_NPM: attributes #[[ATTR6]] = { nofree nosync nounwind willreturn writeonly }
1216;.
1217; IS__CGSCC_OPM: attributes #[[ATTR0]] = { nofree nosync nounwind willreturn }
1218; IS__CGSCC_OPM: attributes #[[ATTR1]] = { nofree norecurse nosync nounwind readnone willreturn }
1219; IS__CGSCC_OPM: attributes #[[ATTR2]] = { argmemonly nofree norecurse nosync nounwind willreturn writeonly }
1220; IS__CGSCC_OPM: attributes #[[ATTR3]] = { argmemonly nofree norecurse nosync nounwind writeonly }
1221; IS__CGSCC_OPM: attributes #[[ATTR4]] = { nofree norecurse nosync nounwind willreturn writeonly }
1222; IS__CGSCC_OPM: attributes #[[ATTR5]] = { willreturn }
1223; IS__CGSCC_OPM: attributes #[[ATTR6]] = { nounwind willreturn writeonly }
1224; IS__CGSCC_OPM: attributes #[[ATTR7]] = { readnone willreturn }
1225;.
1226; IS__CGSCC_NPM: attributes #[[ATTR0]] = { nofree nosync nounwind willreturn }
1227; IS__CGSCC_NPM: attributes #[[ATTR1]] = { nofree norecurse nosync nounwind readnone willreturn }
1228; IS__CGSCC_NPM: attributes #[[ATTR2]] = { argmemonly nofree norecurse nosync nounwind willreturn writeonly }
1229; IS__CGSCC_NPM: attributes #[[ATTR3]] = { nofree norecurse nosync nounwind willreturn writeonly }
1230; IS__CGSCC_NPM: attributes #[[ATTR4]] = { willreturn }
1231;.
1232; CHECK: [[RNG0]] = !{i32 0, i32 -2147483648}
1233;.
1234