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=14 -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=14 -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"
8
9declare i1* @geti1Ptr()
10
11; Make sure we do *not* return true.
12;.
13; CHECK: @[[G1:[a-zA-Z0-9_$"\\.-]+]] = private global i1* undef
14; CHECK: @[[G2:[a-zA-Z0-9_$"\\.-]+]] = private global i1* undef
15; CHECK: @[[G3:[a-zA-Z0-9_$"\\.-]+]] = private global i1 undef
16;.
17define internal i1 @recursive_inst_comparator(i1* %a, i1* %b) {
18; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
19; CHECK-LABEL: define {{[^@]+}}@recursive_inst_comparator
20; CHECK-SAME: (i1* noalias nofree readnone [[A:%.*]], i1* noalias nofree readnone [[B:%.*]]) #[[ATTR0:[0-9]+]] {
21; CHECK-NEXT:    [[CMP:%.*]] = icmp eq i1* [[A]], [[B]]
22; CHECK-NEXT:    ret i1 [[CMP]]
23;
24  %cmp = icmp eq i1* %a, %b
25  ret i1 %cmp
26}
27
28define internal i1 @recursive_inst_generator(i1 %c, i1* %p) {
29; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@recursive_inst_generator
30; IS__TUNIT_OPM-SAME: (i1 [[C:%.*]], i1* nofree [[P:%.*]]) {
31; IS__TUNIT_OPM-NEXT:    [[A:%.*]] = call i1* @geti1Ptr()
32; IS__TUNIT_OPM-NEXT:    br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
33; IS__TUNIT_OPM:       t:
34; IS__TUNIT_OPM-NEXT:    [[R1:%.*]] = call i1 @recursive_inst_comparator(i1* noalias nofree readnone [[A]], i1* noalias nofree readnone [[P]]) #[[ATTR6:[0-9]+]]
35; IS__TUNIT_OPM-NEXT:    ret i1 [[R1]]
36; IS__TUNIT_OPM:       f:
37; IS__TUNIT_OPM-NEXT:    [[R2:%.*]] = call i1 @recursive_inst_generator(i1 noundef true, i1* nofree [[A]])
38; IS__TUNIT_OPM-NEXT:    ret i1 [[R2]]
39;
40; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@recursive_inst_generator
41; IS__TUNIT_NPM-SAME: (i1 [[C:%.*]], i1* nofree [[P:%.*]]) {
42; IS__TUNIT_NPM-NEXT:    [[A:%.*]] = call i1* @geti1Ptr()
43; IS__TUNIT_NPM-NEXT:    br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
44; IS__TUNIT_NPM:       t:
45; IS__TUNIT_NPM-NEXT:    [[R1:%.*]] = call i1 @recursive_inst_comparator(i1* noalias nofree readnone [[A]], i1* noalias nofree readnone [[A]]) #[[ATTR6:[0-9]+]]
46; IS__TUNIT_NPM-NEXT:    ret i1 [[R1]]
47; IS__TUNIT_NPM:       f:
48; IS__TUNIT_NPM-NEXT:    [[R2:%.*]] = call i1 @recursive_inst_generator(i1 noundef true, i1* nofree [[A]])
49; IS__TUNIT_NPM-NEXT:    ret i1 [[R2]]
50;
51; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@recursive_inst_generator
52; IS__CGSCC_OPM-SAME: (i1 [[C:%.*]], i1* nofree [[P:%.*]]) {
53; IS__CGSCC_OPM-NEXT:    [[A:%.*]] = call i1* @geti1Ptr()
54; IS__CGSCC_OPM-NEXT:    br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
55; IS__CGSCC_OPM:       t:
56; IS__CGSCC_OPM-NEXT:    [[R1:%.*]] = call i1 @recursive_inst_comparator(i1* noalias nofree readnone [[A]], i1* noalias nofree readnone [[P]])
57; IS__CGSCC_OPM-NEXT:    ret i1 [[R1]]
58; IS__CGSCC_OPM:       f:
59; IS__CGSCC_OPM-NEXT:    [[R2:%.*]] = call i1 @recursive_inst_generator(i1 noundef true, i1* nofree [[A]])
60; IS__CGSCC_OPM-NEXT:    ret i1 [[R2]]
61;
62; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@recursive_inst_generator
63; IS__CGSCC_NPM-SAME: (i1 [[C:%.*]], i1* nofree [[P:%.*]]) {
64; IS__CGSCC_NPM-NEXT:    [[A:%.*]] = call i1* @geti1Ptr()
65; IS__CGSCC_NPM-NEXT:    br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
66; IS__CGSCC_NPM:       t:
67; IS__CGSCC_NPM-NEXT:    [[R1:%.*]] = call i1 @recursive_inst_comparator(i1* noalias nofree readnone [[A]], i1* noalias nofree readnone [[A]])
68; IS__CGSCC_NPM-NEXT:    ret i1 [[R1]]
69; IS__CGSCC_NPM:       f:
70; IS__CGSCC_NPM-NEXT:    [[R2:%.*]] = call i1 @recursive_inst_generator(i1 noundef true, i1* nofree [[A]])
71; IS__CGSCC_NPM-NEXT:    ret i1 [[R2]]
72;
73  %a = call i1* @geti1Ptr()
74  br i1 %c, label %t, label %f
75t:
76  %r1 = call i1 @recursive_inst_comparator(i1* %a, i1* %p)
77  ret i1 %r1
78f:
79  %r2 = call i1 @recursive_inst_generator(i1 true, i1* %a)
80  ret i1 %r2
81}
82
83; FIXME: This should *not* return true.
84define i1 @recursive_inst_generator_caller(i1 %c) {
85; CHECK-LABEL: define {{[^@]+}}@recursive_inst_generator_caller
86; CHECK-SAME: (i1 [[C:%.*]]) {
87; CHECK-NEXT:    [[CALL:%.*]] = call i1 @recursive_inst_generator(i1 [[C]], i1* undef)
88; CHECK-NEXT:    ret i1 [[CALL]]
89;
90  %call = call i1 @recursive_inst_generator(i1 %c, i1* undef)
91  ret i1 %call
92}
93
94; Make sure we do *not* return true.
95define internal i1 @recursive_inst_compare(i1 %c, i1* %p) {
96; CHECK-LABEL: define {{[^@]+}}@recursive_inst_compare
97; CHECK-SAME: (i1 [[C:%.*]], i1* [[P:%.*]]) {
98; CHECK-NEXT:    [[A:%.*]] = call i1* @geti1Ptr()
99; CHECK-NEXT:    br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
100; CHECK:       t:
101; CHECK-NEXT:    [[CMP:%.*]] = icmp eq i1* [[A]], [[P]]
102; CHECK-NEXT:    ret i1 [[CMP]]
103; CHECK:       f:
104; CHECK-NEXT:    [[CALL:%.*]] = call i1 @recursive_inst_compare(i1 noundef true, i1* [[A]])
105; CHECK-NEXT:    ret i1 [[CALL]]
106;
107  %a = call i1* @geti1Ptr()
108  br i1 %c, label %t, label %f
109t:
110  %cmp = icmp eq i1* %a, %p
111  ret i1 %cmp
112f:
113  %call = call i1 @recursive_inst_compare(i1 true, i1* %a)
114  ret i1 %call
115}
116
117; FIXME: This should *not* return true.
118define i1 @recursive_inst_compare_caller(i1 %c) {
119; CHECK-LABEL: define {{[^@]+}}@recursive_inst_compare_caller
120; CHECK-SAME: (i1 [[C:%.*]]) {
121; CHECK-NEXT:    [[CALL:%.*]] = call i1 @recursive_inst_compare(i1 [[C]], i1* undef)
122; CHECK-NEXT:    ret i1 [[CALL]]
123;
124  %call = call i1 @recursive_inst_compare(i1 %c, i1* undef)
125  ret i1 %call
126}
127
128; Make sure we do *not* return true.
129define internal i1 @recursive_alloca_compare(i1 %c, i1* %p) {
130; CHECK: Function Attrs: nofree nosync nounwind readnone
131; CHECK-LABEL: define {{[^@]+}}@recursive_alloca_compare
132; CHECK-SAME: (i1 [[C:%.*]], i1* noalias nofree nonnull readnone [[P:%.*]]) #[[ATTR1:[0-9]+]] {
133; CHECK-NEXT:    [[A:%.*]] = alloca i1, align 1
134; CHECK-NEXT:    br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
135; CHECK:       t:
136; CHECK-NEXT:    [[CMP:%.*]] = icmp eq i1* [[A]], [[P]]
137; CHECK-NEXT:    ret i1 [[CMP]]
138; CHECK:       f:
139; CHECK-NEXT:    [[CALL:%.*]] = call i1 @recursive_alloca_compare(i1 noundef true, i1* noalias nofree noundef nonnull readnone dereferenceable(1) [[A]]) #[[ATTR1]]
140; CHECK-NEXT:    ret i1 [[CALL]]
141;
142  %a = alloca i1
143  br i1 %c, label %t, label %f
144t:
145  %cmp = icmp eq i1* %a, %p
146  ret i1 %cmp
147f:
148  %call = call i1 @recursive_alloca_compare(i1 true, i1* %a)
149  ret i1 %call
150}
151
152; FIXME: This should *not* return true.
153define i1 @recursive_alloca_compare_caller(i1 %c) {
154; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone
155; IS__TUNIT____-LABEL: define {{[^@]+}}@recursive_alloca_compare_caller
156; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR2:[0-9]+]] {
157; IS__TUNIT____-NEXT:    [[CALL:%.*]] = call i1 @recursive_alloca_compare(i1 [[C]], i1* undef) #[[ATTR1]]
158; IS__TUNIT____-NEXT:    ret i1 [[CALL]]
159;
160; IS__CGSCC____: Function Attrs: nofree nosync nounwind readnone
161; IS__CGSCC____-LABEL: define {{[^@]+}}@recursive_alloca_compare_caller
162; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
163; IS__CGSCC____-NEXT:    [[CALL:%.*]] = call i1 @recursive_alloca_compare(i1 [[C]], i1* undef) #[[ATTR4:[0-9]+]]
164; IS__CGSCC____-NEXT:    ret i1 [[CALL]]
165;
166  %call = call i1 @recursive_alloca_compare(i1 %c, i1* undef)
167  ret i1 %call
168}
169
170; Make sure we do *not* simplify this to return 0 or 1, return 42 is ok though.
171define internal i8 @recursive_alloca_load_return(i1 %c, i8* %p, i8 %v) {
172; IS__TUNIT____: Function Attrs: argmemonly nofree nosync nounwind
173; IS__TUNIT____-LABEL: define {{[^@]+}}@recursive_alloca_load_return
174; IS__TUNIT____-SAME: (i1 [[C:%.*]], i8* nocapture nofree nonnull readonly [[P:%.*]], i8 noundef [[V:%.*]]) #[[ATTR3:[0-9]+]] {
175; IS__TUNIT____-NEXT:    [[A:%.*]] = alloca i8, align 1
176; IS__TUNIT____-NEXT:    store i8 [[V]], i8* [[A]], align 1
177; IS__TUNIT____-NEXT:    br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
178; IS__TUNIT____:       t:
179; IS__TUNIT____-NEXT:    store i8 0, i8* [[A]], align 1
180; IS__TUNIT____-NEXT:    [[L:%.*]] = load i8, i8* [[P]], align 1
181; IS__TUNIT____-NEXT:    ret i8 [[L]]
182; IS__TUNIT____:       f:
183; IS__TUNIT____-NEXT:    [[CALL:%.*]] = call i8 @recursive_alloca_load_return(i1 noundef true, i8* noalias nocapture nofree noundef nonnull readonly dereferenceable(1) [[A]], i8 noundef 1) #[[ATTR4:[0-9]+]]
184; IS__TUNIT____-NEXT:    ret i8 [[CALL]]
185;
186; IS__CGSCC____: Function Attrs: argmemonly nofree nosync nounwind
187; IS__CGSCC____-LABEL: define {{[^@]+}}@recursive_alloca_load_return
188; IS__CGSCC____-SAME: (i1 [[C:%.*]], i8* nocapture nofree nonnull readonly [[P:%.*]], i8 noundef [[V:%.*]]) #[[ATTR2:[0-9]+]] {
189; IS__CGSCC____-NEXT:    [[A:%.*]] = alloca i8, align 1
190; IS__CGSCC____-NEXT:    store i8 [[V]], i8* [[A]], align 1
191; IS__CGSCC____-NEXT:    br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
192; IS__CGSCC____:       t:
193; IS__CGSCC____-NEXT:    store i8 0, i8* [[A]], align 1
194; IS__CGSCC____-NEXT:    [[L:%.*]] = load i8, i8* [[P]], align 1
195; IS__CGSCC____-NEXT:    ret i8 [[L]]
196; IS__CGSCC____:       f:
197; IS__CGSCC____-NEXT:    [[CALL:%.*]] = call i8 @recursive_alloca_load_return(i1 noundef true, i8* noalias nocapture nofree noundef nonnull readonly dereferenceable(1) [[A]], i8 noundef 1) #[[ATTR3:[0-9]+]]
198; IS__CGSCC____-NEXT:    ret i8 [[CALL]]
199;
200  %a = alloca i8
201  store i8 %v, i8* %a
202  br i1 %c, label %t, label %f
203t:
204  store i8 0, i8* %a
205  %l = load i8, i8* %p
206  ret i8 %l
207f:
208  %call = call i8 @recursive_alloca_load_return(i1 true, i8* %a, i8 1)
209  ret i8 %call
210}
211
212define i8 @recursive_alloca_load_return_caller(i1 %c) {
213; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone
214; IS__TUNIT____-LABEL: define {{[^@]+}}@recursive_alloca_load_return_caller
215; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR2]] {
216; IS__TUNIT____-NEXT:    [[CALL:%.*]] = call i8 @recursive_alloca_load_return(i1 [[C]], i8* undef, i8 noundef 42) #[[ATTR4]]
217; IS__TUNIT____-NEXT:    ret i8 [[CALL]]
218;
219; IS__CGSCC____: Function Attrs: nofree nosync nounwind readnone
220; IS__CGSCC____-LABEL: define {{[^@]+}}@recursive_alloca_load_return_caller
221; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
222; IS__CGSCC____-NEXT:    [[CALL:%.*]] = call i8 @recursive_alloca_load_return(i1 [[C]], i8* undef, i8 noundef 42) #[[ATTR5:[0-9]+]]
223; IS__CGSCC____-NEXT:    ret i8 [[CALL]]
224;
225  %call = call i8 @recursive_alloca_load_return(i1 %c, i8* undef, i8 42)
226  ret i8 %call
227}
228
229@G1 = private global i1* undef
230@G2 = private global i1* undef
231@G3 = private global i1 undef
232
233; Make sure we do *not* return true.
234define internal i1 @recursive_alloca_compare_global1(i1 %c) {
235; IS__TUNIT____: Function Attrs: nofree nosync nounwind
236; IS__TUNIT____-LABEL: define {{[^@]+}}@recursive_alloca_compare_global1
237; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR4]] {
238; IS__TUNIT____-NEXT:    [[A:%.*]] = alloca i1, align 1
239; IS__TUNIT____-NEXT:    br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
240; IS__TUNIT____:       t:
241; IS__TUNIT____-NEXT:    [[P:%.*]] = load i1*, i1** @G1, align 8
242; IS__TUNIT____-NEXT:    [[CMP:%.*]] = icmp eq i1* [[A]], [[P]]
243; IS__TUNIT____-NEXT:    ret i1 [[CMP]]
244; IS__TUNIT____:       f:
245; IS__TUNIT____-NEXT:    store i1* [[A]], i1** @G1, align 8
246; IS__TUNIT____-NEXT:    [[CALL:%.*]] = call i1 @recursive_alloca_compare_global1(i1 noundef true) #[[ATTR4]]
247; IS__TUNIT____-NEXT:    ret i1 [[CALL]]
248;
249; IS__CGSCC____: Function Attrs: nofree nosync nounwind
250; IS__CGSCC____-LABEL: define {{[^@]+}}@recursive_alloca_compare_global1
251; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR3]] {
252; IS__CGSCC____-NEXT:    [[A:%.*]] = alloca i1, align 1
253; IS__CGSCC____-NEXT:    br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
254; IS__CGSCC____:       t:
255; IS__CGSCC____-NEXT:    [[P:%.*]] = load i1*, i1** @G1, align 8
256; IS__CGSCC____-NEXT:    [[CMP:%.*]] = icmp eq i1* [[A]], [[P]]
257; IS__CGSCC____-NEXT:    ret i1 [[CMP]]
258; IS__CGSCC____:       f:
259; IS__CGSCC____-NEXT:    store i1* [[A]], i1** @G1, align 8
260; IS__CGSCC____-NEXT:    [[CALL:%.*]] = call i1 @recursive_alloca_compare_global1(i1 noundef true) #[[ATTR3]]
261; IS__CGSCC____-NEXT:    ret i1 [[CALL]]
262;
263  %a = alloca i1
264  br i1 %c, label %t, label %f
265t:
266  %p = load i1*, i1** @G1
267  %cmp = icmp eq i1* %a, %p
268  ret i1 %cmp
269f:
270  store i1* %a, i1** @G1
271  %call = call i1 @recursive_alloca_compare_global1(i1 true)
272  ret i1 %call
273}
274
275; FIXME: This should *not* return true.
276define i1 @recursive_alloca_compare_caller_global1(i1 %c) {
277; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind
278; IS__TUNIT____-LABEL: define {{[^@]+}}@recursive_alloca_compare_caller_global1
279; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR5:[0-9]+]] {
280; IS__TUNIT____-NEXT:    [[CALL:%.*]] = call i1 @recursive_alloca_compare_global1(i1 [[C]]) #[[ATTR4]]
281; IS__TUNIT____-NEXT:    ret i1 [[CALL]]
282;
283; IS__CGSCC____: Function Attrs: nofree nosync nounwind
284; IS__CGSCC____-LABEL: define {{[^@]+}}@recursive_alloca_compare_caller_global1
285; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR3]] {
286; IS__CGSCC____-NEXT:    [[CALL:%.*]] = call i1 @recursive_alloca_compare_global1(i1 [[C]]) #[[ATTR5]]
287; IS__CGSCC____-NEXT:    ret i1 [[CALL]]
288;
289  %call = call i1 @recursive_alloca_compare_global1(i1 %c)
290  ret i1 %call
291}
292
293define internal i1 @recursive_alloca_compare_global2(i1 %c) {
294; IS__TUNIT____: Function Attrs: nofree nosync nounwind
295; IS__TUNIT____-LABEL: define {{[^@]+}}@recursive_alloca_compare_global2
296; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR4]] {
297; IS__TUNIT____-NEXT:    [[A:%.*]] = alloca i1, align 1
298; IS__TUNIT____-NEXT:    [[P:%.*]] = load i1*, i1** @G2, align 8
299; IS__TUNIT____-NEXT:    store i1* [[A]], i1** @G2, align 8
300; IS__TUNIT____-NEXT:    br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
301; IS__TUNIT____:       t:
302; IS__TUNIT____-NEXT:    [[CMP:%.*]] = icmp eq i1* [[A]], [[P]]
303; IS__TUNIT____-NEXT:    ret i1 [[CMP]]
304; IS__TUNIT____:       f:
305; IS__TUNIT____-NEXT:    [[CALL:%.*]] = call i1 @recursive_alloca_compare_global2(i1 noundef true) #[[ATTR4]]
306; IS__TUNIT____-NEXT:    ret i1 [[CALL]]
307;
308; IS__CGSCC____: Function Attrs: nofree nosync nounwind
309; IS__CGSCC____-LABEL: define {{[^@]+}}@recursive_alloca_compare_global2
310; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR3]] {
311; IS__CGSCC____-NEXT:    [[A:%.*]] = alloca i1, align 1
312; IS__CGSCC____-NEXT:    [[P:%.*]] = load i1*, i1** @G2, align 8
313; IS__CGSCC____-NEXT:    store i1* [[A]], i1** @G2, align 8
314; IS__CGSCC____-NEXT:    br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
315; IS__CGSCC____:       t:
316; IS__CGSCC____-NEXT:    [[CMP:%.*]] = icmp eq i1* [[A]], [[P]]
317; IS__CGSCC____-NEXT:    ret i1 [[CMP]]
318; IS__CGSCC____:       f:
319; IS__CGSCC____-NEXT:    [[CALL:%.*]] = call i1 @recursive_alloca_compare_global2(i1 noundef true) #[[ATTR3]]
320; IS__CGSCC____-NEXT:    ret i1 [[CALL]]
321;
322  %a = alloca i1
323  %p = load i1*, i1** @G2
324  store i1* %a, i1** @G2
325  br i1 %c, label %t, label %f
326t:
327  %cmp = icmp eq i1* %a, %p
328  ret i1 %cmp
329f:
330  %call = call i1 @recursive_alloca_compare_global2(i1 true)
331  ret i1 %call
332}
333
334; FIXME: This should *not* return true.
335define i1 @recursive_alloca_compare_caller_global2(i1 %c) {
336; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind
337; IS__TUNIT____-LABEL: define {{[^@]+}}@recursive_alloca_compare_caller_global2
338; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR5]] {
339; IS__TUNIT____-NEXT:    [[CALL:%.*]] = call i1 @recursive_alloca_compare_global2(i1 [[C]]) #[[ATTR4]]
340; IS__TUNIT____-NEXT:    ret i1 [[CALL]]
341;
342; IS__CGSCC____: Function Attrs: nofree nosync nounwind
343; IS__CGSCC____-LABEL: define {{[^@]+}}@recursive_alloca_compare_caller_global2
344; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR3]] {
345; IS__CGSCC____-NEXT:    [[CALL:%.*]] = call i1 @recursive_alloca_compare_global2(i1 [[C]]) #[[ATTR5]]
346; IS__CGSCC____-NEXT:    ret i1 [[CALL]]
347;
348  %call = call i1 @recursive_alloca_compare_global2(i1 %c)
349  ret i1 %call
350}
351define internal i1 @recursive_inst_compare_global3(i1 %c) {
352;
353; IS__TUNIT____: Function Attrs: nofree nosync nounwind
354; IS__TUNIT____-LABEL: define {{[^@]+}}@recursive_inst_compare_global3
355; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR4]] {
356; IS__TUNIT____-NEXT:    [[P:%.*]] = load i1, i1* @G3, align 1
357; IS__TUNIT____-NEXT:    store i1 [[C]], i1* @G3, align 1
358; IS__TUNIT____-NEXT:    br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
359; IS__TUNIT____:       t:
360; IS__TUNIT____-NEXT:    [[CMP:%.*]] = icmp eq i1 [[C]], [[P]]
361; IS__TUNIT____-NEXT:    ret i1 [[CMP]]
362; IS__TUNIT____:       f:
363; IS__TUNIT____-NEXT:    [[CALL:%.*]] = call i1 @recursive_inst_compare_global3(i1 noundef true) #[[ATTR4]]
364; IS__TUNIT____-NEXT:    ret i1 [[CALL]]
365;
366; IS__CGSCC____: Function Attrs: nofree nosync nounwind
367; IS__CGSCC____-LABEL: define {{[^@]+}}@recursive_inst_compare_global3
368; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR3]] {
369; IS__CGSCC____-NEXT:    [[P:%.*]] = load i1, i1* @G3, align 1
370; IS__CGSCC____-NEXT:    store i1 [[C]], i1* @G3, align 1
371; IS__CGSCC____-NEXT:    br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
372; IS__CGSCC____:       t:
373; IS__CGSCC____-NEXT:    [[CMP:%.*]] = icmp eq i1 [[C]], [[P]]
374; IS__CGSCC____-NEXT:    ret i1 [[CMP]]
375; IS__CGSCC____:       f:
376; IS__CGSCC____-NEXT:    [[CALL:%.*]] = call i1 @recursive_inst_compare_global3(i1 noundef true) #[[ATTR3]]
377; IS__CGSCC____-NEXT:    ret i1 [[CALL]]
378;
379  %p = load i1, i1* @G3
380  store i1 %c, i1* @G3
381  br i1 %c, label %t, label %f
382t:
383  %cmp = icmp eq i1 %c, %p
384  ret i1 %cmp
385f:
386  %call = call i1 @recursive_inst_compare_global3(i1 true)
387  ret i1 %call
388}
389
390; FIXME: This should *not* return true.
391define i1 @recursive_inst_compare_caller_global3(i1 %c) {
392; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind
393; IS__TUNIT____-LABEL: define {{[^@]+}}@recursive_inst_compare_caller_global3
394; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR5]] {
395; IS__TUNIT____-NEXT:    [[CALL:%.*]] = call i1 @recursive_inst_compare_global3(i1 [[C]]) #[[ATTR4]]
396; IS__TUNIT____-NEXT:    ret i1 [[CALL]]
397;
398; IS__CGSCC____: Function Attrs: nofree nosync nounwind
399; IS__CGSCC____-LABEL: define {{[^@]+}}@recursive_inst_compare_caller_global3
400; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR3]] {
401; IS__CGSCC____-NEXT:    [[CALL:%.*]] = call i1 @recursive_inst_compare_global3(i1 [[C]]) #[[ATTR5]]
402; IS__CGSCC____-NEXT:    ret i1 [[CALL]]
403;
404  %call = call i1 @recursive_inst_compare_global3(i1 %c)
405  ret i1 %call
406}
407;.
408; IS__TUNIT____: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind readnone willreturn }
409; IS__TUNIT____: attributes #[[ATTR1]] = { nofree nosync nounwind readnone }
410; IS__TUNIT____: attributes #[[ATTR2]] = { nofree norecurse nosync nounwind readnone }
411; IS__TUNIT____: attributes #[[ATTR3]] = { argmemonly nofree nosync nounwind }
412; IS__TUNIT____: attributes #[[ATTR4]] = { nofree nosync nounwind }
413; IS__TUNIT____: attributes #[[ATTR5]] = { nofree norecurse nosync nounwind }
414; IS__TUNIT____: attributes #[[ATTR6:[0-9]+]] = { nounwind readnone }
415;.
416; IS__CGSCC____: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind readnone willreturn }
417; IS__CGSCC____: attributes #[[ATTR1]] = { nofree nosync nounwind readnone }
418; IS__CGSCC____: attributes #[[ATTR2]] = { argmemonly nofree nosync nounwind }
419; IS__CGSCC____: attributes #[[ATTR3]] = { nofree nosync nounwind }
420; IS__CGSCC____: attributes #[[ATTR4]] = { nounwind readnone }
421; IS__CGSCC____: attributes #[[ATTR5]] = { nounwind }
422;.
423