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=6 -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=6 -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
7; Most reduced from the OpenMC app running OpenMP offloading code, caused crashes before as we
8; mixed local and remote (=intra and inter procedural) values.
9
10target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
11
12%S = type { ptr }
13%S.2 = type { ptr, i64, i64 }
14%struct1 = type { %struct2 }
15%struct2 = type <{ ptr, i64, i64, i32, [4 x i8] }>
16
17define i64 @t1(ptr %first, ptr %first.addr, ptr %0) {
18; IS__TUNIT____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
19; IS__TUNIT____-LABEL: define {{[^@]+}}@t1
20; IS__TUNIT____-SAME: (ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[FIRST:%.*]], ptr nocapture nofree readnone [[FIRST_ADDR:%.*]], ptr nocapture nofree readnone [[TMP0:%.*]]) #[[ATTR0:[0-9]+]] {
21; IS__TUNIT____-NEXT:  entry:
22; IS__TUNIT____-NEXT:    [[FIRST_ADDR1:%.*]] = alloca ptr, i32 0, align 8
23; IS__TUNIT____-NEXT:    store ptr [[FIRST]], ptr [[FIRST]], align 8
24; IS__TUNIT____-NEXT:    br label [[IF_END:%.*]]
25; IS__TUNIT____:       if.end:
26; IS__TUNIT____-NEXT:    [[CALL:%.*]] = call ptr @foo.4(ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[FIRST]]) #[[ATTR3:[0-9]+]]
27; IS__TUNIT____-NEXT:    ret i64 0
28;
29; IS__CGSCC____: Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly
30; IS__CGSCC____-LABEL: define {{[^@]+}}@t1
31; IS__CGSCC____-SAME: (ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[FIRST:%.*]], ptr nocapture nofree readnone [[FIRST_ADDR:%.*]], ptr nocapture nofree readnone [[TMP0:%.*]]) #[[ATTR0:[0-9]+]] {
32; IS__CGSCC____-NEXT:  entry:
33; IS__CGSCC____-NEXT:    [[FIRST_ADDR1:%.*]] = alloca ptr, i32 0, align 8
34; IS__CGSCC____-NEXT:    store ptr [[FIRST]], ptr [[FIRST]], align 8
35; IS__CGSCC____-NEXT:    br label [[IF_END:%.*]]
36; IS__CGSCC____:       if.end:
37; IS__CGSCC____-NEXT:    [[CALL:%.*]] = call ptr @foo.4(ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[FIRST]]) #[[ATTR6:[0-9]+]]
38; IS__CGSCC____-NEXT:    [[ADD_PTR:%.*]] = getelementptr inbounds double, ptr [[CALL]], i64 -1
39; IS__CGSCC____-NEXT:    ret i64 0
40;
41entry:
42  %first.addr1 = alloca ptr, i32 0, align 8
43  store ptr %first, ptr %first, align 8
44  br label %if.end
45
46if.end:                                           ; preds = %entry
47  %1 = load ptr, ptr %first, align 8
48  %call = call ptr @foo.4(ptr %first)
49  %add.ptr = getelementptr inbounds double, ptr %call, i64 -1
50  ret i64 0
51}
52
53define internal ptr @foo.4(ptr %__first) {
54; IS__TUNIT____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
55; IS__TUNIT____-LABEL: define {{[^@]+}}@foo.4
56; IS__TUNIT____-SAME: (ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[__FIRST:%.*]]) #[[ATTR0]] {
57; IS__TUNIT____-NEXT:  entry:
58; IS__TUNIT____-NEXT:    [[__FIRST_ADDR:%.*]] = alloca ptr, i32 0, align 8
59; IS__TUNIT____-NEXT:    store ptr [[__FIRST]], ptr [[__FIRST]], align 8
60; IS__TUNIT____-NEXT:    ret ptr undef
61;
62; IS__CGSCC____: Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly
63; IS__CGSCC____-LABEL: define {{[^@]+}}@foo.4
64; IS__CGSCC____-SAME: (ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[__FIRST:%.*]]) #[[ATTR0]] {
65; IS__CGSCC____-NEXT:  entry:
66; IS__CGSCC____-NEXT:    [[__FIRST_ADDR:%.*]] = alloca ptr, i32 0, align 8
67; IS__CGSCC____-NEXT:    store ptr [[__FIRST]], ptr [[__FIRST]], align 8
68; IS__CGSCC____-NEXT:    [[CALL1:%.*]] = call noalias noundef nonnull align 8 dereferenceable(8) ptr @bar(ptr noalias nofree noundef nonnull readnone align 8 dereferenceable(8) [[__FIRST]]) #[[ATTR7:[0-9]+]]
69; IS__CGSCC____-NEXT:    ret ptr [[CALL1]]
70;
71entry:
72  %__first.addr = alloca ptr, i32 0, align 8
73  store ptr %__first, ptr %__first, align 8
74  %0 = load ptr, ptr %__first, align 8
75  %call1 = call ptr @bar(ptr %__first)
76  ret ptr %call1
77}
78
79define internal ptr @bar(ptr %QQfirst) {
80; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
81; IS__CGSCC____-LABEL: define {{[^@]+}}@bar
82; IS__CGSCC____-SAME: (ptr noalias nofree noundef nonnull readnone returned align 8 dereferenceable(8) "no-capture-maybe-returned" [[QQFIRST:%.*]]) #[[ATTR1:[0-9]+]] {
83; IS__CGSCC____-NEXT:  entry:
84; IS__CGSCC____-NEXT:    [[QQFIRST_ADDR:%.*]] = alloca ptr, i32 0, align 8
85; IS__CGSCC____-NEXT:    store ptr [[QQFIRST]], ptr [[QQFIRST_ADDR]], align 8
86; IS__CGSCC____-NEXT:    br label [[WHILE_COND:%.*]]
87; IS__CGSCC____:       while.cond:
88; IS__CGSCC____-NEXT:    br label [[WHILE_END:%.*]]
89; IS__CGSCC____:       while.end:
90; IS__CGSCC____-NEXT:    ret ptr [[QQFIRST]]
91;
92entry:
93  %QQfirst.addr = alloca ptr, i32 0, align 8
94  store ptr %QQfirst, ptr %QQfirst.addr, align 8
95  br label %while.cond
96
97while.cond:                                       ; preds = %entry
98  br label %while.end
99
100while.end:                                        ; preds = %while.cond
101  %0 = load ptr, ptr %QQfirst.addr, align 8
102  ret ptr %0
103}
104
105define ptr @t2(ptr %this, ptr %this.addr, ptr %this1) {
106; IS__TUNIT____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn
107; IS__TUNIT____-LABEL: define {{[^@]+}}@t2
108; IS__TUNIT____-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS:%.*]], ptr nocapture nofree readnone [[THIS_ADDR:%.*]], ptr nocapture nofree readnone [[THIS1:%.*]]) #[[ATTR1:[0-9]+]] {
109; IS__TUNIT____-NEXT:  entry:
110; IS__TUNIT____-NEXT:    store ptr [[THIS]], ptr [[THIS]], align 8
111; IS__TUNIT____-NEXT:    [[CALL:%.*]] = call [[S:%.*]] @foo.1(ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS]]) #[[ATTR4:[0-9]+]]
112; IS__TUNIT____-NEXT:    [[TEST_RET:%.*]] = extractvalue [[S]] [[CALL]], 0
113; IS__TUNIT____-NEXT:    ret ptr [[TEST_RET]]
114;
115; IS__CGSCC____: Function Attrs: argmemonly nofree nosync nounwind willreturn
116; IS__CGSCC____-LABEL: define {{[^@]+}}@t2
117; IS__CGSCC____-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS:%.*]], ptr nocapture nofree readnone [[THIS_ADDR:%.*]], ptr nocapture nofree readnone [[THIS1:%.*]]) #[[ATTR2:[0-9]+]] {
118; IS__CGSCC____-NEXT:  entry:
119; IS__CGSCC____-NEXT:    store ptr [[THIS]], ptr [[THIS]], align 8
120; IS__CGSCC____-NEXT:    [[CALL:%.*]] = call [[S:%.*]] @foo.1(ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS]]) #[[ATTR8:[0-9]+]]
121; IS__CGSCC____-NEXT:    [[TEST_RET:%.*]] = extractvalue [[S]] [[CALL]], 0
122; IS__CGSCC____-NEXT:    ret ptr [[TEST_RET]]
123;
124entry:
125  store ptr %this, ptr %this, align 8
126  %this12 = load ptr, ptr %this, align 8
127  %call = call %S @foo.1(ptr %this)
128  %test.ret = extractvalue %S %call, 0
129  ret ptr %test.ret
130}
131
132define internal %S @foo.1(ptr %foo.this) {
133; IS__TUNIT_OPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn
134; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@foo.1
135; IS__TUNIT_OPM-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[FOO_THIS:%.*]]) #[[ATTR1]] {
136; IS__TUNIT_OPM-NEXT:  entry:
137; IS__TUNIT_OPM-NEXT:    [[RETVAL:%.*]] = alloca [[S:%.*]], i32 0, align 8
138; IS__TUNIT_OPM-NEXT:    store ptr [[FOO_THIS]], ptr [[FOO_THIS]], align 8
139; IS__TUNIT_OPM-NEXT:    call void @bar.2(ptr nocapture nofree noundef nonnull writeonly align 8 [[RETVAL]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[FOO_THIS]]) #[[ATTR5:[0-9]+]]
140; IS__TUNIT_OPM-NEXT:    [[FOO_RET:%.*]] = load [[S]], ptr [[RETVAL]], align 8
141; IS__TUNIT_OPM-NEXT:    ret [[S]] [[FOO_RET]]
142;
143; IS__TUNIT_NPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn
144; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@foo.1
145; IS__TUNIT_NPM-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[FOO_THIS:%.*]]) #[[ATTR1]] {
146; IS__TUNIT_NPM-NEXT:  entry:
147; IS__TUNIT_NPM-NEXT:    [[RETVAL:%.*]] = alloca [[S:%.*]], i32 0, align 8
148; IS__TUNIT_NPM-NEXT:    store ptr [[FOO_THIS]], ptr [[FOO_THIS]], align 8
149; IS__TUNIT_NPM-NEXT:    call void @bar.2(ptr noalias nocapture nofree noundef nonnull writeonly align 8 [[RETVAL]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[FOO_THIS]]) #[[ATTR5:[0-9]+]]
150; IS__TUNIT_NPM-NEXT:    [[FOO_RET:%.*]] = load [[S]], ptr [[RETVAL]], align 8
151; IS__TUNIT_NPM-NEXT:    ret [[S]] [[FOO_RET]]
152;
153; IS__CGSCC_OPM: Function Attrs: argmemonly nofree nosync nounwind willreturn
154; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@foo.1
155; IS__CGSCC_OPM-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[FOO_THIS:%.*]]) #[[ATTR2]] {
156; IS__CGSCC_OPM-NEXT:  entry:
157; IS__CGSCC_OPM-NEXT:    [[RETVAL:%.*]] = alloca [[S:%.*]], i32 0, align 8
158; IS__CGSCC_OPM-NEXT:    store ptr [[FOO_THIS]], ptr [[FOO_THIS]], align 8
159; IS__CGSCC_OPM-NEXT:    call void @bar.2(ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[RETVAL]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[FOO_THIS]]) #[[ATTR6]]
160; IS__CGSCC_OPM-NEXT:    [[FOO_RET:%.*]] = load [[S]], ptr [[RETVAL]], align 8
161; IS__CGSCC_OPM-NEXT:    ret [[S]] [[FOO_RET]]
162;
163; IS__CGSCC_NPM: Function Attrs: argmemonly nofree nosync nounwind willreturn
164; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@foo.1
165; IS__CGSCC_NPM-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[FOO_THIS:%.*]]) #[[ATTR2]] {
166; IS__CGSCC_NPM-NEXT:  entry:
167; IS__CGSCC_NPM-NEXT:    [[RETVAL:%.*]] = alloca [[S:%.*]], i32 0, align 8
168; IS__CGSCC_NPM-NEXT:    store ptr [[FOO_THIS]], ptr [[FOO_THIS]], align 8
169; IS__CGSCC_NPM-NEXT:    call void @bar.2(ptr noalias nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[RETVAL]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[FOO_THIS]]) #[[ATTR6]]
170; IS__CGSCC_NPM-NEXT:    [[FOO_RET:%.*]] = load [[S]], ptr [[RETVAL]], align 8
171; IS__CGSCC_NPM-NEXT:    ret [[S]] [[FOO_RET]]
172;
173entry:
174  %retval = alloca %S, i32 0, align 8
175  store ptr %foo.this, ptr %foo.this, align 8
176  call void @bar.2(ptr %retval, ptr %foo.this)
177  %foo.ret = load %S, ptr %retval, align 8
178  ret %S %foo.ret
179}
180
181define internal void @bar.2(ptr %bar.this, ptr %bar.data) {
182; IS__TUNIT_OPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
183; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@bar.2
184; IS__TUNIT_OPM-SAME: (ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_THIS:%.*]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_DATA:%.*]]) #[[ATTR0]] {
185; IS__TUNIT_OPM-NEXT:  entry:
186; IS__TUNIT_OPM-NEXT:    store ptr [[BAR_DATA]], ptr [[BAR_THIS]], align 8
187; IS__TUNIT_OPM-NEXT:    call void @baz(ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_THIS]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_DATA]]) #[[ATTR5]]
188; IS__TUNIT_OPM-NEXT:    ret void
189;
190; IS__TUNIT_NPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
191; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@bar.2
192; IS__TUNIT_NPM-SAME: (ptr noalias nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_THIS:%.*]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_DATA:%.*]]) #[[ATTR0]] {
193; IS__TUNIT_NPM-NEXT:  entry:
194; IS__TUNIT_NPM-NEXT:    store ptr [[BAR_DATA]], ptr [[BAR_THIS]], align 8
195; IS__TUNIT_NPM-NEXT:    call void @baz(ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_THIS]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_DATA]]) #[[ATTR5]]
196; IS__TUNIT_NPM-NEXT:    ret void
197;
198; IS__CGSCC_OPM: Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly
199; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@bar.2
200; IS__CGSCC_OPM-SAME: (ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_THIS:%.*]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_DATA:%.*]]) #[[ATTR0]] {
201; IS__CGSCC_OPM-NEXT:  entry:
202; IS__CGSCC_OPM-NEXT:    store ptr [[BAR_DATA]], ptr [[BAR_THIS]], align 8
203; IS__CGSCC_OPM-NEXT:    call void @baz(ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_THIS]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_DATA]]) #[[ATTR6]]
204; IS__CGSCC_OPM-NEXT:    ret void
205;
206; IS__CGSCC_NPM: Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly
207; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@bar.2
208; IS__CGSCC_NPM-SAME: (ptr noalias nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_THIS:%.*]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_DATA:%.*]]) #[[ATTR0]] {
209; IS__CGSCC_NPM-NEXT:  entry:
210; IS__CGSCC_NPM-NEXT:    store ptr [[BAR_DATA]], ptr [[BAR_THIS]], align 8
211; IS__CGSCC_NPM-NEXT:    call void @baz(ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_THIS]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_DATA]]) #[[ATTR6]]
212; IS__CGSCC_NPM-NEXT:    ret void
213;
214entry:
215  store ptr %bar.data, ptr %bar.this, align 8
216  call void @baz(ptr %bar.this, ptr %bar.data)
217  ret void
218}
219
220define internal void @baz(ptr %baz.this, ptr %baz.data) {
221; IS__TUNIT____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
222; IS__TUNIT____-LABEL: define {{[^@]+}}@baz
223; IS__TUNIT____-SAME: (ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAZ_THIS:%.*]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAZ_DATA:%.*]]) #[[ATTR0]] {
224; IS__TUNIT____-NEXT:  entry:
225; IS__TUNIT____-NEXT:    store ptr [[BAZ_DATA]], ptr [[BAZ_THIS]], align 8
226; IS__TUNIT____-NEXT:    ret void
227;
228; IS__CGSCC____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
229; IS__CGSCC____-LABEL: define {{[^@]+}}@baz
230; IS__CGSCC____-SAME: (ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAZ_THIS:%.*]], ptr nofree writeonly [[BAZ_DATA:%.*]]) #[[ATTR3:[0-9]+]] {
231; IS__CGSCC____-NEXT:  entry:
232; IS__CGSCC____-NEXT:    store ptr [[BAZ_DATA]], ptr [[BAZ_THIS]], align 8
233; IS__CGSCC____-NEXT:    ret void
234;
235entry:
236  store ptr %baz.data, ptr %baz.this, align 8
237  ret void
238}
239
240define ptr @foo(ptr %this, ptr %this.addr, ptr %this1) {
241; IS__TUNIT____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn
242; IS__TUNIT____-LABEL: define {{[^@]+}}@foo
243; IS__TUNIT____-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS:%.*]], ptr nocapture nofree readnone [[THIS_ADDR:%.*]], ptr nocapture nofree readnone [[THIS1:%.*]]) #[[ATTR1]] {
244; IS__TUNIT____-NEXT:  entry:
245; IS__TUNIT____-NEXT:    store ptr [[THIS]], ptr [[THIS]], align 8
246; IS__TUNIT____-NEXT:    [[CALL:%.*]] = call [[S:%.*]] @bar.5(ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS]]) #[[ATTR4]]
247; IS__TUNIT____-NEXT:    [[FOO_RET:%.*]] = extractvalue [[S]] [[CALL]], 0
248; IS__TUNIT____-NEXT:    ret ptr [[FOO_RET]]
249;
250; IS__CGSCC____: Function Attrs: argmemonly nofree nosync nounwind willreturn
251; IS__CGSCC____-LABEL: define {{[^@]+}}@foo
252; IS__CGSCC____-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS:%.*]], ptr nocapture nofree readnone [[THIS_ADDR:%.*]], ptr nocapture nofree readnone [[THIS1:%.*]]) #[[ATTR2]] {
253; IS__CGSCC____-NEXT:  entry:
254; IS__CGSCC____-NEXT:    store ptr [[THIS]], ptr [[THIS]], align 8
255; IS__CGSCC____-NEXT:    [[CALL:%.*]] = call [[S:%.*]] @bar.5(ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS]]) #[[ATTR8]]
256; IS__CGSCC____-NEXT:    [[FOO_RET:%.*]] = extractvalue [[S]] [[CALL]], 0
257; IS__CGSCC____-NEXT:    ret ptr [[FOO_RET]]
258;
259entry:
260  store ptr %this, ptr %this, align 8
261  %this12 = load ptr, ptr %this, align 8
262  %call = call %S @bar.5(ptr %this)
263  %foo.ret = extractvalue %S %call, 0
264  ret ptr %foo.ret
265}
266
267define internal %S @bar.5(ptr %this) {
268; IS__TUNIT_OPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn
269; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@bar.5
270; IS__TUNIT_OPM-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS:%.*]]) #[[ATTR1]] {
271; IS__TUNIT_OPM-NEXT:  entry:
272; IS__TUNIT_OPM-NEXT:    [[RETVAL:%.*]] = alloca [[S:%.*]], i32 0, align 8
273; IS__TUNIT_OPM-NEXT:    store ptr [[THIS]], ptr [[THIS]], align 8
274; IS__TUNIT_OPM-NEXT:    call void @baz.6(ptr nocapture nofree noundef nonnull writeonly align 8 [[RETVAL]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS]]) #[[ATTR4]]
275; IS__TUNIT_OPM-NEXT:    [[BAR_RET:%.*]] = load [[S]], ptr [[RETVAL]], align 8
276; IS__TUNIT_OPM-NEXT:    ret [[S]] [[BAR_RET]]
277;
278; IS__TUNIT_NPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn
279; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@bar.5
280; IS__TUNIT_NPM-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS:%.*]]) #[[ATTR1]] {
281; IS__TUNIT_NPM-NEXT:  entry:
282; IS__TUNIT_NPM-NEXT:    [[RETVAL:%.*]] = alloca [[S:%.*]], i32 0, align 8
283; IS__TUNIT_NPM-NEXT:    store ptr [[THIS]], ptr [[THIS]], align 8
284; IS__TUNIT_NPM-NEXT:    call void @baz.6(ptr noalias nocapture nofree noundef nonnull writeonly align 8 [[RETVAL]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS]]) #[[ATTR4]]
285; IS__TUNIT_NPM-NEXT:    [[BAR_RET:%.*]] = load [[S]], ptr [[RETVAL]], align 8
286; IS__TUNIT_NPM-NEXT:    ret [[S]] [[BAR_RET]]
287;
288; IS__CGSCC_OPM: Function Attrs: argmemonly nofree nosync nounwind willreturn
289; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@bar.5
290; IS__CGSCC_OPM-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS:%.*]]) #[[ATTR2]] {
291; IS__CGSCC_OPM-NEXT:  entry:
292; IS__CGSCC_OPM-NEXT:    [[RETVAL:%.*]] = alloca [[S:%.*]], i32 0, align 8
293; IS__CGSCC_OPM-NEXT:    store ptr [[THIS]], ptr [[THIS]], align 8
294; IS__CGSCC_OPM-NEXT:    call void @baz.6(ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[RETVAL]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS]]) #[[ATTR8]]
295; IS__CGSCC_OPM-NEXT:    [[BAR_RET:%.*]] = load [[S]], ptr [[RETVAL]], align 8
296; IS__CGSCC_OPM-NEXT:    ret [[S]] [[BAR_RET]]
297;
298; IS__CGSCC_NPM: Function Attrs: argmemonly nofree nosync nounwind willreturn
299; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@bar.5
300; IS__CGSCC_NPM-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS:%.*]]) #[[ATTR2]] {
301; IS__CGSCC_NPM-NEXT:  entry:
302; IS__CGSCC_NPM-NEXT:    [[RETVAL:%.*]] = alloca [[S:%.*]], i32 0, align 8
303; IS__CGSCC_NPM-NEXT:    store ptr [[THIS]], ptr [[THIS]], align 8
304; IS__CGSCC_NPM-NEXT:    call void @baz.6(ptr noalias nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[RETVAL]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS]]) #[[ATTR8]]
305; IS__CGSCC_NPM-NEXT:    [[BAR_RET:%.*]] = load [[S]], ptr [[RETVAL]], align 8
306; IS__CGSCC_NPM-NEXT:    ret [[S]] [[BAR_RET]]
307;
308entry:
309  %retval = alloca %S, i32 0, align 8
310  store ptr %this, ptr %this, align 8
311  %0 = load ptr, ptr %this, align 8
312  call void @baz.6(ptr %retval, ptr %this)
313  %bar.ret = load %S, ptr %retval, align 8
314  ret %S %bar.ret
315}
316
317define internal void @baz.6(ptr %this, ptr %data) {
318; IS__TUNIT_OPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn
319; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@baz.6
320; IS__TUNIT_OPM-SAME: (ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS:%.*]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[DATA:%.*]]) #[[ATTR1]] {
321; IS__TUNIT_OPM-NEXT:  entry:
322; IS__TUNIT_OPM-NEXT:    store ptr [[DATA]], ptr [[THIS]], align 8
323; IS__TUNIT_OPM-NEXT:    call void @boom(ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[DATA]]) #[[ATTR4]]
324; IS__TUNIT_OPM-NEXT:    ret void
325;
326; IS__TUNIT_NPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn
327; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@baz.6
328; IS__TUNIT_NPM-SAME: (ptr noalias nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS:%.*]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[DATA:%.*]]) #[[ATTR1]] {
329; IS__TUNIT_NPM-NEXT:  entry:
330; IS__TUNIT_NPM-NEXT:    store ptr [[DATA]], ptr [[THIS]], align 8
331; IS__TUNIT_NPM-NEXT:    call void @boom(ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[DATA]]) #[[ATTR4]]
332; IS__TUNIT_NPM-NEXT:    ret void
333;
334; IS__CGSCC_OPM: Function Attrs: argmemonly nofree nosync nounwind willreturn
335; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@baz.6
336; IS__CGSCC_OPM-SAME: (ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS:%.*]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[DATA:%.*]]) #[[ATTR2]] {
337; IS__CGSCC_OPM-NEXT:  entry:
338; IS__CGSCC_OPM-NEXT:    store ptr [[DATA]], ptr [[THIS]], align 8
339; IS__CGSCC_OPM-NEXT:    call void @boom(ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[DATA]]) #[[ATTR8]]
340; IS__CGSCC_OPM-NEXT:    ret void
341;
342; IS__CGSCC_NPM: Function Attrs: argmemonly nofree nosync nounwind willreturn
343; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@baz.6
344; IS__CGSCC_NPM-SAME: (ptr noalias nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS:%.*]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[DATA:%.*]]) #[[ATTR2]] {
345; IS__CGSCC_NPM-NEXT:  entry:
346; IS__CGSCC_NPM-NEXT:    store ptr [[DATA]], ptr [[THIS]], align 8
347; IS__CGSCC_NPM-NEXT:    call void @boom(ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[DATA]]) #[[ATTR8]]
348; IS__CGSCC_NPM-NEXT:    ret void
349;
350entry:
351  store ptr %data, ptr %this, align 8
352  call void @boom(ptr %this, ptr %data)
353  ret void
354}
355
356define internal void @boom(ptr %this, ptr %data) {
357; IS__TUNIT____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn
358; IS__TUNIT____-LABEL: define {{[^@]+}}@boom
359; IS__TUNIT____-SAME: (ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS:%.*]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[DATA:%.*]]) #[[ATTR1]] {
360; IS__TUNIT____-NEXT:  entry:
361; IS__TUNIT____-NEXT:    [[DATA_ADDR:%.*]] = alloca ptr, i32 0, align 8
362; IS__TUNIT____-NEXT:    store ptr [[DATA]], ptr [[DATA_ADDR]], align 8
363; IS__TUNIT____-NEXT:    [[V:%.*]] = load ptr, ptr [[DATA_ADDR]], align 8
364; IS__TUNIT____-NEXT:    store ptr [[V]], ptr [[THIS]], align 8
365; IS__TUNIT____-NEXT:    ret void
366;
367; IS__CGSCC____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn
368; IS__CGSCC____-LABEL: define {{[^@]+}}@boom
369; IS__CGSCC____-SAME: (ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS:%.*]], ptr nofree [[DATA:%.*]]) #[[ATTR4:[0-9]+]] {
370; IS__CGSCC____-NEXT:  entry:
371; IS__CGSCC____-NEXT:    [[DATA_ADDR:%.*]] = alloca ptr, i32 0, align 8
372; IS__CGSCC____-NEXT:    store ptr [[DATA]], ptr [[DATA_ADDR]], align 8
373; IS__CGSCC____-NEXT:    store ptr [[DATA]], ptr [[THIS]], align 8
374; IS__CGSCC____-NEXT:    ret void
375;
376entry:
377  %data.addr = alloca ptr, i32 0, align 8
378  store ptr %data, ptr %data.addr, align 8
379  %v = load ptr, ptr %data.addr, align 8
380  store ptr %v, ptr %this, align 8
381  ret void
382}
383
384define weak_odr void @t3() {
385; CHECK-LABEL: define {{[^@]+}}@t3() {
386; CHECK-NEXT:  entry:
387; CHECK-NEXT:    [[TMP0:%.*]] = call i32 @__kmpc_target_init(ptr noalias nocapture noundef align 4294967296 null, i8 noundef 0, i1 noundef false, i1 noundef false)
388; CHECK-NEXT:    br label [[USER_CODE_ENTRY:%.*]]
389; CHECK:       user_code.entry:
390; CHECK-NEXT:    br label [[FOR_COND:%.*]]
391; CHECK:       for.cond:
392; CHECK-NEXT:    br label [[FOR_BODY:%.*]]
393; CHECK:       for.body:
394; CHECK-NEXT:    [[CALL4:%.*]] = call [[S_2:%.*]] @t3.helper()
395; CHECK-NEXT:    ret void
396;
397entry:
398  %0 = call i32 @__kmpc_target_init(ptr null, i8 0, i1 false, i1 false)
399  br label %user_code.entry
400
401user_code.entry:                                  ; preds = %entry
402  br label %for.cond
403
404for.cond:                                         ; preds = %user_code.entry
405  br label %for.body
406
407for.body:                                         ; preds = %for.cond
408  %call4 = call %S.2 @t3.helper()
409  ret void
410}
411
412declare i32 @__kmpc_target_init(ptr, i8, i1, i1)
413
414define %S.2 @t3.helper() {
415; CHECK-LABEL: define {{[^@]+}}@t3.helper() {
416; CHECK-NEXT:  entry:
417; CHECK-NEXT:    [[RETVAL:%.*]] = alloca [[S_2:%.*]], align 8
418; CHECK-NEXT:    call void @ext1(ptr noundef nonnull align 8 dereferenceable(24) [[RETVAL]])
419; CHECK-NEXT:    [[DOTFCA_0_LOAD:%.*]] = load ptr, ptr [[RETVAL]], align 8
420; CHECK-NEXT:    [[DOTFCA_0_INSERT:%.*]] = insertvalue [[S_2]] poison, ptr [[DOTFCA_0_LOAD]], 0
421; CHECK-NEXT:    [[DOTFCA_1_GEP:%.*]] = getelementptr inbounds [[S_2]], ptr [[RETVAL]], i32 0, i32 1
422; CHECK-NEXT:    [[DOTFCA_1_LOAD:%.*]] = load i64, ptr [[DOTFCA_1_GEP]], align 8
423; CHECK-NEXT:    [[DOTFCA_1_INSERT:%.*]] = insertvalue [[S_2]] [[DOTFCA_0_INSERT]], i64 [[DOTFCA_1_LOAD]], 1
424; CHECK-NEXT:    [[DOTFCA_2_GEP:%.*]] = getelementptr inbounds [[S_2]], ptr [[RETVAL]], i32 0, i32 2
425; CHECK-NEXT:    [[DOTFCA_2_LOAD:%.*]] = load i64, ptr [[DOTFCA_2_GEP]], align 8
426; CHECK-NEXT:    [[DOTFCA_2_INSERT:%.*]] = insertvalue [[S_2]] [[DOTFCA_1_INSERT]], i64 [[DOTFCA_2_LOAD]], 2
427; CHECK-NEXT:    ret [[S_2]] zeroinitializer
428;
429entry:
430  %retval = alloca %S.2, align 8
431  call void @ext1(ptr %retval)
432  %.fca.0.gep = getelementptr inbounds %S.2, ptr %retval, i32 0, i32 0
433  %.fca.0.load = load ptr, ptr %.fca.0.gep, align 8
434  %.fca.0.insert = insertvalue %S.2 poison, ptr %.fca.0.load, 0
435  %.fca.1.gep = getelementptr inbounds %S.2, ptr %retval, i32 0, i32 1
436  %.fca.1.load = load i64, ptr %.fca.1.gep, align 8
437  %.fca.1.insert = insertvalue %S.2 %.fca.0.insert, i64 %.fca.1.load, 1
438  %.fca.2.gep = getelementptr inbounds %S.2, ptr %retval, i32 0, i32 2
439  %.fca.2.load = load i64, ptr %.fca.2.gep, align 8
440  %.fca.2.insert = insertvalue %S.2 %.fca.1.insert, i64 %.fca.2.load, 2
441  ret %S.2 zeroinitializer
442}
443
444declare void @ext1(ptr)
445
446; Taken from https://github.com/llvm/llvm-project/issues/54981
447define dso_local void @spam() {
448; IS__TUNIT_OPM: Function Attrs: nofree norecurse noreturn nosync nounwind readnone
449; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@spam
450; IS__TUNIT_OPM-SAME: () #[[ATTR2:[0-9]+]] {
451; IS__TUNIT_OPM-NEXT:  bb:
452; IS__TUNIT_OPM-NEXT:    [[TMP:%.*]] = alloca i32, align 4
453; IS__TUNIT_OPM-NEXT:    [[X:%.*]] = fptosi float undef to i32
454; IS__TUNIT_OPM-NEXT:    store i32 [[X]], ptr [[TMP]], align 4
455; IS__TUNIT_OPM-NEXT:    br label [[BB16:%.*]]
456; IS__TUNIT_OPM:       bb16:
457; IS__TUNIT_OPM-NEXT:    [[TMP17:%.*]] = load i32, ptr [[TMP]], align 4
458; IS__TUNIT_OPM-NEXT:    [[TMP18:%.*]] = icmp eq i32 [[TMP17]], 0
459; IS__TUNIT_OPM-NEXT:    br i1 [[TMP18]], label [[BB35:%.*]], label [[BB19:%.*]]
460; IS__TUNIT_OPM:       bb19:
461; IS__TUNIT_OPM-NEXT:    [[Y:%.*]] = getelementptr inbounds i32, ptr [[TMP]], i64 0
462; IS__TUNIT_OPM-NEXT:    [[TMP20:%.*]] = bitcast ptr [[Y]] to ptr
463; IS__TUNIT_OPM-NEXT:    [[TMP21:%.*]] = load float, ptr [[TMP20]], align 4
464; IS__TUNIT_OPM-NEXT:    [[TMP22:%.*]] = fadd fast float [[TMP21]], 0.000000e+00
465; IS__TUNIT_OPM-NEXT:    br label [[BB23:%.*]]
466; IS__TUNIT_OPM:       bb23:
467; IS__TUNIT_OPM-NEXT:    [[TMP24:%.*]] = phi <2 x float> [ undef, [[BB19]] ], [ [[TMP26:%.*]], [[BB34:%.*]] ]
468; IS__TUNIT_OPM-NEXT:    br label [[BB25:%.*]]
469; IS__TUNIT_OPM:       bb25:
470; IS__TUNIT_OPM-NEXT:    [[TMP26]] = phi <2 x float> [ [[TMP30:%.*]], [[BB28:%.*]] ], [ [[TMP24]], [[BB23]] ]
471; IS__TUNIT_OPM-NEXT:    [[TMP27:%.*]] = icmp ult i32 undef, 8
472; IS__TUNIT_OPM-NEXT:    br i1 [[TMP27]], label [[BB28]], label [[BB34]]
473; IS__TUNIT_OPM:       bb28:
474; IS__TUNIT_OPM-NEXT:    [[TMP29:%.*]] = insertelement <2 x float> [[TMP26]], float undef, i32 0
475; IS__TUNIT_OPM-NEXT:    [[TMP30]] = insertelement <2 x float> [[TMP29]], float [[TMP22]], i32 1
476; IS__TUNIT_OPM-NEXT:    br label [[BB25]]
477; IS__TUNIT_OPM:       bb34:
478; IS__TUNIT_OPM-NEXT:    br label [[BB23]]
479; IS__TUNIT_OPM:       bb35:
480; IS__TUNIT_OPM-NEXT:    unreachable
481;
482; IS__TUNIT_NPM: Function Attrs: nofree norecurse noreturn nosync nounwind readnone
483; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@spam
484; IS__TUNIT_NPM-SAME: () #[[ATTR2:[0-9]+]] {
485; IS__TUNIT_NPM-NEXT:  bb:
486; IS__TUNIT_NPM-NEXT:    [[TMP:%.*]] = alloca i32, align 4
487; IS__TUNIT_NPM-NEXT:    [[X:%.*]] = fptosi float undef to i32
488; IS__TUNIT_NPM-NEXT:    store i32 [[X]], ptr [[TMP]], align 4
489; IS__TUNIT_NPM-NEXT:    br label [[BB16:%.*]]
490; IS__TUNIT_NPM:       bb16:
491; IS__TUNIT_NPM-NEXT:    [[TMP18:%.*]] = icmp eq i32 [[X]], 0
492; IS__TUNIT_NPM-NEXT:    br i1 [[TMP18]], label [[BB35:%.*]], label [[BB19:%.*]]
493; IS__TUNIT_NPM:       bb19:
494; IS__TUNIT_NPM-NEXT:    [[TMP21:%.*]] = load float, ptr [[TMP]], align 4
495; IS__TUNIT_NPM-NEXT:    [[TMP22:%.*]] = fadd fast float [[TMP21]], 0.000000e+00
496; IS__TUNIT_NPM-NEXT:    br label [[BB23:%.*]]
497; IS__TUNIT_NPM:       bb23:
498; IS__TUNIT_NPM-NEXT:    [[TMP24:%.*]] = phi <2 x float> [ undef, [[BB19]] ], [ [[TMP26:%.*]], [[BB34:%.*]] ]
499; IS__TUNIT_NPM-NEXT:    br label [[BB25:%.*]]
500; IS__TUNIT_NPM:       bb25:
501; IS__TUNIT_NPM-NEXT:    [[TMP26]] = phi <2 x float> [ [[TMP30:%.*]], [[BB28:%.*]] ], [ [[TMP24]], [[BB23]] ]
502; IS__TUNIT_NPM-NEXT:    [[TMP27:%.*]] = icmp ult i32 undef, 8
503; IS__TUNIT_NPM-NEXT:    br i1 [[TMP27]], label [[BB28]], label [[BB34]]
504; IS__TUNIT_NPM:       bb28:
505; IS__TUNIT_NPM-NEXT:    [[TMP29:%.*]] = insertelement <2 x float> [[TMP26]], float undef, i32 0
506; IS__TUNIT_NPM-NEXT:    [[TMP30]] = insertelement <2 x float> [[TMP29]], float [[TMP22]], i32 1
507; IS__TUNIT_NPM-NEXT:    br label [[BB25]]
508; IS__TUNIT_NPM:       bb34:
509; IS__TUNIT_NPM-NEXT:    br label [[BB23]]
510; IS__TUNIT_NPM:       bb35:
511; IS__TUNIT_NPM-NEXT:    unreachable
512;
513; IS__CGSCC_OPM: Function Attrs: nofree norecurse noreturn nosync nounwind readnone
514; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@spam
515; IS__CGSCC_OPM-SAME: () #[[ATTR5:[0-9]+]] {
516; IS__CGSCC_OPM-NEXT:  bb:
517; IS__CGSCC_OPM-NEXT:    [[TMP:%.*]] = alloca i32, align 4
518; IS__CGSCC_OPM-NEXT:    [[X:%.*]] = fptosi float undef to i32
519; IS__CGSCC_OPM-NEXT:    store i32 [[X]], ptr [[TMP]], align 4
520; IS__CGSCC_OPM-NEXT:    br label [[BB16:%.*]]
521; IS__CGSCC_OPM:       bb16:
522; IS__CGSCC_OPM-NEXT:    [[TMP17:%.*]] = load i32, ptr [[TMP]], align 4
523; IS__CGSCC_OPM-NEXT:    [[TMP18:%.*]] = icmp eq i32 [[TMP17]], 0
524; IS__CGSCC_OPM-NEXT:    br i1 [[TMP18]], label [[BB35:%.*]], label [[BB19:%.*]]
525; IS__CGSCC_OPM:       bb19:
526; IS__CGSCC_OPM-NEXT:    [[Y:%.*]] = getelementptr inbounds i32, ptr [[TMP]], i64 0
527; IS__CGSCC_OPM-NEXT:    [[TMP20:%.*]] = bitcast ptr [[Y]] to ptr
528; IS__CGSCC_OPM-NEXT:    [[TMP21:%.*]] = load float, ptr [[TMP20]], align 4
529; IS__CGSCC_OPM-NEXT:    [[TMP22:%.*]] = fadd fast float [[TMP21]], 0.000000e+00
530; IS__CGSCC_OPM-NEXT:    br label [[BB23:%.*]]
531; IS__CGSCC_OPM:       bb23:
532; IS__CGSCC_OPM-NEXT:    [[TMP24:%.*]] = phi <2 x float> [ undef, [[BB19]] ], [ [[TMP26:%.*]], [[BB34:%.*]] ]
533; IS__CGSCC_OPM-NEXT:    br label [[BB25:%.*]]
534; IS__CGSCC_OPM:       bb25:
535; IS__CGSCC_OPM-NEXT:    [[TMP26]] = phi <2 x float> [ [[TMP30:%.*]], [[BB28:%.*]] ], [ [[TMP24]], [[BB23]] ]
536; IS__CGSCC_OPM-NEXT:    [[TMP27:%.*]] = icmp ult i32 undef, 8
537; IS__CGSCC_OPM-NEXT:    br i1 [[TMP27]], label [[BB28]], label [[BB34]]
538; IS__CGSCC_OPM:       bb28:
539; IS__CGSCC_OPM-NEXT:    [[TMP29:%.*]] = insertelement <2 x float> [[TMP26]], float undef, i32 0
540; IS__CGSCC_OPM-NEXT:    [[TMP30]] = insertelement <2 x float> [[TMP29]], float [[TMP22]], i32 1
541; IS__CGSCC_OPM-NEXT:    br label [[BB25]]
542; IS__CGSCC_OPM:       bb34:
543; IS__CGSCC_OPM-NEXT:    br label [[BB23]]
544; IS__CGSCC_OPM:       bb35:
545; IS__CGSCC_OPM-NEXT:    unreachable
546;
547; IS__CGSCC_NPM: Function Attrs: nofree norecurse noreturn nosync nounwind readnone
548; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@spam
549; IS__CGSCC_NPM-SAME: () #[[ATTR5:[0-9]+]] {
550; IS__CGSCC_NPM-NEXT:  bb:
551; IS__CGSCC_NPM-NEXT:    [[TMP:%.*]] = alloca i32, align 4
552; IS__CGSCC_NPM-NEXT:    [[X:%.*]] = fptosi float undef to i32
553; IS__CGSCC_NPM-NEXT:    store i32 [[X]], ptr [[TMP]], align 4
554; IS__CGSCC_NPM-NEXT:    br label [[BB16:%.*]]
555; IS__CGSCC_NPM:       bb16:
556; IS__CGSCC_NPM-NEXT:    [[TMP18:%.*]] = icmp eq i32 [[X]], 0
557; IS__CGSCC_NPM-NEXT:    br i1 [[TMP18]], label [[BB35:%.*]], label [[BB19:%.*]]
558; IS__CGSCC_NPM:       bb19:
559; IS__CGSCC_NPM-NEXT:    [[TMP21:%.*]] = load float, ptr [[TMP]], align 4
560; IS__CGSCC_NPM-NEXT:    [[TMP22:%.*]] = fadd fast float [[TMP21]], 0.000000e+00
561; IS__CGSCC_NPM-NEXT:    br label [[BB23:%.*]]
562; IS__CGSCC_NPM:       bb23:
563; IS__CGSCC_NPM-NEXT:    [[TMP24:%.*]] = phi <2 x float> [ undef, [[BB19]] ], [ [[TMP26:%.*]], [[BB34:%.*]] ]
564; IS__CGSCC_NPM-NEXT:    br label [[BB25:%.*]]
565; IS__CGSCC_NPM:       bb25:
566; IS__CGSCC_NPM-NEXT:    [[TMP26]] = phi <2 x float> [ [[TMP30:%.*]], [[BB28:%.*]] ], [ [[TMP24]], [[BB23]] ]
567; IS__CGSCC_NPM-NEXT:    [[TMP27:%.*]] = icmp ult i32 undef, 8
568; IS__CGSCC_NPM-NEXT:    br i1 [[TMP27]], label [[BB28]], label [[BB34]]
569; IS__CGSCC_NPM:       bb28:
570; IS__CGSCC_NPM-NEXT:    [[TMP29:%.*]] = insertelement <2 x float> [[TMP26]], float undef, i32 0
571; IS__CGSCC_NPM-NEXT:    [[TMP30]] = insertelement <2 x float> [[TMP29]], float [[TMP22]], i32 1
572; IS__CGSCC_NPM-NEXT:    br label [[BB25]]
573; IS__CGSCC_NPM:       bb34:
574; IS__CGSCC_NPM-NEXT:    br label [[BB23]]
575; IS__CGSCC_NPM:       bb35:
576; IS__CGSCC_NPM-NEXT:    unreachable
577;
578bb:
579  %tmp = alloca i32, align 4
580  %tmp12 = getelementptr inbounds i32, ptr %tmp, i64 0
581  %tmp15 = getelementptr inbounds i32, ptr %tmp, i64 0
582  %x = fptosi float undef to i32
583  store i32 %x, ptr %tmp15, align 4
584  br label %bb16
585
586bb16:                                             ; preds = %bb
587  %tmp17 = load i32, ptr %tmp12, align 4
588  %tmp18 = icmp eq i32 %tmp17, 0
589  br i1 %tmp18, label %bb35, label %bb19
590
591bb19:                                             ; preds = %bb16
592  %y = getelementptr inbounds i32, ptr %tmp, i64 0
593  %tmp20 = bitcast ptr %y to ptr
594  %tmp21 = load float, ptr %tmp20, align 4
595  %tmp22 = fadd fast float %tmp21, 0.000000e+00
596  br label %bb23
597
598bb23:                                             ; preds = %bb34, %bb19
599  %tmp24 = phi <2 x float> [ undef, %bb19 ], [ %tmp26, %bb34 ]
600  br label %bb25
601
602bb25:                                             ; preds = %bb28, %bb23
603  %tmp26 = phi <2 x float> [ %tmp30, %bb28 ], [ %tmp24, %bb23 ]
604  %tmp27 = icmp ult i32 undef, 8
605  br i1 %tmp27, label %bb28, label %bb34
606
607bb28:                                             ; preds = %bb25
608  %tmp29 = insertelement <2 x float> %tmp26, float undef, i32 0
609  %tmp30 = insertelement <2 x float> %tmp29, float %tmp22, i32 1
610  br label %bb25
611
612bb34:                                             ; preds = %bb25
613  br label %bb23
614
615bb35:                                             ; preds = %bb16
616  unreachable
617}
618
619define double @t4(ptr %this, ptr %this.addr, ptr %this1) {
620; IS__TUNIT____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
621; IS__TUNIT____-LABEL: define {{[^@]+}}@t4
622; IS__TUNIT____-SAME: (ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS:%.*]], ptr nocapture nofree readnone [[THIS_ADDR:%.*]], ptr nocapture nofree readnone [[THIS1:%.*]]) #[[ATTR0]] {
623; IS__TUNIT____-NEXT:  entry:
624; IS__TUNIT____-NEXT:    [[THIS_ADDR1:%.*]] = alloca ptr, i32 0, align 8
625; IS__TUNIT____-NEXT:    store ptr [[THIS]], ptr [[THIS]], align 8
626; IS__TUNIT____-NEXT:    [[CALL:%.*]] = call [[S:%.*]] @t4a(ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS]]) #[[ATTR5:[0-9]+]]
627; IS__TUNIT____-NEXT:    ret double 0.000000e+00
628;
629; IS__CGSCC____: Function Attrs: argmemonly nofree nosync nounwind willreturn
630; IS__CGSCC____-LABEL: define {{[^@]+}}@t4
631; IS__CGSCC____-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS:%.*]], ptr nocapture nofree readnone [[THIS_ADDR:%.*]], ptr nocapture nofree readnone [[THIS1:%.*]]) #[[ATTR2]] {
632; IS__CGSCC____-NEXT:  entry:
633; IS__CGSCC____-NEXT:    [[THIS_ADDR1:%.*]] = alloca ptr, i32 0, align 8
634; IS__CGSCC____-NEXT:    store ptr [[THIS]], ptr [[THIS]], align 8
635; IS__CGSCC____-NEXT:    [[CALL:%.*]] = call [[S:%.*]] @t4a(ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS]]) #[[ATTR8]]
636; IS__CGSCC____-NEXT:    [[TMP0:%.*]] = extractvalue [[S]] [[CALL]], 0
637; IS__CGSCC____-NEXT:    ret double 0.000000e+00
638;
639entry:
640  %this.addr1 = alloca ptr, i32 0, align 8
641  store ptr %this, ptr %this, align 8
642  %this12 = load ptr, ptr %this, align 8
643  %call = call %S @t4a(ptr %this)
644  %0 = extractvalue %S %call, 0
645  ret double 0.000000e+00
646}
647
648define internal %S @t4a(ptr %this) {
649; IS__TUNIT____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
650; IS__TUNIT____-LABEL: define {{[^@]+}}@t4a
651; IS__TUNIT____-SAME: (ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS:%.*]]) #[[ATTR0]] {
652; IS__TUNIT____-NEXT:  entry:
653; IS__TUNIT____-NEXT:    [[RETVAL:%.*]] = alloca [[S:%.*]], i32 0, align 8
654; IS__TUNIT____-NEXT:    [[THIS_ADDR:%.*]] = alloca ptr, i32 0, align 8
655; IS__TUNIT____-NEXT:    store ptr [[THIS]], ptr [[THIS]], align 8
656; IS__TUNIT____-NEXT:    call void @t4b(ptr noalias nocapture nofree noundef nonnull writeonly align 8 [[RETVAL]]) #[[ATTR5]]
657; IS__TUNIT____-NEXT:    ret [[S]] undef
658;
659; IS__CGSCC_OPM: Function Attrs: argmemonly nofree nosync nounwind willreturn
660; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@t4a
661; IS__CGSCC_OPM-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS:%.*]]) #[[ATTR2]] {
662; IS__CGSCC_OPM-NEXT:  entry:
663; IS__CGSCC_OPM-NEXT:    [[RETVAL:%.*]] = alloca [[S:%.*]], i32 0, align 8
664; IS__CGSCC_OPM-NEXT:    [[THIS_ADDR:%.*]] = alloca ptr, i32 0, align 8
665; IS__CGSCC_OPM-NEXT:    store ptr [[THIS]], ptr [[THIS]], align 8
666; IS__CGSCC_OPM-NEXT:    call void @t4b(ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[RETVAL]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS]]) #[[ATTR6]]
667; IS__CGSCC_OPM-NEXT:    [[TMP0:%.*]] = load [[S]], ptr [[RETVAL]], align 8
668; IS__CGSCC_OPM-NEXT:    ret [[S]] [[TMP0]]
669;
670; IS__CGSCC_NPM: Function Attrs: argmemonly nofree nosync nounwind willreturn
671; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@t4a
672; IS__CGSCC_NPM-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS:%.*]]) #[[ATTR2]] {
673; IS__CGSCC_NPM-NEXT:  entry:
674; IS__CGSCC_NPM-NEXT:    [[RETVAL:%.*]] = alloca [[S:%.*]], i32 0, align 8
675; IS__CGSCC_NPM-NEXT:    [[THIS_ADDR:%.*]] = alloca ptr, i32 0, align 8
676; IS__CGSCC_NPM-NEXT:    store ptr [[THIS]], ptr [[THIS]], align 8
677; IS__CGSCC_NPM-NEXT:    call void @t4b(ptr noalias nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[RETVAL]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS]]) #[[ATTR6]]
678; IS__CGSCC_NPM-NEXT:    [[TMP0:%.*]] = load [[S]], ptr [[RETVAL]], align 8
679; IS__CGSCC_NPM-NEXT:    ret [[S]] [[TMP0]]
680;
681entry:
682  %retval = alloca %S, i32 0, align 8
683  %this.addr = alloca ptr, i32 0, align 8
684  store ptr %this, ptr %this, align 8
685  %this1 = load ptr, ptr %this, align 8
686  %buffer_ = getelementptr inbounds %struct1, ptr %this1, i32 0, i32 0
687  %data_ = getelementptr inbounds %struct2, ptr %buffer_, i32 0, i32 0
688  %0 = load ptr, ptr %this, align 8
689  call void @t4b(ptr %retval, ptr %this)
690  %1 = load %S, ptr %retval, align 8
691  ret %S %1
692}
693
694define internal void @t4b(ptr %this, ptr %data) {
695; IS__TUNIT____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
696; IS__TUNIT____-LABEL: define {{[^@]+}}@t4b
697; IS__TUNIT____-SAME: (ptr noalias nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS:%.*]]) #[[ATTR0]] {
698; IS__TUNIT____-NEXT:  entry:
699; IS__TUNIT____-NEXT:    [[THIS_ADDR:%.*]] = alloca ptr, i32 0, align 8
700; IS__TUNIT____-NEXT:    [[DATA_ADDR:%.*]] = alloca ptr, i32 0, align 8
701; IS__TUNIT____-NEXT:    call void @t4c(ptr noalias nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS]]) #[[ATTR5]]
702; IS__TUNIT____-NEXT:    ret void
703;
704; IS__CGSCC_OPM: Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly
705; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@t4b
706; IS__CGSCC_OPM-SAME: (ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS:%.*]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[DATA:%.*]]) #[[ATTR0]] {
707; IS__CGSCC_OPM-NEXT:  entry:
708; IS__CGSCC_OPM-NEXT:    [[THIS_ADDR:%.*]] = alloca ptr, i32 0, align 8
709; IS__CGSCC_OPM-NEXT:    [[DATA_ADDR:%.*]] = alloca ptr, i32 0, align 8
710; IS__CGSCC_OPM-NEXT:    store ptr [[DATA]], ptr [[THIS]], align 8
711; IS__CGSCC_OPM-NEXT:    call void @t4c(ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[DATA]]) #[[ATTR6]]
712; IS__CGSCC_OPM-NEXT:    ret void
713;
714; IS__CGSCC_NPM: Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly
715; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@t4b
716; IS__CGSCC_NPM-SAME: (ptr noalias nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS:%.*]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[DATA:%.*]]) #[[ATTR0]] {
717; IS__CGSCC_NPM-NEXT:  entry:
718; IS__CGSCC_NPM-NEXT:    [[THIS_ADDR:%.*]] = alloca ptr, i32 0, align 8
719; IS__CGSCC_NPM-NEXT:    [[DATA_ADDR:%.*]] = alloca ptr, i32 0, align 8
720; IS__CGSCC_NPM-NEXT:    store ptr [[DATA]], ptr [[THIS]], align 8
721; IS__CGSCC_NPM-NEXT:    call void @t4c(ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[DATA]]) #[[ATTR6]]
722; IS__CGSCC_NPM-NEXT:    ret void
723;
724entry:
725  %this.addr = alloca ptr, i32 0, align 8
726  %data.addr = alloca ptr, i32 0, align 8
727  store ptr %this, ptr %this.addr, align 8
728  store ptr %data, ptr %this, align 8
729  %this1 = load ptr, ptr %this, align 8
730  %0 = load ptr, ptr %this, align 8
731  call void @t4c(ptr %this, ptr %data)
732  ret void
733}
734
735define internal void @t4c(ptr %this, ptr %data) {
736; IS__TUNIT____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
737; IS__TUNIT____-LABEL: define {{[^@]+}}@t4c
738; IS__TUNIT____-SAME: (ptr noalias nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS:%.*]]) #[[ATTR0]] {
739; IS__TUNIT____-NEXT:  entry:
740; IS__TUNIT____-NEXT:    [[THIS_ADDR:%.*]] = alloca ptr, i32 0, align 8
741; IS__TUNIT____-NEXT:    [[DATA_ADDR:%.*]] = alloca ptr, i32 0, align 8
742; IS__TUNIT____-NEXT:    ret void
743;
744; IS__CGSCC____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
745; IS__CGSCC____-LABEL: define {{[^@]+}}@t4c
746; IS__CGSCC____-SAME: (ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS:%.*]], ptr nofree writeonly [[DATA:%.*]]) #[[ATTR3]] {
747; IS__CGSCC____-NEXT:  entry:
748; IS__CGSCC____-NEXT:    [[THIS_ADDR:%.*]] = alloca ptr, i32 0, align 8
749; IS__CGSCC____-NEXT:    [[DATA_ADDR:%.*]] = alloca ptr, i32 0, align 8
750; IS__CGSCC____-NEXT:    store ptr [[DATA]], ptr [[THIS]], align 8
751; IS__CGSCC____-NEXT:    store ptr [[DATA]], ptr [[THIS]], align 8
752; IS__CGSCC____-NEXT:    ret void
753;
754entry:
755  %this.addr = alloca ptr, i32 0, align 8
756  %data.addr = alloca ptr, i32 0, align 8
757  store ptr %this, ptr %this.addr, align 8
758  store ptr %data, ptr %this, align 8
759  %this1 = load ptr, ptr %this, align 8
760  %data_ = getelementptr inbounds %S, ptr %this1, i32 0, i32 0
761  %0 = load ptr, ptr %this, align 8
762  store ptr %data, ptr %this, align 8
763  ret void
764}
765
766!llvm.module.flags = !{!0, !1, !2, !3, !4, !5, !6, !7}
767
768!0 = !{i32 2, !"SDK Version", [2 x i32] [i32 11, i32 5]}
769!1 = !{i32 1, !"wchar_size", i32 4}
770!2 = !{i32 7, !"openmp", i32 50}
771!3 = !{i32 7, !"openmp-device", i32 50}
772!4 = !{i32 7, !"PIC Level", i32 2}
773!5 = !{i32 7, !"frame-pointer", i32 2}
774!6 = !{i32 7, !"Dwarf Version", i32 2}
775!7 = !{i32 2, !"Debug Info Version", i32 3}
776;.
777; IS__TUNIT____: attributes #[[ATTR0]] = { argmemonly nofree norecurse nosync nounwind willreturn writeonly }
778; IS__TUNIT____: attributes #[[ATTR1]] = { argmemonly nofree norecurse nosync nounwind willreturn }
779; IS__TUNIT____: attributes #[[ATTR2:[0-9]+]] = { nofree norecurse noreturn nosync nounwind readnone }
780; IS__TUNIT____: attributes #[[ATTR3]] = { nofree norecurse nosync nounwind willreturn writeonly }
781; IS__TUNIT____: attributes #[[ATTR4]] = { nofree nosync nounwind willreturn }
782; IS__TUNIT____: attributes #[[ATTR5]] = { nofree nosync nounwind willreturn writeonly }
783;.
784; IS__CGSCC____: attributes #[[ATTR0]] = { argmemonly nofree nosync nounwind willreturn writeonly }
785; IS__CGSCC____: attributes #[[ATTR1]] = { nofree norecurse nosync nounwind readnone willreturn }
786; IS__CGSCC____: attributes #[[ATTR2]] = { argmemonly nofree nosync nounwind willreturn }
787; IS__CGSCC____: attributes #[[ATTR3]] = { argmemonly nofree norecurse nosync nounwind willreturn writeonly }
788; IS__CGSCC____: attributes #[[ATTR4]] = { argmemonly nofree norecurse nosync nounwind willreturn }
789; IS__CGSCC____: attributes #[[ATTR5:[0-9]+]] = { nofree norecurse noreturn nosync nounwind readnone }
790; IS__CGSCC____: attributes #[[ATTR6]] = { nounwind willreturn writeonly }
791; IS__CGSCC____: attributes #[[ATTR7]] = { readnone willreturn }
792; IS__CGSCC____: attributes #[[ATTR8]] = { nounwind willreturn }
793;.
794; CHECK: [[META0:![0-9]+]] = !{i32 2, !"SDK Version", [2 x i32] [i32 11, i32 5]}
795; CHECK: [[META1:![0-9]+]] = !{i32 1, !"wchar_size", i32 4}
796; CHECK: [[META2:![0-9]+]] = !{i32 7, !"openmp", i32 50}
797; CHECK: [[META3:![0-9]+]] = !{i32 7, !"openmp-device", i32 50}
798; CHECK: [[META4:![0-9]+]] = !{i32 7, !"PIC Level", i32 2}
799; CHECK: [[META5:![0-9]+]] = !{i32 7, !"frame-pointer", i32 2}
800; CHECK: [[META6:![0-9]+]] = !{i32 7, !"Dwarf Version", i32 2}
801; CHECK: [[META7:![0-9]+]] = !{i32 2, !"Debug Info Version", i32 3}
802;.
803