1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
2 ; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT
3 ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC
5 %struct.S = type { i32, i32, i32, float, float, float }
7 @globalBytes = global [1024 x i8] zeroinitializer, align 16
8 @Gint1 = global i32 zeroinitializer, align 4
9 @Gint2 = global i32 zeroinitializer, align 4
10 @Gstatic_int1 = internal global i32 zeroinitializer, align 4
11 @Gstatic_int2 = internal global i32 zeroinitializer, align 4
12 @Gstatic_int3 = internal global i32 zeroinitializer, align 4
13 @Gstatic_undef_int1 = internal global i32 undef, align 4
14 @Gstatic_undef_int2 = internal global i32 undef, align 4
15 @GI1 = internal global i32 undef, align 4
16 @GI2 = internal global i32 undef, align 4
17 @Gs1 = internal global %struct.S undef, align 4
18 @Gs2 = internal global %struct.S zeroinitializer, align 4
19 @Vs1 = internal global %struct.S undef, align 4
20 @Vs2 = internal global %struct.S undef, align 4
21 @GBytes = internal global [1024 x i8] zeroinitializer, align 16
22 @Flag0 = global i32 0, align 4
23 @Flag1 = internal global i32 undef, align 4
24 @Flag2 = internal global i32 undef, align 4
25 @Flag4 = internal global i32 undef, align 4
26 @Flag3 = internal global i32 zeroinitializer, align 4
27 @a1 = internal global i32 zeroinitializer
28 @a2 = internal global i32 zeroinitializer
29 @a3 = internal global i32 undef
30 @bytes1 = internal global i32 undef
31 @bytes2 = internal global i32 undef
32 @rec_storage = internal global i32 undef
35 ; CHECK: @globalBytes = global [1024 x i8] zeroinitializer, align 16
36 ; CHECK: @Gint1 = global i32 0, align 4
37 ; CHECK: @Gint2 = global i32 0, align 4
38 ; CHECK: @Gstatic_int1 = internal global i32 0, align 4
39 ; CHECK: @Gstatic_int2 = internal global i32 0, align 4
40 ; CHECK: @Gstatic_int3 = internal global i32 0, align 4
41 ; CHECK: @Gstatic_undef_int1 = internal global i32 undef, align 4
42 ; CHECK: @Gstatic_undef_int2 = internal global i32 undef, align 4
43 ; CHECK: @GI1 = internal global i32 undef, align 4
44 ; CHECK: @GI2 = internal global i32 undef, align 4
45 ; CHECK: @Gs1 = internal global %struct.S undef, align 4
46 ; CHECK: @Gs2 = internal global %struct.S zeroinitializer, align 4
47 ; CHECK: @Vs1 = internal global %struct.S undef, align 4
48 ; CHECK: @Vs2 = internal global %struct.S undef, align 4
49 ; CHECK: @GBytes = internal global [1024 x i8] zeroinitializer, align 16
50 ; CHECK: @Flag0 = global i32 0, align 4
51 ; CHECK: @Flag1 = internal global i32 undef, align 4
52 ; CHECK: @Flag2 = internal global i32 undef, align 4
53 ; CHECK: @Flag4 = internal global i32 undef, align 4
54 ; CHECK: @Flag3 = internal global i32 0, align 4
55 ; CHECK: @a1 = internal global i32 0
56 ; CHECK: @a2 = internal global i32 0
57 ; CHECK: @a3 = internal global i32 undef
58 ; CHECK: @bytes1 = internal global i32 undef
59 ; CHECK: @bytes2 = internal global i32 undef
60 ; CHECK: @rec_storage = internal global i32 undef
61 ; CHECK: @global = internal global %struct.STy zeroinitializer, align 8
62 ; CHECK: @G = internal global i32 0, align 4
63 ; CHECK: @GC = internal global i32 undef, align 4
64 ; CHECK: @GRS = internal thread_local global i32 undef
65 ; CHECK: @GRS2 = global i32 undef
67 define void @write_arg(ptr %p, i32 %v) {
68 ; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write)
69 ; CHECK-LABEL: define {{[^@]+}}@write_arg
70 ; CHECK-SAME: (ptr nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) [[P:%.*]], i32 [[V:%.*]]) #[[ATTR0:[0-9]+]] {
72 ; CHECK-NEXT: store i32 [[V]], ptr [[P]], align 4, !tbaa [[TBAA3:![0-9]+]]
73 ; CHECK-NEXT: ret void
76 store i32 %v, ptr %p, align 4, !tbaa !3
80 define void @write_random(ptr %p) {
81 ; CHECK-LABEL: define {{[^@]+}}@write_random
82 ; CHECK-SAME: (ptr nocapture nofree writeonly [[P:%.*]]) {
84 ; CHECK-NEXT: [[CALL:%.*]] = call i32 (...) @random()
85 ; CHECK-NEXT: store i32 [[CALL]], ptr [[P]], align 4, !tbaa [[TBAA3]]
86 ; CHECK-NEXT: ret void
89 %call = call i32 (...) @random()
90 store i32 %call, ptr %p, align 4, !tbaa !3
94 declare i32 @random(...)
96 ; struct S local_alloca_simplifiable_1(void) {
101 ; write_arg(&s.i1, 1);
102 ; write_arg(&s.i2, 2);
103 ; write_arg(&s.i3, 3);
107 ; r.f3 = s.f3 + s.f1;
110 ; r.i3 = s.i3 + s.i1;
113 define void @local_alloca_simplifiable_1(ptr noalias sret(%struct.S) align 4 %agg.result) {
114 ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite)
115 ; TUNIT-LABEL: define {{[^@]+}}@local_alloca_simplifiable_1
116 ; TUNIT-SAME: (ptr noalias nocapture nofree writeonly sret([[STRUCT_S:%.*]]) align 4 dereferenceable_or_null(24) [[AGG_RESULT:%.*]]) #[[ATTR1:[0-9]+]] {
118 ; TUNIT-NEXT: [[S:%.*]] = alloca [[STRUCT_S]], align 4
119 ; TUNIT-NEXT: call void @llvm.lifetime.start.p0(i64 noundef 24, ptr noalias nocapture nofree noundef nonnull align 4 dereferenceable(24) [[S]]) #[[ATTR17:[0-9]+]]
120 ; TUNIT-NEXT: [[F1:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 3
121 ; TUNIT-NEXT: [[F2:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 4
122 ; TUNIT-NEXT: [[F3:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 5
123 ; TUNIT-NEXT: call void @write_arg(ptr noalias nocapture nofree noundef nonnull writeonly align 4 dereferenceable(24) [[S]], i32 noundef 1) #[[ATTR18:[0-9]+]]
124 ; TUNIT-NEXT: [[I2:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 1
125 ; TUNIT-NEXT: call void @write_arg(ptr nocapture nofree noundef nonnull writeonly align 4 dereferenceable(20) [[I2]], i32 noundef 2) #[[ATTR18]]
126 ; TUNIT-NEXT: [[I3:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 2
127 ; TUNIT-NEXT: call void @write_arg(ptr nocapture nofree noundef nonnull writeonly align 4 dereferenceable(16) [[I3]], i32 noundef 3) #[[ATTR18]]
128 ; TUNIT-NEXT: [[F12:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 3
129 ; TUNIT-NEXT: store float 0x3FF19999A0000000, ptr [[F12]], align 4, !tbaa [[TBAA7:![0-9]+]]
130 ; TUNIT-NEXT: [[F24:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 4
131 ; TUNIT-NEXT: store float 0x40119999A0000000, ptr [[F24]], align 4, !tbaa [[TBAA10:![0-9]+]]
132 ; TUNIT-NEXT: [[F37:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 5
133 ; TUNIT-NEXT: store float 0x40119999A0000000, ptr [[F37]], align 4, !tbaa [[TBAA11:![0-9]+]]
134 ; TUNIT-NEXT: store i32 1, ptr [[AGG_RESULT]], align 4, !tbaa [[TBAA12:![0-9]+]]
135 ; TUNIT-NEXT: [[I212:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 1
136 ; TUNIT-NEXT: store i32 4, ptr [[I212]], align 4, !tbaa [[TBAA13:![0-9]+]]
137 ; TUNIT-NEXT: [[I316:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 2
138 ; TUNIT-NEXT: store i32 4, ptr [[I316]], align 4, !tbaa [[TBAA14:![0-9]+]]
139 ; TUNIT-NEXT: call void @llvm.lifetime.end.p0(i64 noundef 24, ptr noalias nocapture nofree noundef nonnull align 4 dereferenceable(24) [[S]]) #[[ATTR17]]
140 ; TUNIT-NEXT: ret void
142 ; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: readwrite)
143 ; CGSCC-LABEL: define {{[^@]+}}@local_alloca_simplifiable_1
144 ; CGSCC-SAME: (ptr noalias nocapture nofree noundef nonnull writeonly sret([[STRUCT_S:%.*]]) align 4 dereferenceable(24) [[AGG_RESULT:%.*]]) #[[ATTR1:[0-9]+]] {
146 ; CGSCC-NEXT: [[S:%.*]] = alloca [[STRUCT_S]], align 4
147 ; CGSCC-NEXT: call void @llvm.lifetime.start.p0(i64 noundef 24, ptr noalias nocapture nofree noundef nonnull align 4 dereferenceable(24) [[S]]) #[[ATTR20:[0-9]+]]
148 ; CGSCC-NEXT: [[F1:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 3
149 ; CGSCC-NEXT: store float 0x3FF19999A0000000, ptr [[F1]], align 4, !tbaa [[TBAA7:![0-9]+]]
150 ; CGSCC-NEXT: [[F2:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 4
151 ; CGSCC-NEXT: store float 0x40019999A0000000, ptr [[F2]], align 4, !tbaa [[TBAA10:![0-9]+]]
152 ; CGSCC-NEXT: [[F3:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 5
153 ; CGSCC-NEXT: store float 0x400A666660000000, ptr [[F3]], align 4, !tbaa [[TBAA11:![0-9]+]]
154 ; CGSCC-NEXT: call void @write_arg(ptr noalias nocapture nofree noundef nonnull writeonly align 4 dereferenceable(24) [[S]], i32 noundef 1) #[[ATTR21:[0-9]+]]
155 ; CGSCC-NEXT: [[I2:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 1
156 ; CGSCC-NEXT: call void @write_arg(ptr nocapture nofree noundef nonnull writeonly align 4 dereferenceable(20) [[I2]], i32 noundef 2) #[[ATTR21]]
157 ; CGSCC-NEXT: [[I3:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 2
158 ; CGSCC-NEXT: call void @write_arg(ptr nocapture nofree noundef nonnull writeonly align 4 dereferenceable(16) [[I3]], i32 noundef 3) #[[ATTR21]]
159 ; CGSCC-NEXT: [[F11:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 3
160 ; CGSCC-NEXT: [[I4:%.*]] = load float, ptr [[F11]], align 4, !tbaa [[TBAA7]]
161 ; CGSCC-NEXT: [[F12:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 3
162 ; CGSCC-NEXT: store float [[I4]], ptr [[F12]], align 4, !tbaa [[TBAA7]]
163 ; CGSCC-NEXT: [[F23:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 4
164 ; CGSCC-NEXT: [[I5:%.*]] = load float, ptr [[F23]], align 4, !tbaa [[TBAA10]]
165 ; CGSCC-NEXT: [[MUL:%.*]] = fmul float [[I5]], 2.000000e+00
166 ; CGSCC-NEXT: [[F24:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 4
167 ; CGSCC-NEXT: store float [[MUL]], ptr [[F24]], align 4, !tbaa [[TBAA10]]
168 ; CGSCC-NEXT: [[F35:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 5
169 ; CGSCC-NEXT: [[I6:%.*]] = load float, ptr [[F35]], align 4, !tbaa [[TBAA11]]
170 ; CGSCC-NEXT: [[F16:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 3
171 ; CGSCC-NEXT: [[I7:%.*]] = load float, ptr [[F16]], align 4, !tbaa [[TBAA7]]
172 ; CGSCC-NEXT: [[ADD:%.*]] = fadd float [[I6]], [[I7]]
173 ; CGSCC-NEXT: [[F37:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 5
174 ; CGSCC-NEXT: store float [[ADD]], ptr [[F37]], align 4, !tbaa [[TBAA11]]
175 ; CGSCC-NEXT: [[I8:%.*]] = load i32, ptr [[S]], align 4, !tbaa [[TBAA12:![0-9]+]]
176 ; CGSCC-NEXT: store i32 [[I8]], ptr [[AGG_RESULT]], align 4, !tbaa [[TBAA12]]
177 ; CGSCC-NEXT: [[I210:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 1
178 ; CGSCC-NEXT: [[I9:%.*]] = load i32, ptr [[I210]], align 4, !tbaa [[TBAA13:![0-9]+]]
179 ; CGSCC-NEXT: [[MUL11:%.*]] = shl nsw i32 [[I9]], 1
180 ; CGSCC-NEXT: [[I212:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 1
181 ; CGSCC-NEXT: store i32 [[MUL11]], ptr [[I212]], align 4, !tbaa [[TBAA13]]
182 ; CGSCC-NEXT: [[I313:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 2
183 ; CGSCC-NEXT: [[I10:%.*]] = load i32, ptr [[I313]], align 4, !tbaa [[TBAA14:![0-9]+]]
184 ; CGSCC-NEXT: [[I11:%.*]] = load i32, ptr [[S]], align 4, !tbaa [[TBAA12]]
185 ; CGSCC-NEXT: [[ADD15:%.*]] = add nsw i32 [[I10]], [[I11]]
186 ; CGSCC-NEXT: [[I316:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 2
187 ; CGSCC-NEXT: store i32 [[ADD15]], ptr [[I316]], align 4, !tbaa [[TBAA14]]
188 ; CGSCC-NEXT: call void @llvm.lifetime.end.p0(i64 noundef 24, ptr noalias nocapture nofree noundef nonnull align 4 dereferenceable(24) [[S]]) #[[ATTR20]]
189 ; CGSCC-NEXT: ret void
192 %s = alloca %struct.S, align 4
193 call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %s)
194 %f1 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 3
195 store float 0x3FF19999A0000000, ptr %f1, align 4, !tbaa !7
196 %f2 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 4
197 store float 0x40019999A0000000, ptr %f2, align 4, !tbaa !10
198 %f3 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 5
199 store float 0x400A666660000000, ptr %f3, align 4, !tbaa !11
200 call void @write_arg(ptr nonnull %s, i32 1)
201 %i2 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 1
202 call void @write_arg(ptr nonnull %i2, i32 2)
203 %i3 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 2
204 call void @write_arg(ptr nonnull %i3, i32 3)
205 %f11 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 3
206 %i4 = load float, ptr %f11, align 4, !tbaa !7
207 %f12 = getelementptr inbounds %struct.S, ptr %agg.result, i64 0, i32 3
208 store float %i4, ptr %f12, align 4, !tbaa !7
209 %f23 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 4
210 %i5 = load float, ptr %f23, align 4, !tbaa !10
211 %mul = fmul float %i5, 2.000000e+00
212 %f24 = getelementptr inbounds %struct.S, ptr %agg.result, i64 0, i32 4
213 store float %mul, ptr %f24, align 4, !tbaa !10
214 %f35 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 5
215 %i6 = load float, ptr %f35, align 4, !tbaa !11
216 %f16 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 3
217 %i7 = load float, ptr %f16, align 4, !tbaa !7
218 %add = fadd float %i6, %i7
219 %f37 = getelementptr inbounds %struct.S, ptr %agg.result, i64 0, i32 5
220 store float %add, ptr %f37, align 4, !tbaa !11
221 %i8 = load i32, ptr %s, align 4, !tbaa !12
222 store i32 %i8, ptr %agg.result, align 4, !tbaa !12
223 %i210 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 1
224 %i9 = load i32, ptr %i210, align 4, !tbaa !13
225 %mul11 = shl nsw i32 %i9, 1
226 %i212 = getelementptr inbounds %struct.S, ptr %agg.result, i64 0, i32 1
227 store i32 %mul11, ptr %i212, align 4, !tbaa !13
228 %i313 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 2
229 %i10 = load i32, ptr %i313, align 4, !tbaa !14
230 %i11 = load i32, ptr %s, align 4, !tbaa !12
231 %add15 = add nsw i32 %i10, %i11
232 %i316 = getelementptr inbounds %struct.S, ptr %agg.result, i64 0, i32 2
233 store i32 %add15, ptr %i316, align 4, !tbaa !14
234 call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %s)
238 declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture)
240 declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture)
242 ; void local_alloca_simplifiable_2(void) {
244 ; for (int i = 0; i < 100; ++i)
246 ; for (int i = 0; i < 10; ++i)
247 ; ((float *)Bytes)[i * 10 + 1] = 0;
248 ; for (int i = 0; i < 20; ++i)
249 ; ((long long int *)Bytes)[i * 10 + 2] = 0;
251 ; write_arg((int *)&Bytes[500], 0);
253 ; for (int i = 0; i < 1024; ++i)
254 ; globalBytes[i] = Bytes[i];
257 define void @local_alloca_simplifiable_2() {
258 ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn
259 ; TUNIT-LABEL: define {{[^@]+}}@local_alloca_simplifiable_2
260 ; TUNIT-SAME: () #[[ATTR3:[0-9]+]] {
262 ; TUNIT-NEXT: [[BYTES:%.*]] = alloca [1024 x i8], align 16
263 ; TUNIT-NEXT: call void @llvm.lifetime.start.p0(i64 noundef 1024, ptr noalias nocapture nofree noundef nonnull align 16 dereferenceable(1024) [[BYTES]]) #[[ATTR17]]
264 ; TUNIT-NEXT: br label [[FOR_COND:%.*]]
266 ; TUNIT-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[FOR_INC:%.*]] ], [ 0, [[ENTRY:%.*]] ]
267 ; TUNIT-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV]], 100
268 ; TUNIT-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY:%.*]], label [[FOR_COND_CLEANUP:%.*]]
269 ; TUNIT: for.cond.cleanup:
270 ; TUNIT-NEXT: br label [[FOR_END:%.*]]
272 ; TUNIT-NEXT: [[I15:%.*]] = mul nuw nsw i64 [[INDVARS_IV]], 10
273 ; TUNIT-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 [[I15]]
274 ; TUNIT-NEXT: br label [[FOR_INC]]
276 ; TUNIT-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
277 ; TUNIT-NEXT: br label [[FOR_COND]], !llvm.loop [[LOOP15:![0-9]+]]
279 ; TUNIT-NEXT: br label [[FOR_COND2:%.*]]
281 ; TUNIT-NEXT: [[INDVARS_IV2:%.*]] = phi i64 [ [[INDVARS_IV_NEXT3:%.*]], [[FOR_INC9:%.*]] ], [ 0, [[FOR_END]] ]
282 ; TUNIT-NEXT: [[EXITCOND6:%.*]] = icmp ne i64 [[INDVARS_IV2]], 10
283 ; TUNIT-NEXT: br i1 [[EXITCOND6]], label [[FOR_BODY5:%.*]], label [[FOR_COND_CLEANUP4:%.*]]
284 ; TUNIT: for.cond.cleanup4:
285 ; TUNIT-NEXT: br label [[FOR_END11:%.*]]
287 ; TUNIT-NEXT: [[I17:%.*]] = mul nuw nsw i64 [[INDVARS_IV2]], 10
288 ; TUNIT-NEXT: [[I18:%.*]] = or i64 [[I17]], 1
289 ; TUNIT-NEXT: [[ARRAYIDX8:%.*]] = getelementptr inbounds float, ptr [[BYTES]], i64 [[I18]]
290 ; TUNIT-NEXT: br label [[FOR_INC9]]
292 ; TUNIT-NEXT: [[INDVARS_IV_NEXT3]] = add nuw nsw i64 [[INDVARS_IV2]], 1
293 ; TUNIT-NEXT: br label [[FOR_COND2]], !llvm.loop [[LOOP17:![0-9]+]]
295 ; TUNIT-NEXT: br label [[FOR_COND13:%.*]]
297 ; TUNIT-NEXT: [[INDVARS_IV7:%.*]] = phi i64 [ [[INDVARS_IV_NEXT8:%.*]], [[FOR_INC22:%.*]] ], [ 0, [[FOR_END11]] ]
298 ; TUNIT-NEXT: [[EXITCOND11:%.*]] = icmp ne i64 [[INDVARS_IV7]], 20
299 ; TUNIT-NEXT: br i1 [[EXITCOND11]], label [[FOR_BODY16:%.*]], label [[FOR_COND_CLEANUP15:%.*]]
300 ; TUNIT: for.cond.cleanup15:
301 ; TUNIT-NEXT: br label [[FOR_END24:%.*]]
303 ; TUNIT-NEXT: [[I20:%.*]] = mul nuw nsw i64 [[INDVARS_IV7]], 10
304 ; TUNIT-NEXT: [[I21:%.*]] = add nuw nsw i64 [[I20]], 2
305 ; TUNIT-NEXT: [[ARRAYIDX21:%.*]] = getelementptr inbounds i64, ptr [[BYTES]], i64 [[I21]]
306 ; TUNIT-NEXT: br label [[FOR_INC22]]
308 ; TUNIT-NEXT: [[INDVARS_IV_NEXT8]] = add nuw nsw i64 [[INDVARS_IV7]], 1
309 ; TUNIT-NEXT: br label [[FOR_COND13]], !llvm.loop [[LOOP18:![0-9]+]]
311 ; TUNIT-NEXT: [[ARRAYIDX25:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 1023
312 ; TUNIT-NEXT: [[ARRAYIDX26:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 500
313 ; TUNIT-NEXT: call void @write_arg(ptr nocapture nofree noundef nonnull writeonly align 4 dereferenceable(524) [[ARRAYIDX26]], i32 noundef 0) #[[ATTR18]]
314 ; TUNIT-NEXT: br label [[FOR_COND28:%.*]]
316 ; TUNIT-NEXT: [[INDVARS_IV12:%.*]] = phi i64 [ [[INDVARS_IV_NEXT13:%.*]], [[FOR_INC36:%.*]] ], [ 0, [[FOR_END24]] ]
317 ; TUNIT-NEXT: [[EXITCOND14:%.*]] = icmp ne i64 [[INDVARS_IV12]], 1024
318 ; TUNIT-NEXT: br i1 [[EXITCOND14]], label [[FOR_BODY31:%.*]], label [[FOR_COND_CLEANUP30:%.*]]
319 ; TUNIT: for.cond.cleanup30:
320 ; TUNIT-NEXT: br label [[FOR_END38:%.*]]
322 ; TUNIT-NEXT: [[ARRAYIDX35:%.*]] = getelementptr inbounds [1024 x i8], ptr @globalBytes, i64 0, i64 [[INDVARS_IV12]]
323 ; TUNIT-NEXT: store i8 0, ptr [[ARRAYIDX35]], align 1, !tbaa [[TBAA19:![0-9]+]]
324 ; TUNIT-NEXT: br label [[FOR_INC36]]
326 ; TUNIT-NEXT: [[INDVARS_IV_NEXT13]] = add nuw nsw i64 [[INDVARS_IV12]], 1
327 ; TUNIT-NEXT: br label [[FOR_COND28]], !llvm.loop [[LOOP20:![0-9]+]]
329 ; TUNIT-NEXT: call void @llvm.lifetime.end.p0(i64 noundef 1024, ptr noalias nocapture nofree noundef nonnull align 16 dereferenceable(1024) [[BYTES]]) #[[ATTR17]]
330 ; TUNIT-NEXT: ret void
332 ; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn
333 ; CGSCC-LABEL: define {{[^@]+}}@local_alloca_simplifiable_2
334 ; CGSCC-SAME: () #[[ATTR3:[0-9]+]] {
336 ; CGSCC-NEXT: [[BYTES:%.*]] = alloca [1024 x i8], align 16
337 ; CGSCC-NEXT: call void @llvm.lifetime.start.p0(i64 noundef 1024, ptr noalias nocapture nofree noundef nonnull align 16 dereferenceable(1024) [[BYTES]]) #[[ATTR20]]
338 ; CGSCC-NEXT: br label [[FOR_COND:%.*]]
340 ; CGSCC-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[FOR_INC:%.*]] ], [ 0, [[ENTRY:%.*]] ]
341 ; CGSCC-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV]], 100
342 ; CGSCC-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY:%.*]], label [[FOR_COND_CLEANUP:%.*]]
343 ; CGSCC: for.cond.cleanup:
344 ; CGSCC-NEXT: br label [[FOR_END:%.*]]
346 ; CGSCC-NEXT: [[I15:%.*]] = mul nuw nsw i64 [[INDVARS_IV]], 10
347 ; CGSCC-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 [[I15]]
348 ; CGSCC-NEXT: store i8 0, ptr [[ARRAYIDX]], align 2, !tbaa [[TBAA15:![0-9]+]]
349 ; CGSCC-NEXT: br label [[FOR_INC]]
351 ; CGSCC-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
352 ; CGSCC-NEXT: br label [[FOR_COND]], !llvm.loop [[LOOP16:![0-9]+]]
354 ; CGSCC-NEXT: br label [[FOR_COND2:%.*]]
356 ; CGSCC-NEXT: [[INDVARS_IV2:%.*]] = phi i64 [ [[INDVARS_IV_NEXT3:%.*]], [[FOR_INC9:%.*]] ], [ 0, [[FOR_END]] ]
357 ; CGSCC-NEXT: [[EXITCOND6:%.*]] = icmp ne i64 [[INDVARS_IV2]], 10
358 ; CGSCC-NEXT: br i1 [[EXITCOND6]], label [[FOR_BODY5:%.*]], label [[FOR_COND_CLEANUP4:%.*]]
359 ; CGSCC: for.cond.cleanup4:
360 ; CGSCC-NEXT: br label [[FOR_END11:%.*]]
362 ; CGSCC-NEXT: [[I17:%.*]] = mul nuw nsw i64 [[INDVARS_IV2]], 10
363 ; CGSCC-NEXT: [[I18:%.*]] = or i64 [[I17]], 1
364 ; CGSCC-NEXT: [[ARRAYIDX8:%.*]] = getelementptr inbounds float, ptr [[BYTES]], i64 [[I18]]
365 ; CGSCC-NEXT: store float 0.000000e+00, ptr [[ARRAYIDX8]], align 4, !tbaa [[TBAA18:![0-9]+]]
366 ; CGSCC-NEXT: br label [[FOR_INC9]]
368 ; CGSCC-NEXT: [[INDVARS_IV_NEXT3]] = add nuw nsw i64 [[INDVARS_IV2]], 1
369 ; CGSCC-NEXT: br label [[FOR_COND2]], !llvm.loop [[LOOP19:![0-9]+]]
371 ; CGSCC-NEXT: br label [[FOR_COND13:%.*]]
373 ; CGSCC-NEXT: [[INDVARS_IV7:%.*]] = phi i64 [ [[INDVARS_IV_NEXT8:%.*]], [[FOR_INC22:%.*]] ], [ 0, [[FOR_END11]] ]
374 ; CGSCC-NEXT: [[EXITCOND11:%.*]] = icmp ne i64 [[INDVARS_IV7]], 20
375 ; CGSCC-NEXT: br i1 [[EXITCOND11]], label [[FOR_BODY16:%.*]], label [[FOR_COND_CLEANUP15:%.*]]
376 ; CGSCC: for.cond.cleanup15:
377 ; CGSCC-NEXT: br label [[FOR_END24:%.*]]
379 ; CGSCC-NEXT: [[I20:%.*]] = mul nuw nsw i64 [[INDVARS_IV7]], 10
380 ; CGSCC-NEXT: [[I21:%.*]] = add nuw nsw i64 [[I20]], 2
381 ; CGSCC-NEXT: [[ARRAYIDX21:%.*]] = getelementptr inbounds i64, ptr [[BYTES]], i64 [[I21]]
382 ; CGSCC-NEXT: store i64 0, ptr [[ARRAYIDX21]], align 16, !tbaa [[TBAA20:![0-9]+]]
383 ; CGSCC-NEXT: br label [[FOR_INC22]]
385 ; CGSCC-NEXT: [[INDVARS_IV_NEXT8]] = add nuw nsw i64 [[INDVARS_IV7]], 1
386 ; CGSCC-NEXT: br label [[FOR_COND13]], !llvm.loop [[LOOP22:![0-9]+]]
388 ; CGSCC-NEXT: [[ARRAYIDX25:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 1023
389 ; CGSCC-NEXT: store i8 0, ptr [[ARRAYIDX25]], align 1, !tbaa [[TBAA15]]
390 ; CGSCC-NEXT: [[ARRAYIDX26:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 500
391 ; CGSCC-NEXT: call void @write_arg(ptr nocapture nofree noundef nonnull writeonly align 4 dereferenceable(524) [[ARRAYIDX26]], i32 noundef 0) #[[ATTR21]]
392 ; CGSCC-NEXT: br label [[FOR_COND28:%.*]]
394 ; CGSCC-NEXT: [[INDVARS_IV12:%.*]] = phi i64 [ [[INDVARS_IV_NEXT13:%.*]], [[FOR_INC36:%.*]] ], [ 0, [[FOR_END24]] ]
395 ; CGSCC-NEXT: [[EXITCOND14:%.*]] = icmp ne i64 [[INDVARS_IV12]], 1024
396 ; CGSCC-NEXT: br i1 [[EXITCOND14]], label [[FOR_BODY31:%.*]], label [[FOR_COND_CLEANUP30:%.*]]
397 ; CGSCC: for.cond.cleanup30:
398 ; CGSCC-NEXT: br label [[FOR_END38:%.*]]
400 ; CGSCC-NEXT: [[ARRAYIDX33:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 [[INDVARS_IV12]]
401 ; CGSCC-NEXT: [[I23:%.*]] = load i8, ptr [[ARRAYIDX33]], align 1, !tbaa [[TBAA15]]
402 ; CGSCC-NEXT: [[ARRAYIDX35:%.*]] = getelementptr inbounds [1024 x i8], ptr @globalBytes, i64 0, i64 [[INDVARS_IV12]]
403 ; CGSCC-NEXT: store i8 [[I23]], ptr [[ARRAYIDX35]], align 1, !tbaa [[TBAA15]]
404 ; CGSCC-NEXT: br label [[FOR_INC36]]
406 ; CGSCC-NEXT: [[INDVARS_IV_NEXT13]] = add nuw nsw i64 [[INDVARS_IV12]], 1
407 ; CGSCC-NEXT: br label [[FOR_COND28]], !llvm.loop [[LOOP23:![0-9]+]]
409 ; CGSCC-NEXT: call void @llvm.lifetime.end.p0(i64 noundef 1024, ptr noalias nocapture nofree noundef nonnull align 16 dereferenceable(1024) [[BYTES]]) #[[ATTR20]]
410 ; CGSCC-NEXT: ret void
413 %Bytes = alloca [1024 x i8], align 16
414 call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %Bytes)
417 for.cond: ; preds = %for.inc, %entry
418 %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
419 %exitcond = icmp ne i64 %indvars.iv, 100
420 br i1 %exitcond, label %for.body, label %for.cond.cleanup
422 for.cond.cleanup: ; preds = %for.cond
425 for.body: ; preds = %for.cond
426 %i15 = mul nuw nsw i64 %indvars.iv, 10
427 %arrayidx = getelementptr inbounds [1024 x i8], ptr %Bytes, i64 0, i64 %i15
428 store i8 0, ptr %arrayidx, align 2, !tbaa !15
431 for.inc: ; preds = %for.body
432 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
433 br label %for.cond, !llvm.loop !16
435 for.end: ; preds = %for.cond.cleanup
438 for.cond2: ; preds = %for.inc9, %for.end
439 %indvars.iv2 = phi i64 [ %indvars.iv.next3, %for.inc9 ], [ 0, %for.end ]
440 %exitcond6 = icmp ne i64 %indvars.iv2, 10
441 br i1 %exitcond6, label %for.body5, label %for.cond.cleanup4
443 for.cond.cleanup4: ; preds = %for.cond2
446 for.body5: ; preds = %for.cond2
447 %i17 = mul nuw nsw i64 %indvars.iv2, 10
448 %i18 = or i64 %i17, 1
449 %arrayidx8 = getelementptr inbounds float, ptr %Bytes, i64 %i18
450 store float 0.000000e+00, ptr %arrayidx8, align 4, !tbaa !18
453 for.inc9: ; preds = %for.body5
454 %indvars.iv.next3 = add nuw nsw i64 %indvars.iv2, 1
455 br label %for.cond2, !llvm.loop !19
457 for.end11: ; preds = %for.cond.cleanup4
460 for.cond13: ; preds = %for.inc22, %for.end11
461 %indvars.iv7 = phi i64 [ %indvars.iv.next8, %for.inc22 ], [ 0, %for.end11 ]
462 %exitcond11 = icmp ne i64 %indvars.iv7, 20
463 br i1 %exitcond11, label %for.body16, label %for.cond.cleanup15
465 for.cond.cleanup15: ; preds = %for.cond13
468 for.body16: ; preds = %for.cond13
469 %i20 = mul nuw nsw i64 %indvars.iv7, 10
470 %i21 = add nuw nsw i64 %i20, 2
471 %arrayidx21 = getelementptr inbounds i64, ptr %Bytes, i64 %i21
472 store i64 0, ptr %arrayidx21, align 16, !tbaa !20
475 for.inc22: ; preds = %for.body16
476 %indvars.iv.next8 = add nuw nsw i64 %indvars.iv7, 1
477 br label %for.cond13, !llvm.loop !22
479 for.end24: ; preds = %for.cond.cleanup15
480 %arrayidx25 = getelementptr inbounds [1024 x i8], ptr %Bytes, i64 0, i64 1023
481 store i8 0, ptr %arrayidx25, align 1, !tbaa !15
482 %arrayidx26 = getelementptr inbounds [1024 x i8], ptr %Bytes, i64 0, i64 500
483 call void @write_arg(ptr nonnull %arrayidx26, i32 0)
486 for.cond28: ; preds = %for.inc36, %for.end24
487 %indvars.iv12 = phi i64 [ %indvars.iv.next13, %for.inc36 ], [ 0, %for.end24 ]
488 %exitcond14 = icmp ne i64 %indvars.iv12, 1024
489 br i1 %exitcond14, label %for.body31, label %for.cond.cleanup30
491 for.cond.cleanup30: ; preds = %for.cond28
494 for.body31: ; preds = %for.cond28
495 %arrayidx33 = getelementptr inbounds [1024 x i8], ptr %Bytes, i64 0, i64 %indvars.iv12
496 %i23 = load i8, ptr %arrayidx33, align 1, !tbaa !15
497 %arrayidx35 = getelementptr inbounds [1024 x i8], ptr @globalBytes, i64 0, i64 %indvars.iv12
498 store i8 %i23, ptr %arrayidx35, align 1, !tbaa !15
501 for.inc36: ; preds = %for.body31
502 %indvars.iv.next13 = add nuw nsw i64 %indvars.iv12, 1
503 br label %for.cond28, !llvm.loop !23
505 for.end38: ; preds = %for.cond.cleanup30
506 call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %Bytes)
510 ; int local_alloca_simplifiable_3() {
517 define i32 @local_alloca_simplifiable_3() {
518 ; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
519 ; CHECK-LABEL: define {{[^@]+}}@local_alloca_simplifiable_3
520 ; CHECK-SAME: () #[[ATTR4:[0-9]+]] {
521 ; CHECK-NEXT: br label [[SPLIT:%.*]]
523 ; CHECK-NEXT: ret i32 2
525 %A = alloca i32, align 4
530 %l = load i32, ptr %A, align 4
533 ; int local_alloca_simplifiable_4() {
538 define i32 @local_alloca_simplifiable_4() {
539 ; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
540 ; CHECK-LABEL: define {{[^@]+}}@local_alloca_simplifiable_4
541 ; CHECK-SAME: () #[[ATTR4]] {
542 ; CHECK-NEXT: ret i32 undef
544 %A = alloca i32, align 4
545 %l = load i32, ptr %A, align 4
549 ; static int GI1 __attribute__((loader_uninitialized));
550 ; int multi_obj_simplifiable_1(int cnd) {
552 ; int *p = cnd ? &GI1 : &L;
555 define i32 @multi_obj_simplifiable_1(i32 %cnd) {
556 ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn
557 ; TUNIT-LABEL: define {{[^@]+}}@multi_obj_simplifiable_1
558 ; TUNIT-SAME: (i32 [[CND:%.*]]) #[[ATTR3]] {
560 ; TUNIT-NEXT: [[L:%.*]] = alloca i32, align 4
561 ; TUNIT-NEXT: call void @llvm.lifetime.start.p0(i64 noundef 4, ptr noalias nocapture nofree noundef nonnull align 4 dereferenceable(4) [[L]]) #[[ATTR17]]
562 ; TUNIT-NEXT: [[TOBOOL_NOT:%.*]] = icmp eq i32 [[CND]], 0
563 ; TUNIT-NEXT: br i1 [[TOBOOL_NOT]], label [[COND_FALSE:%.*]], label [[COND_TRUE:%.*]]
565 ; TUNIT-NEXT: br label [[COND_END:%.*]]
567 ; TUNIT-NEXT: br label [[COND_END]]
569 ; TUNIT-NEXT: call void @llvm.lifetime.end.p0(i64 noundef 4, ptr noalias nocapture nofree noundef nonnull align 4 dereferenceable(4) [[L]]) #[[ATTR17]]
570 ; TUNIT-NEXT: ret i32 5
572 ; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn
573 ; CGSCC-LABEL: define {{[^@]+}}@multi_obj_simplifiable_1
574 ; CGSCC-SAME: (i32 [[CND:%.*]]) #[[ATTR5:[0-9]+]] {
576 ; CGSCC-NEXT: [[L:%.*]] = alloca i32, align 4
577 ; CGSCC-NEXT: call void @llvm.lifetime.start.p0(i64 noundef 4, ptr noalias nocapture nofree noundef nonnull align 4 dereferenceable(4) [[L]]) #[[ATTR20]]
578 ; CGSCC-NEXT: [[TOBOOL_NOT:%.*]] = icmp eq i32 [[CND]], 0
579 ; CGSCC-NEXT: br i1 [[TOBOOL_NOT]], label [[COND_FALSE:%.*]], label [[COND_TRUE:%.*]]
581 ; CGSCC-NEXT: br label [[COND_END:%.*]]
583 ; CGSCC-NEXT: br label [[COND_END]]
585 ; CGSCC-NEXT: call void @llvm.lifetime.end.p0(i64 noundef 4, ptr noalias nocapture nofree noundef nonnull align 4 dereferenceable(4) [[L]]) #[[ATTR20]]
586 ; CGSCC-NEXT: ret i32 5
589 %L = alloca i32, align 4
590 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %L)
591 store i32 5, ptr @GI1, align 4, !tbaa !3
592 store i32 5, ptr %L, align 4, !tbaa !3
593 %tobool.not = icmp eq i32 %cnd, 0
594 br i1 %tobool.not, label %cond.false, label %cond.true
596 cond.true: ; preds = %entry
599 cond.false: ; preds = %entry
602 cond.end: ; preds = %cond.false, %cond.true
603 %cond = phi ptr [ @GI1, %cond.true ], [ %L, %cond.false ]
604 %i1 = load i32, ptr %cond, align 4, !tbaa !3
605 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %L)
609 ; static int GI2 __attribute__((loader_uninitialized));
610 ; int multi_obj_simplifiable_2(int cnd) {
612 ; int *p = cnd ? &GI2 : &L;
617 define i32 @multi_obj_simplifiable_2(i32 %cnd) {
618 ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn
619 ; TUNIT-LABEL: define {{[^@]+}}@multi_obj_simplifiable_2
620 ; TUNIT-SAME: (i32 [[CND:%.*]]) #[[ATTR3]] {
622 ; TUNIT-NEXT: [[L:%.*]] = alloca i32, align 4
623 ; TUNIT-NEXT: call void @llvm.lifetime.start.p0(i64 noundef 4, ptr noalias nocapture nofree noundef nonnull align 4 dereferenceable(4) [[L]]) #[[ATTR17]]
624 ; TUNIT-NEXT: [[TOBOOL_NOT:%.*]] = icmp eq i32 [[CND]], 0
625 ; TUNIT-NEXT: br i1 [[TOBOOL_NOT]], label [[COND_FALSE:%.*]], label [[COND_TRUE:%.*]]
627 ; TUNIT-NEXT: br label [[COND_END:%.*]]
629 ; TUNIT-NEXT: br label [[COND_END]]
631 ; TUNIT-NEXT: call void @llvm.lifetime.end.p0(i64 noundef 4, ptr noalias nocapture nofree noundef nonnull align 4 dereferenceable(4) [[L]]) #[[ATTR17]]
632 ; TUNIT-NEXT: ret i32 5
634 ; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn
635 ; CGSCC-LABEL: define {{[^@]+}}@multi_obj_simplifiable_2
636 ; CGSCC-SAME: (i32 [[CND:%.*]]) #[[ATTR5]] {
638 ; CGSCC-NEXT: [[L:%.*]] = alloca i32, align 4
639 ; CGSCC-NEXT: call void @llvm.lifetime.start.p0(i64 noundef 4, ptr noalias nocapture nofree noundef nonnull align 4 dereferenceable(4) [[L]]) #[[ATTR20]]
640 ; CGSCC-NEXT: [[TOBOOL_NOT:%.*]] = icmp eq i32 [[CND]], 0
641 ; CGSCC-NEXT: br i1 [[TOBOOL_NOT]], label [[COND_FALSE:%.*]], label [[COND_TRUE:%.*]]
643 ; CGSCC-NEXT: br label [[COND_END:%.*]]
645 ; CGSCC-NEXT: br label [[COND_END]]
647 ; CGSCC-NEXT: call void @llvm.lifetime.end.p0(i64 noundef 4, ptr noalias nocapture nofree noundef nonnull align 4 dereferenceable(4) [[L]]) #[[ATTR20]]
648 ; CGSCC-NEXT: ret i32 5
651 %L = alloca i32, align 4
652 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %L)
653 %tobool.not = icmp eq i32 %cnd, 0
654 br i1 %tobool.not, label %cond.false, label %cond.true
656 cond.true: ; preds = %entry
659 cond.false: ; preds = %entry
662 cond.end: ; preds = %cond.false, %cond.true
663 %cond = phi ptr [ @GI2, %cond.true ], [ %L, %cond.false ]
664 store i32 5, ptr %cond, align 4, !tbaa !3
665 %l = load i32, ptr %cond, align 4, !tbaa !3
666 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %L)
670 ; static struct S Gs __attribute__((loader_uninitialized));
671 ; struct S static_global_simplifiable_1(void) {
675 ; write_arg(&Gs.i1, 1);
676 ; write_arg(&Gs.i2, 2);
677 ; write_arg(&Gs.i3, 3);
681 ; r.f3 = Gs.f3 + Gs.f1;
684 ; r.i3 = Gs.i3 + Gs.i1;
688 define void @static_global_simplifiable_1(ptr noalias sret(%struct.S) align 4 %agg.result) {
689 ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)
690 ; TUNIT-LABEL: define {{[^@]+}}@static_global_simplifiable_1
691 ; TUNIT-SAME: (ptr noalias nocapture nofree writeonly sret([[STRUCT_S:%.*]]) align 4 dereferenceable_or_null(24) [[AGG_RESULT:%.*]]) #[[ATTR5:[0-9]+]] {
693 ; TUNIT-NEXT: call void @write_arg(ptr nocapture nofree noundef nonnull writeonly align 4 dereferenceable(24) @Gs1, i32 noundef 1) #[[ATTR18]]
694 ; TUNIT-NEXT: call void @write_arg(ptr nocapture nofree noundef nonnull writeonly align 4 dereferenceable(20) getelementptr inbounds ([[STRUCT_S]], ptr @Gs1, i64 0, i32 1), i32 noundef 2) #[[ATTR18]]
695 ; TUNIT-NEXT: call void @write_arg(ptr nocapture nofree noundef nonnull writeonly align 4 dereferenceable(16) getelementptr inbounds ([[STRUCT_S]], ptr @Gs1, i64 0, i32 2), i32 noundef 3) #[[ATTR18]]
696 ; TUNIT-NEXT: [[F1:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 3
697 ; TUNIT-NEXT: store float 0x3FF19999A0000000, ptr [[F1]], align 4, !tbaa [[TBAA7]]
698 ; TUNIT-NEXT: [[F2:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 4
699 ; TUNIT-NEXT: store float 0x40119999A0000000, ptr [[F2]], align 4, !tbaa [[TBAA10]]
700 ; TUNIT-NEXT: [[F3:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 5
701 ; TUNIT-NEXT: store float 0x40119999A0000000, ptr [[F3]], align 4, !tbaa [[TBAA11]]
702 ; TUNIT-NEXT: store i32 1, ptr [[AGG_RESULT]], align 4, !tbaa [[TBAA12]]
703 ; TUNIT-NEXT: [[I2:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 1
704 ; TUNIT-NEXT: store i32 4, ptr [[I2]], align 4, !tbaa [[TBAA13]]
705 ; TUNIT-NEXT: [[I3:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 2
706 ; TUNIT-NEXT: store i32 4, ptr [[I3]], align 4, !tbaa [[TBAA14]]
707 ; TUNIT-NEXT: ret void
709 ; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn
710 ; CGSCC-LABEL: define {{[^@]+}}@static_global_simplifiable_1
711 ; CGSCC-SAME: (ptr noalias nocapture nofree noundef nonnull writeonly sret([[STRUCT_S:%.*]]) align 4 dereferenceable(24) [[AGG_RESULT:%.*]]) #[[ATTR3]] {
713 ; CGSCC-NEXT: store float 0x3FF19999A0000000, ptr getelementptr inbounds ([[STRUCT_S]], ptr @Gs1, i64 0, i32 3), align 4, !tbaa [[TBAA7]]
714 ; CGSCC-NEXT: store float 0x40019999A0000000, ptr getelementptr inbounds ([[STRUCT_S]], ptr @Gs1, i64 0, i32 4), align 4, !tbaa [[TBAA10]]
715 ; CGSCC-NEXT: store float 0x400A666660000000, ptr getelementptr inbounds ([[STRUCT_S]], ptr @Gs1, i64 0, i32 5), align 4, !tbaa [[TBAA11]]
716 ; CGSCC-NEXT: call void @write_arg(ptr nocapture nofree noundef nonnull writeonly align 4 dereferenceable(24) @Gs1, i32 noundef 1) #[[ATTR21]]
717 ; CGSCC-NEXT: call void @write_arg(ptr nocapture nofree noundef nonnull writeonly align 4 dereferenceable(20) getelementptr inbounds ([[STRUCT_S]], ptr @Gs1, i64 0, i32 1), i32 noundef 2) #[[ATTR21]]
718 ; CGSCC-NEXT: call void @write_arg(ptr nocapture nofree noundef nonnull writeonly align 4 dereferenceable(16) getelementptr inbounds ([[STRUCT_S]], ptr @Gs1, i64 0, i32 2), i32 noundef 3) #[[ATTR21]]
719 ; CGSCC-NEXT: [[I:%.*]] = load float, ptr getelementptr inbounds ([[STRUCT_S]], ptr @Gs1, i64 0, i32 3), align 4, !tbaa [[TBAA7]]
720 ; CGSCC-NEXT: [[F1:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 3
721 ; CGSCC-NEXT: store float [[I]], ptr [[F1]], align 4, !tbaa [[TBAA7]]
722 ; CGSCC-NEXT: [[I4:%.*]] = load float, ptr getelementptr inbounds ([[STRUCT_S]], ptr @Gs1, i64 0, i32 4), align 4, !tbaa [[TBAA10]]
723 ; CGSCC-NEXT: [[MUL:%.*]] = fmul float [[I4]], 2.000000e+00
724 ; CGSCC-NEXT: [[F2:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 4
725 ; CGSCC-NEXT: store float [[MUL]], ptr [[F2]], align 4, !tbaa [[TBAA10]]
726 ; CGSCC-NEXT: [[I5:%.*]] = load float, ptr getelementptr inbounds ([[STRUCT_S]], ptr @Gs1, i64 0, i32 5), align 4, !tbaa [[TBAA11]]
727 ; CGSCC-NEXT: [[I6:%.*]] = load float, ptr getelementptr inbounds ([[STRUCT_S]], ptr @Gs1, i64 0, i32 3), align 4, !tbaa [[TBAA7]]
728 ; CGSCC-NEXT: [[ADD:%.*]] = fadd float [[I5]], [[I6]]
729 ; CGSCC-NEXT: [[F3:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 5
730 ; CGSCC-NEXT: store float [[ADD]], ptr [[F3]], align 4, !tbaa [[TBAA11]]
731 ; CGSCC-NEXT: [[I7:%.*]] = load i32, ptr @Gs1, align 4, !tbaa [[TBAA12]]
732 ; CGSCC-NEXT: store i32 [[I7]], ptr [[AGG_RESULT]], align 4, !tbaa [[TBAA12]]
733 ; CGSCC-NEXT: [[I8:%.*]] = load i32, ptr getelementptr inbounds ([[STRUCT_S]], ptr @Gs1, i64 0, i32 1), align 4, !tbaa [[TBAA13]]
734 ; CGSCC-NEXT: [[MUL1:%.*]] = shl nsw i32 [[I8]], 1
735 ; CGSCC-NEXT: [[I2:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 1
736 ; CGSCC-NEXT: store i32 [[MUL1]], ptr [[I2]], align 4, !tbaa [[TBAA13]]
737 ; CGSCC-NEXT: [[I9:%.*]] = load i32, ptr getelementptr inbounds ([[STRUCT_S]], ptr @Gs1, i64 0, i32 2), align 4, !tbaa [[TBAA14]]
738 ; CGSCC-NEXT: [[I10:%.*]] = load i32, ptr @Gs1, align 4, !tbaa [[TBAA12]]
739 ; CGSCC-NEXT: [[ADD2:%.*]] = add nsw i32 [[I9]], [[I10]]
740 ; CGSCC-NEXT: [[I3:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 2
741 ; CGSCC-NEXT: store i32 [[ADD2]], ptr [[I3]], align 4, !tbaa [[TBAA14]]
742 ; CGSCC-NEXT: ret void
745 store float 0x3FF19999A0000000, ptr getelementptr inbounds (%struct.S, ptr @Gs1, i64 0, i32 3), align 4, !tbaa !7
746 store float 0x40019999A0000000, ptr getelementptr inbounds (%struct.S, ptr @Gs1, i64 0, i32 4), align 4, !tbaa !10
747 store float 0x400A666660000000, ptr getelementptr inbounds (%struct.S, ptr @Gs1, i64 0, i32 5), align 4, !tbaa !11
748 call void @write_arg(ptr @Gs1, i32 1)
749 call void @write_arg(ptr getelementptr inbounds (%struct.S, ptr @Gs1, i64 0, i32 1), i32 2)
750 call void @write_arg(ptr getelementptr inbounds (%struct.S, ptr @Gs1, i64 0, i32 2), i32 3)
751 %i = load float, ptr getelementptr inbounds (%struct.S, ptr @Gs1, i64 0, i32 3), align 4, !tbaa !7
752 %f1 = getelementptr inbounds %struct.S, ptr %agg.result, i64 0, i32 3
753 store float %i, ptr %f1, align 4, !tbaa !7
754 %i4 = load float, ptr getelementptr inbounds (%struct.S, ptr @Gs1, i64 0, i32 4), align 4, !tbaa !10
755 %mul = fmul float %i4, 2.000000e+00
756 %f2 = getelementptr inbounds %struct.S, ptr %agg.result, i64 0, i32 4
757 store float %mul, ptr %f2, align 4, !tbaa !10
758 %i5 = load float, ptr getelementptr inbounds (%struct.S, ptr @Gs1, i64 0, i32 5), align 4, !tbaa !11
759 %i6 = load float, ptr getelementptr inbounds (%struct.S, ptr @Gs1, i64 0, i32 3), align 4, !tbaa !7
760 %add = fadd float %i5, %i6
761 %f3 = getelementptr inbounds %struct.S, ptr %agg.result, i64 0, i32 5
762 store float %add, ptr %f3, align 4, !tbaa !11
763 %i7 = load i32, ptr @Gs1, align 4, !tbaa !12
764 store i32 %i7, ptr %agg.result, align 4, !tbaa !12
765 %i8 = load i32, ptr getelementptr inbounds (%struct.S, ptr @Gs1, i64 0, i32 1), align 4, !tbaa !13
766 %mul1 = shl nsw i32 %i8, 1
767 %i2 = getelementptr inbounds %struct.S, ptr %agg.result, i64 0, i32 1
768 store i32 %mul1, ptr %i2, align 4, !tbaa !13
769 %i9 = load i32, ptr getelementptr inbounds (%struct.S, ptr @Gs1, i64 0, i32 2), align 4, !tbaa !14
770 %i10 = load i32, ptr @Gs1, align 4, !tbaa !12
771 %add2 = add nsw i32 %i9, %i10
772 %i3 = getelementptr inbounds %struct.S, ptr %agg.result, i64 0, i32 2
773 store i32 %add2, ptr %i3, align 4, !tbaa !14
777 define i32 @test_range_merge1() {
778 ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)
779 ; TUNIT-LABEL: define {{[^@]+}}@test_range_merge1
780 ; TUNIT-SAME: () #[[ATTR5]] {
781 ; TUNIT-NEXT: ret i32 2
783 ; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)
784 ; CGSCC-LABEL: define {{[^@]+}}@test_range_merge1
785 ; CGSCC-SAME: () #[[ATTR6:[0-9]+]] {
786 ; CGSCC-NEXT: ret i32 2
788 store <2 x i32> <i32 1, i32 1>, ptr @Vs1
789 store float 2.000000e+00, ptr getelementptr inbounds (%struct.S, ptr @Vs1, i64 0, i32 4)
790 %l0 = load i32, ptr getelementptr inbounds (%struct.S, ptr @Vs1, i64 0, i32 0)
791 %l1 = load i32, ptr getelementptr inbounds (%struct.S, ptr @Vs1, i64 0, i32 1)
792 %add = add i32 %l0, %l1
796 define i32 @test_range_merge2() {
797 ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn
798 ; TUNIT-LABEL: define {{[^@]+}}@test_range_merge2
799 ; TUNIT-SAME: () #[[ATTR3]] {
800 ; TUNIT-NEXT: store <2 x i32> <i32 3, i32 4>, ptr @Vs2, align 8
801 ; TUNIT-NEXT: [[L0:%.*]] = load i32, ptr @Vs2, align 4
802 ; TUNIT-NEXT: [[L1:%.*]] = load i32, ptr getelementptr inbounds ([[STRUCT_S:%.*]], ptr @Vs2, i64 0, i32 1), align 4
803 ; TUNIT-NEXT: [[ADD:%.*]] = add i32 [[L0]], [[L1]]
804 ; TUNIT-NEXT: ret i32 [[ADD]]
806 ; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn
807 ; CGSCC-LABEL: define {{[^@]+}}@test_range_merge2
808 ; CGSCC-SAME: () #[[ATTR5]] {
809 ; CGSCC-NEXT: store <2 x i32> <i32 3, i32 4>, ptr @Vs2, align 8
810 ; CGSCC-NEXT: [[L0:%.*]] = load i32, ptr @Vs2, align 4
811 ; CGSCC-NEXT: [[L1:%.*]] = load i32, ptr getelementptr inbounds ([[STRUCT_S:%.*]], ptr @Vs2, i64 0, i32 1), align 4
812 ; CGSCC-NEXT: [[ADD:%.*]] = add i32 [[L0]], [[L1]]
813 ; CGSCC-NEXT: ret i32 [[ADD]]
815 store <2 x i32> <i32 3, i32 4>, ptr @Vs2
816 store float 2.000000e+00, ptr getelementptr inbounds (%struct.S, ptr @Vs2, i64 0, i32 4)
817 %l0 = load i32, ptr getelementptr inbounds (%struct.S, ptr @Vs2, i64 0, i32 0)
818 %l1 = load i32, ptr getelementptr inbounds (%struct.S, ptr @Vs2, i64 0, i32 1)
819 %add = add i32 %l0, %l1
823 ; static char GBytes[1024];
824 ; void static_global_simplifiable_2(void) {
825 ; for (int i = 0; i < 100; ++i)
826 ; GBytes[i * 10] = 0;
827 ; for (int i = 0; i < 10; ++i)
828 ; ((float *)GBytes)[i * 10 + 1] = 0;
829 ; for (int i = 0; i < 20; ++i)
830 ; ((long long int *)GBytes)[i * 10 + 2] = 0;
832 ; write_arg((int *)&GBytes[500], 0);
834 ; for (int i = 0; i < 1024; ++i)
835 ; globalBytes[i] = GBytes[i];
838 define void @static_global_simplifiable_2() {
839 ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)
840 ; TUNIT-LABEL: define {{[^@]+}}@static_global_simplifiable_2
841 ; TUNIT-SAME: () #[[ATTR5]] {
843 ; TUNIT-NEXT: br label [[FOR_COND:%.*]]
845 ; TUNIT-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[FOR_INC:%.*]] ], [ 0, [[ENTRY:%.*]] ]
846 ; TUNIT-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV]], 100
847 ; TUNIT-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY:%.*]], label [[FOR_COND_CLEANUP:%.*]]
848 ; TUNIT: for.cond.cleanup:
849 ; TUNIT-NEXT: br label [[FOR_END:%.*]]
851 ; TUNIT-NEXT: [[I:%.*]] = mul nuw nsw i64 [[INDVARS_IV]], 10
852 ; TUNIT-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [1024 x i8], ptr @GBytes, i64 0, i64 [[I]]
853 ; TUNIT-NEXT: br label [[FOR_INC]]
855 ; TUNIT-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
856 ; TUNIT-NEXT: br label [[FOR_COND]], !llvm.loop [[LOOP21:![0-9]+]]
858 ; TUNIT-NEXT: br label [[FOR_COND2:%.*]]
860 ; TUNIT-NEXT: [[INDVARS_IV2:%.*]] = phi i64 [ [[INDVARS_IV_NEXT3:%.*]], [[FOR_INC9:%.*]] ], [ 0, [[FOR_END]] ]
861 ; TUNIT-NEXT: [[EXITCOND6:%.*]] = icmp ne i64 [[INDVARS_IV2]], 10
862 ; TUNIT-NEXT: br i1 [[EXITCOND6]], label [[FOR_BODY5:%.*]], label [[FOR_COND_CLEANUP4:%.*]]
863 ; TUNIT: for.cond.cleanup4:
864 ; TUNIT-NEXT: br label [[FOR_END11:%.*]]
866 ; TUNIT-NEXT: [[I15:%.*]] = mul nuw nsw i64 [[INDVARS_IV2]], 10
867 ; TUNIT-NEXT: [[I16:%.*]] = or i64 [[I15]], 1
868 ; TUNIT-NEXT: [[ARRAYIDX8:%.*]] = getelementptr inbounds float, ptr @GBytes, i64 [[I16]]
869 ; TUNIT-NEXT: br label [[FOR_INC9]]
871 ; TUNIT-NEXT: [[INDVARS_IV_NEXT3]] = add nuw nsw i64 [[INDVARS_IV2]], 1
872 ; TUNIT-NEXT: br label [[FOR_COND2]], !llvm.loop [[LOOP22:![0-9]+]]
874 ; TUNIT-NEXT: br label [[FOR_COND13:%.*]]
876 ; TUNIT-NEXT: [[INDVARS_IV7:%.*]] = phi i64 [ [[INDVARS_IV_NEXT8:%.*]], [[FOR_INC21:%.*]] ], [ 0, [[FOR_END11]] ]
877 ; TUNIT-NEXT: [[EXITCOND11:%.*]] = icmp ne i64 [[INDVARS_IV7]], 20
878 ; TUNIT-NEXT: br i1 [[EXITCOND11]], label [[FOR_BODY16:%.*]], label [[FOR_COND_CLEANUP15:%.*]]
879 ; TUNIT: for.cond.cleanup15:
880 ; TUNIT-NEXT: br label [[FOR_END23:%.*]]
882 ; TUNIT-NEXT: [[I17:%.*]] = mul nuw nsw i64 [[INDVARS_IV7]], 10
883 ; TUNIT-NEXT: [[I18:%.*]] = add nuw nsw i64 [[I17]], 2
884 ; TUNIT-NEXT: [[ARRAYIDX20:%.*]] = getelementptr inbounds i64, ptr @GBytes, i64 [[I18]]
885 ; TUNIT-NEXT: br label [[FOR_INC21]]
887 ; TUNIT-NEXT: [[INDVARS_IV_NEXT8]] = add nuw nsw i64 [[INDVARS_IV7]], 1
888 ; TUNIT-NEXT: br label [[FOR_COND13]], !llvm.loop [[LOOP23:![0-9]+]]
890 ; TUNIT-NEXT: call void @write_arg(ptr nocapture nofree noundef nonnull writeonly align 4 dereferenceable(524) getelementptr inbounds ([1024 x i8], ptr @GBytes, i64 0, i64 500), i32 noundef 0) #[[ATTR18]]
891 ; TUNIT-NEXT: br label [[FOR_COND25:%.*]]
893 ; TUNIT-NEXT: [[INDVARS_IV12:%.*]] = phi i64 [ [[INDVARS_IV_NEXT13:%.*]], [[FOR_INC33:%.*]] ], [ 0, [[FOR_END23]] ]
894 ; TUNIT-NEXT: [[EXITCOND14:%.*]] = icmp ne i64 [[INDVARS_IV12]], 1024
895 ; TUNIT-NEXT: br i1 [[EXITCOND14]], label [[FOR_BODY28:%.*]], label [[FOR_COND_CLEANUP27:%.*]]
896 ; TUNIT: for.cond.cleanup27:
897 ; TUNIT-NEXT: br label [[FOR_END35:%.*]]
899 ; TUNIT-NEXT: [[ARRAYIDX32:%.*]] = getelementptr inbounds [1024 x i8], ptr @globalBytes, i64 0, i64 [[INDVARS_IV12]]
900 ; TUNIT-NEXT: store i8 0, ptr [[ARRAYIDX32]], align 1, !tbaa [[TBAA19]]
901 ; TUNIT-NEXT: br label [[FOR_INC33]]
903 ; TUNIT-NEXT: [[INDVARS_IV_NEXT13]] = add nuw nsw i64 [[INDVARS_IV12]], 1
904 ; TUNIT-NEXT: br label [[FOR_COND25]], !llvm.loop [[LOOP24:![0-9]+]]
906 ; TUNIT-NEXT: ret void
908 ; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn
909 ; CGSCC-LABEL: define {{[^@]+}}@static_global_simplifiable_2
910 ; CGSCC-SAME: () #[[ATTR3]] {
912 ; CGSCC-NEXT: br label [[FOR_COND:%.*]]
914 ; CGSCC-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[FOR_INC:%.*]] ], [ 0, [[ENTRY:%.*]] ]
915 ; CGSCC-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV]], 100
916 ; CGSCC-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY:%.*]], label [[FOR_COND_CLEANUP:%.*]]
917 ; CGSCC: for.cond.cleanup:
918 ; CGSCC-NEXT: br label [[FOR_END:%.*]]
920 ; CGSCC-NEXT: [[I:%.*]] = mul nuw nsw i64 [[INDVARS_IV]], 10
921 ; CGSCC-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [1024 x i8], ptr @GBytes, i64 0, i64 [[I]]
922 ; CGSCC-NEXT: store i8 0, ptr [[ARRAYIDX]], align 2, !tbaa [[TBAA15]]
923 ; CGSCC-NEXT: br label [[FOR_INC]]
925 ; CGSCC-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
926 ; CGSCC-NEXT: br label [[FOR_COND]], !llvm.loop [[LOOP24:![0-9]+]]
928 ; CGSCC-NEXT: br label [[FOR_COND2:%.*]]
930 ; CGSCC-NEXT: [[INDVARS_IV2:%.*]] = phi i64 [ [[INDVARS_IV_NEXT3:%.*]], [[FOR_INC9:%.*]] ], [ 0, [[FOR_END]] ]
931 ; CGSCC-NEXT: [[EXITCOND6:%.*]] = icmp ne i64 [[INDVARS_IV2]], 10
932 ; CGSCC-NEXT: br i1 [[EXITCOND6]], label [[FOR_BODY5:%.*]], label [[FOR_COND_CLEANUP4:%.*]]
933 ; CGSCC: for.cond.cleanup4:
934 ; CGSCC-NEXT: br label [[FOR_END11:%.*]]
936 ; CGSCC-NEXT: [[I15:%.*]] = mul nuw nsw i64 [[INDVARS_IV2]], 10
937 ; CGSCC-NEXT: [[I16:%.*]] = or i64 [[I15]], 1
938 ; CGSCC-NEXT: [[ARRAYIDX8:%.*]] = getelementptr inbounds float, ptr @GBytes, i64 [[I16]]
939 ; CGSCC-NEXT: store float 0.000000e+00, ptr [[ARRAYIDX8]], align 4, !tbaa [[TBAA18]]
940 ; CGSCC-NEXT: br label [[FOR_INC9]]
942 ; CGSCC-NEXT: [[INDVARS_IV_NEXT3]] = add nuw nsw i64 [[INDVARS_IV2]], 1
943 ; CGSCC-NEXT: br label [[FOR_COND2]], !llvm.loop [[LOOP25:![0-9]+]]
945 ; CGSCC-NEXT: br label [[FOR_COND13:%.*]]
947 ; CGSCC-NEXT: [[INDVARS_IV7:%.*]] = phi i64 [ [[INDVARS_IV_NEXT8:%.*]], [[FOR_INC21:%.*]] ], [ 0, [[FOR_END11]] ]
948 ; CGSCC-NEXT: [[EXITCOND11:%.*]] = icmp ne i64 [[INDVARS_IV7]], 20
949 ; CGSCC-NEXT: br i1 [[EXITCOND11]], label [[FOR_BODY16:%.*]], label [[FOR_COND_CLEANUP15:%.*]]
950 ; CGSCC: for.cond.cleanup15:
951 ; CGSCC-NEXT: br label [[FOR_END23:%.*]]
953 ; CGSCC-NEXT: [[I17:%.*]] = mul nuw nsw i64 [[INDVARS_IV7]], 10
954 ; CGSCC-NEXT: [[I18:%.*]] = add nuw nsw i64 [[I17]], 2
955 ; CGSCC-NEXT: [[ARRAYIDX20:%.*]] = getelementptr inbounds i64, ptr @GBytes, i64 [[I18]]
956 ; CGSCC-NEXT: store i64 0, ptr [[ARRAYIDX20]], align 16, !tbaa [[TBAA20]]
957 ; CGSCC-NEXT: br label [[FOR_INC21]]
959 ; CGSCC-NEXT: [[INDVARS_IV_NEXT8]] = add nuw nsw i64 [[INDVARS_IV7]], 1
960 ; CGSCC-NEXT: br label [[FOR_COND13]], !llvm.loop [[LOOP26:![0-9]+]]
962 ; CGSCC-NEXT: store i8 0, ptr getelementptr inbounds ([1024 x i8], ptr @GBytes, i64 0, i64 1023), align 1, !tbaa [[TBAA15]]
963 ; CGSCC-NEXT: call void @write_arg(ptr nocapture nofree noundef nonnull writeonly align 4 dereferenceable(524) getelementptr inbounds ([1024 x i8], ptr @GBytes, i64 0, i64 500), i32 noundef 0) #[[ATTR21]]
964 ; CGSCC-NEXT: br label [[FOR_COND25:%.*]]
966 ; CGSCC-NEXT: [[INDVARS_IV12:%.*]] = phi i64 [ [[INDVARS_IV_NEXT13:%.*]], [[FOR_INC33:%.*]] ], [ 0, [[FOR_END23]] ]
967 ; CGSCC-NEXT: [[EXITCOND14:%.*]] = icmp ne i64 [[INDVARS_IV12]], 1024
968 ; CGSCC-NEXT: br i1 [[EXITCOND14]], label [[FOR_BODY28:%.*]], label [[FOR_COND_CLEANUP27:%.*]]
969 ; CGSCC: for.cond.cleanup27:
970 ; CGSCC-NEXT: br label [[FOR_END35:%.*]]
972 ; CGSCC-NEXT: [[ARRAYIDX30:%.*]] = getelementptr inbounds [1024 x i8], ptr @GBytes, i64 0, i64 [[INDVARS_IV12]]
973 ; CGSCC-NEXT: [[I19:%.*]] = load i8, ptr [[ARRAYIDX30]], align 1, !tbaa [[TBAA15]]
974 ; CGSCC-NEXT: [[ARRAYIDX32:%.*]] = getelementptr inbounds [1024 x i8], ptr @globalBytes, i64 0, i64 [[INDVARS_IV12]]
975 ; CGSCC-NEXT: store i8 [[I19]], ptr [[ARRAYIDX32]], align 1, !tbaa [[TBAA15]]
976 ; CGSCC-NEXT: br label [[FOR_INC33]]
978 ; CGSCC-NEXT: [[INDVARS_IV_NEXT13]] = add nuw nsw i64 [[INDVARS_IV12]], 1
979 ; CGSCC-NEXT: br label [[FOR_COND25]], !llvm.loop [[LOOP27:![0-9]+]]
981 ; CGSCC-NEXT: ret void
986 for.cond: ; preds = %for.inc, %entry
987 %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
988 %exitcond = icmp ne i64 %indvars.iv, 100
989 br i1 %exitcond, label %for.body, label %for.cond.cleanup
991 for.cond.cleanup: ; preds = %for.cond
994 for.body: ; preds = %for.cond
995 %i = mul nuw nsw i64 %indvars.iv, 10
996 %arrayidx = getelementptr inbounds [1024 x i8], ptr @GBytes, i64 0, i64 %i
997 store i8 0, ptr %arrayidx, align 2, !tbaa !15
1000 for.inc: ; preds = %for.body
1001 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
1002 br label %for.cond, !llvm.loop !24
1004 for.end: ; preds = %for.cond.cleanup
1007 for.cond2: ; preds = %for.inc9, %for.end
1008 %indvars.iv2 = phi i64 [ %indvars.iv.next3, %for.inc9 ], [ 0, %for.end ]
1009 %exitcond6 = icmp ne i64 %indvars.iv2, 10
1010 br i1 %exitcond6, label %for.body5, label %for.cond.cleanup4
1012 for.cond.cleanup4: ; preds = %for.cond2
1015 for.body5: ; preds = %for.cond2
1016 %i15 = mul nuw nsw i64 %indvars.iv2, 10
1017 %i16 = or i64 %i15, 1
1018 %arrayidx8 = getelementptr inbounds float, ptr @GBytes, i64 %i16
1019 store float 0.000000e+00, ptr %arrayidx8, align 4, !tbaa !18
1022 for.inc9: ; preds = %for.body5
1023 %indvars.iv.next3 = add nuw nsw i64 %indvars.iv2, 1
1024 br label %for.cond2, !llvm.loop !25
1026 for.end11: ; preds = %for.cond.cleanup4
1027 br label %for.cond13
1029 for.cond13: ; preds = %for.inc21, %for.end11
1030 %indvars.iv7 = phi i64 [ %indvars.iv.next8, %for.inc21 ], [ 0, %for.end11 ]
1031 %exitcond11 = icmp ne i64 %indvars.iv7, 20
1032 br i1 %exitcond11, label %for.body16, label %for.cond.cleanup15
1034 for.cond.cleanup15: ; preds = %for.cond13
1037 for.body16: ; preds = %for.cond13
1038 %i17 = mul nuw nsw i64 %indvars.iv7, 10
1039 %i18 = add nuw nsw i64 %i17, 2
1040 %arrayidx20 = getelementptr inbounds i64, ptr @GBytes, i64 %i18
1041 store i64 0, ptr %arrayidx20, align 16, !tbaa !20
1044 for.inc21: ; preds = %for.body16
1045 %indvars.iv.next8 = add nuw nsw i64 %indvars.iv7, 1
1046 br label %for.cond13, !llvm.loop !26
1048 for.end23: ; preds = %for.cond.cleanup15
1049 store i8 0, ptr getelementptr inbounds ([1024 x i8], ptr @GBytes, i64 0, i64 1023), align 1, !tbaa !15
1050 call void @write_arg(ptr getelementptr inbounds ([1024 x i8], ptr @GBytes, i64 0, i64 500), i32 0)
1051 br label %for.cond25
1053 for.cond25: ; preds = %for.inc33, %for.end23
1054 %indvars.iv12 = phi i64 [ %indvars.iv.next13, %for.inc33 ], [ 0, %for.end23 ]
1055 %exitcond14 = icmp ne i64 %indvars.iv12, 1024
1056 br i1 %exitcond14, label %for.body28, label %for.cond.cleanup27
1058 for.cond.cleanup27: ; preds = %for.cond25
1061 for.body28: ; preds = %for.cond25
1062 %arrayidx30 = getelementptr inbounds [1024 x i8], ptr @GBytes, i64 0, i64 %indvars.iv12
1063 %i19 = load i8, ptr %arrayidx30, align 1, !tbaa !15
1064 %arrayidx32 = getelementptr inbounds [1024 x i8], ptr @globalBytes, i64 0, i64 %indvars.iv12
1065 store i8 %i19, ptr %arrayidx32, align 1, !tbaa !15
1068 for.inc33: ; preds = %for.body28
1069 %indvars.iv.next13 = add nuw nsw i64 %indvars.iv12, 1
1070 br label %for.cond25, !llvm.loop !27
1072 for.end35: ; preds = %for.cond.cleanup27
1077 ; int static_global_simplifiable_3() {
1081 define i32 @static_global_simplifiable_3() {
1082 ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)
1083 ; TUNIT-LABEL: define {{[^@]+}}@static_global_simplifiable_3
1084 ; TUNIT-SAME: () #[[ATTR5]] {
1085 ; TUNIT-NEXT: store i32 1, ptr @Flag3, align 4, !tbaa [[TBAA3]]
1086 ; TUNIT-NEXT: ret i32 1
1088 ; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)
1089 ; CGSCC-LABEL: define {{[^@]+}}@static_global_simplifiable_3
1090 ; CGSCC-SAME: () #[[ATTR6]] {
1091 ; CGSCC-NEXT: store i32 1, ptr @Flag3, align 4, !tbaa [[TBAA3]]
1092 ; CGSCC-NEXT: ret i32 1
1094 store i32 1, ptr @Flag3, align 4, !tbaa !3
1095 %i = load i32, ptr @Flag3, align 4, !tbaa !3
1099 ; struct S noalias_arg_simplifiable_1(struct S s) {
1103 ; write_arg(&s.i1, 1);
1104 ; write_arg(&s.i2, 2);
1105 ; write_arg(&s.i3, 3);
1109 ; r.f3 = s.f3 + s.f1;
1112 ; r.i3 = s.i3 + s.i1;
1116 define void @noalias_arg_simplifiable_1(ptr noalias sret(%struct.S) align 4 %agg.result, ptr byval(%struct.S) align 8 %s) {
1117 ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite)
1118 ; TUNIT-LABEL: define {{[^@]+}}@noalias_arg_simplifiable_1
1119 ; TUNIT-SAME: (ptr noalias nocapture nofree writeonly sret([[STRUCT_S:%.*]]) align 4 dereferenceable_or_null(24) [[AGG_RESULT:%.*]], ptr noalias nocapture nofree nonnull byval([[STRUCT_S]]) align 8 dereferenceable(24) [[S:%.*]]) #[[ATTR1]] {
1120 ; TUNIT-NEXT: entry:
1121 ; TUNIT-NEXT: [[F1:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 3
1122 ; TUNIT-NEXT: store float 0x3FF19999A0000000, ptr [[F1]], align 4, !tbaa [[TBAA7]]
1123 ; TUNIT-NEXT: [[F2:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 4
1124 ; TUNIT-NEXT: store float 0x40019999A0000000, ptr [[F2]], align 8, !tbaa [[TBAA10]]
1125 ; TUNIT-NEXT: [[F3:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 5
1126 ; TUNIT-NEXT: store float 0x400A666660000000, ptr [[F3]], align 4, !tbaa [[TBAA11]]
1127 ; TUNIT-NEXT: call void @write_arg(ptr noalias nocapture nofree noundef nonnull writeonly align 8 dereferenceable(24) [[S]], i32 noundef 1) #[[ATTR18]]
1128 ; TUNIT-NEXT: [[I2:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 1
1129 ; TUNIT-NEXT: call void @write_arg(ptr nocapture nofree noundef nonnull writeonly align 4 dereferenceable(20) [[I2]], i32 noundef 2) #[[ATTR18]]
1130 ; TUNIT-NEXT: [[I3:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 2
1131 ; TUNIT-NEXT: call void @write_arg(ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(16) [[I3]], i32 noundef 3) #[[ATTR18]]
1132 ; TUNIT-NEXT: [[F11:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 3
1133 ; TUNIT-NEXT: [[I:%.*]] = load float, ptr [[F11]], align 4, !tbaa [[TBAA7]]
1134 ; TUNIT-NEXT: [[F12:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 3
1135 ; TUNIT-NEXT: store float [[I]], ptr [[F12]], align 4, !tbaa [[TBAA7]]
1136 ; TUNIT-NEXT: [[F23:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 4
1137 ; TUNIT-NEXT: [[I4:%.*]] = load float, ptr [[F23]], align 8, !tbaa [[TBAA10]]
1138 ; TUNIT-NEXT: [[MUL:%.*]] = fmul float [[I4]], 2.000000e+00
1139 ; TUNIT-NEXT: [[F24:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 4
1140 ; TUNIT-NEXT: store float [[MUL]], ptr [[F24]], align 4, !tbaa [[TBAA10]]
1141 ; TUNIT-NEXT: [[F35:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 5
1142 ; TUNIT-NEXT: [[I5:%.*]] = load float, ptr [[F35]], align 4, !tbaa [[TBAA11]]
1143 ; TUNIT-NEXT: [[F16:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 3
1144 ; TUNIT-NEXT: [[I6:%.*]] = load float, ptr [[F16]], align 4, !tbaa [[TBAA7]]
1145 ; TUNIT-NEXT: [[ADD:%.*]] = fadd float [[I5]], [[I6]]
1146 ; TUNIT-NEXT: [[F37:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 5
1147 ; TUNIT-NEXT: store float [[ADD]], ptr [[F37]], align 4, !tbaa [[TBAA11]]
1148 ; TUNIT-NEXT: [[I7:%.*]] = load i32, ptr [[S]], align 8, !tbaa [[TBAA12]]
1149 ; TUNIT-NEXT: store i32 [[I7]], ptr [[AGG_RESULT]], align 4, !tbaa [[TBAA12]]
1150 ; TUNIT-NEXT: [[I210:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 1
1151 ; TUNIT-NEXT: [[I8:%.*]] = load i32, ptr [[I210]], align 4, !tbaa [[TBAA13]]
1152 ; TUNIT-NEXT: [[MUL11:%.*]] = shl nsw i32 [[I8]], 1
1153 ; TUNIT-NEXT: [[I212:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 1
1154 ; TUNIT-NEXT: store i32 [[MUL11]], ptr [[I212]], align 4, !tbaa [[TBAA13]]
1155 ; TUNIT-NEXT: [[I313:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 2
1156 ; TUNIT-NEXT: [[I9:%.*]] = load i32, ptr [[I313]], align 8, !tbaa [[TBAA14]]
1157 ; TUNIT-NEXT: [[I10:%.*]] = load i32, ptr [[S]], align 8, !tbaa [[TBAA12]]
1158 ; TUNIT-NEXT: [[ADD15:%.*]] = add nsw i32 [[I9]], [[I10]]
1159 ; TUNIT-NEXT: [[I316:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 2
1160 ; TUNIT-NEXT: store i32 [[ADD15]], ptr [[I316]], align 4, !tbaa [[TBAA14]]
1161 ; TUNIT-NEXT: ret void
1163 ; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: readwrite)
1164 ; CGSCC-LABEL: define {{[^@]+}}@noalias_arg_simplifiable_1
1165 ; CGSCC-SAME: (ptr noalias nocapture nofree noundef nonnull writeonly sret([[STRUCT_S:%.*]]) align 4 dereferenceable(24) [[AGG_RESULT:%.*]], ptr noalias nocapture nofree noundef nonnull byval([[STRUCT_S]]) align 8 dereferenceable(24) [[S:%.*]]) #[[ATTR1]] {
1166 ; CGSCC-NEXT: entry:
1167 ; CGSCC-NEXT: [[F1:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 3
1168 ; CGSCC-NEXT: store float 0x3FF19999A0000000, ptr [[F1]], align 4, !tbaa [[TBAA7]]
1169 ; CGSCC-NEXT: [[F2:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 4
1170 ; CGSCC-NEXT: store float 0x40019999A0000000, ptr [[F2]], align 8, !tbaa [[TBAA10]]
1171 ; CGSCC-NEXT: [[F3:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 5
1172 ; CGSCC-NEXT: store float 0x400A666660000000, ptr [[F3]], align 4, !tbaa [[TBAA11]]
1173 ; CGSCC-NEXT: call void @write_arg(ptr noalias nocapture nofree noundef nonnull writeonly align 8 dereferenceable(24) [[S]], i32 noundef 1) #[[ATTR21]]
1174 ; CGSCC-NEXT: [[I2:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 1
1175 ; CGSCC-NEXT: call void @write_arg(ptr nocapture nofree noundef nonnull writeonly align 4 dereferenceable(20) [[I2]], i32 noundef 2) #[[ATTR21]]
1176 ; CGSCC-NEXT: [[I3:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 2
1177 ; CGSCC-NEXT: call void @write_arg(ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(16) [[I3]], i32 noundef 3) #[[ATTR21]]
1178 ; CGSCC-NEXT: [[F11:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 3
1179 ; CGSCC-NEXT: [[I:%.*]] = load float, ptr [[F11]], align 4, !tbaa [[TBAA7]]
1180 ; CGSCC-NEXT: [[F12:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 3
1181 ; CGSCC-NEXT: store float [[I]], ptr [[F12]], align 4, !tbaa [[TBAA7]]
1182 ; CGSCC-NEXT: [[F23:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 4
1183 ; CGSCC-NEXT: [[I4:%.*]] = load float, ptr [[F23]], align 8, !tbaa [[TBAA10]]
1184 ; CGSCC-NEXT: [[MUL:%.*]] = fmul float [[I4]], 2.000000e+00
1185 ; CGSCC-NEXT: [[F24:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 4
1186 ; CGSCC-NEXT: store float [[MUL]], ptr [[F24]], align 4, !tbaa [[TBAA10]]
1187 ; CGSCC-NEXT: [[F35:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 5
1188 ; CGSCC-NEXT: [[I5:%.*]] = load float, ptr [[F35]], align 4, !tbaa [[TBAA11]]
1189 ; CGSCC-NEXT: [[F16:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 3
1190 ; CGSCC-NEXT: [[I6:%.*]] = load float, ptr [[F16]], align 4, !tbaa [[TBAA7]]
1191 ; CGSCC-NEXT: [[ADD:%.*]] = fadd float [[I5]], [[I6]]
1192 ; CGSCC-NEXT: [[F37:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 5
1193 ; CGSCC-NEXT: store float [[ADD]], ptr [[F37]], align 4, !tbaa [[TBAA11]]
1194 ; CGSCC-NEXT: [[I7:%.*]] = load i32, ptr [[S]], align 8, !tbaa [[TBAA12]]
1195 ; CGSCC-NEXT: store i32 [[I7]], ptr [[AGG_RESULT]], align 4, !tbaa [[TBAA12]]
1196 ; CGSCC-NEXT: [[I210:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 1
1197 ; CGSCC-NEXT: [[I8:%.*]] = load i32, ptr [[I210]], align 4, !tbaa [[TBAA13]]
1198 ; CGSCC-NEXT: [[MUL11:%.*]] = shl nsw i32 [[I8]], 1
1199 ; CGSCC-NEXT: [[I212:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 1
1200 ; CGSCC-NEXT: store i32 [[MUL11]], ptr [[I212]], align 4, !tbaa [[TBAA13]]
1201 ; CGSCC-NEXT: [[I313:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 2
1202 ; CGSCC-NEXT: [[I9:%.*]] = load i32, ptr [[I313]], align 8, !tbaa [[TBAA14]]
1203 ; CGSCC-NEXT: [[I10:%.*]] = load i32, ptr [[S]], align 8, !tbaa [[TBAA12]]
1204 ; CGSCC-NEXT: [[ADD15:%.*]] = add nsw i32 [[I9]], [[I10]]
1205 ; CGSCC-NEXT: [[I316:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 2
1206 ; CGSCC-NEXT: store i32 [[ADD15]], ptr [[I316]], align 4, !tbaa [[TBAA14]]
1207 ; CGSCC-NEXT: ret void
1210 %f1 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 3
1211 store float 0x3FF19999A0000000, ptr %f1, align 4, !tbaa !7
1212 %f2 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 4
1213 store float 0x40019999A0000000, ptr %f2, align 8, !tbaa !10
1214 %f3 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 5
1215 store float 0x400A666660000000, ptr %f3, align 4, !tbaa !11
1216 call void @write_arg(ptr nonnull %s, i32 1)
1217 %i2 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 1
1218 call void @write_arg(ptr nonnull %i2, i32 2)
1219 %i3 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 2
1220 call void @write_arg(ptr nonnull %i3, i32 3)
1221 %f11 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 3
1222 %i = load float, ptr %f11, align 4, !tbaa !7
1223 %f12 = getelementptr inbounds %struct.S, ptr %agg.result, i64 0, i32 3
1224 store float %i, ptr %f12, align 4, !tbaa !7
1225 %f23 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 4
1226 %i4 = load float, ptr %f23, align 8, !tbaa !10
1227 %mul = fmul float %i4, 2.000000e+00
1228 %f24 = getelementptr inbounds %struct.S, ptr %agg.result, i64 0, i32 4
1229 store float %mul, ptr %f24, align 4, !tbaa !10
1230 %f35 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 5
1231 %i5 = load float, ptr %f35, align 4, !tbaa !11
1232 %f16 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 3
1233 %i6 = load float, ptr %f16, align 4, !tbaa !7
1234 %add = fadd float %i5, %i6
1235 %f37 = getelementptr inbounds %struct.S, ptr %agg.result, i64 0, i32 5
1236 store float %add, ptr %f37, align 4, !tbaa !11
1237 %i7 = load i32, ptr %s, align 8, !tbaa !12
1238 store i32 %i7, ptr %agg.result, align 4, !tbaa !12
1239 %i210 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 1
1240 %i8 = load i32, ptr %i210, align 4, !tbaa !13
1241 %mul11 = shl nsw i32 %i8, 1
1242 %i212 = getelementptr inbounds %struct.S, ptr %agg.result, i64 0, i32 1
1243 store i32 %mul11, ptr %i212, align 4, !tbaa !13
1244 %i313 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 2
1245 %i9 = load i32, ptr %i313, align 8, !tbaa !14
1246 %i10 = load i32, ptr %s, align 8, !tbaa !12
1247 %add15 = add nsw i32 %i9, %i10
1248 %i316 = getelementptr inbounds %struct.S, ptr %agg.result, i64 0, i32 2
1249 store i32 %add15, ptr %i316, align 4, !tbaa !14
1253 ; void noalias_arg_simplifiable_2(char Bytes[1024]) {
1254 ; for (int i = 0; i < 100; ++i)
1255 ; Bytes[i * 10] = 0;
1256 ; for (int i = 0; i < 10; ++i)
1257 ; ((float *)Bytes)[i * 10 + 1] = 0;
1258 ; for (int i = 0; i < 20; ++i)
1259 ; ((long long int *)Bytes)[i * 10 + 2] = 0;
1261 ; write_arg((int *)&Bytes[500], 0);
1263 ; for (int i = 0; i < 1024; ++i)
1264 ; globalBytes[i] = Bytes[i];
1267 define void @noalias_arg_simplifiable_2(ptr %Bytes) {
1268 ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn
1269 ; TUNIT-LABEL: define {{[^@]+}}@noalias_arg_simplifiable_2
1270 ; TUNIT-SAME: (ptr nocapture nofree [[BYTES:%.*]]) #[[ATTR3]] {
1271 ; TUNIT-NEXT: entry:
1272 ; TUNIT-NEXT: br label [[FOR_COND:%.*]]
1274 ; TUNIT-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[FOR_INC:%.*]] ], [ 0, [[ENTRY:%.*]] ]
1275 ; TUNIT-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV]], 100
1276 ; TUNIT-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY:%.*]], label [[FOR_COND_CLEANUP:%.*]]
1277 ; TUNIT: for.cond.cleanup:
1278 ; TUNIT-NEXT: br label [[FOR_END:%.*]]
1280 ; TUNIT-NEXT: [[I:%.*]] = mul nuw nsw i64 [[INDVARS_IV]], 10
1281 ; TUNIT-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i8, ptr [[BYTES]], i64 [[I]]
1282 ; TUNIT-NEXT: store i8 0, ptr [[ARRAYIDX]], align 1, !tbaa [[TBAA19]]
1283 ; TUNIT-NEXT: br label [[FOR_INC]]
1285 ; TUNIT-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
1286 ; TUNIT-NEXT: br label [[FOR_COND]], !llvm.loop [[LOOP25:![0-9]+]]
1288 ; TUNIT-NEXT: br label [[FOR_COND2:%.*]]
1290 ; TUNIT-NEXT: [[INDVARS_IV2:%.*]] = phi i64 [ [[INDVARS_IV_NEXT3:%.*]], [[FOR_INC9:%.*]] ], [ 0, [[FOR_END]] ]
1291 ; TUNIT-NEXT: [[EXITCOND6:%.*]] = icmp ne i64 [[INDVARS_IV2]], 10
1292 ; TUNIT-NEXT: br i1 [[EXITCOND6]], label [[FOR_BODY5:%.*]], label [[FOR_COND_CLEANUP4:%.*]]
1293 ; TUNIT: for.cond.cleanup4:
1294 ; TUNIT-NEXT: br label [[FOR_END11:%.*]]
1296 ; TUNIT-NEXT: [[I16:%.*]] = mul nuw nsw i64 [[INDVARS_IV2]], 10
1297 ; TUNIT-NEXT: [[I17:%.*]] = or i64 [[I16]], 1
1298 ; TUNIT-NEXT: [[ARRAYIDX8:%.*]] = getelementptr inbounds float, ptr [[BYTES]], i64 [[I17]]
1299 ; TUNIT-NEXT: store float 0.000000e+00, ptr [[ARRAYIDX8]], align 4, !tbaa [[TBAA26:![0-9]+]]
1300 ; TUNIT-NEXT: br label [[FOR_INC9]]
1302 ; TUNIT-NEXT: [[INDVARS_IV_NEXT3]] = add nuw nsw i64 [[INDVARS_IV2]], 1
1303 ; TUNIT-NEXT: br label [[FOR_COND2]], !llvm.loop [[LOOP27:![0-9]+]]
1305 ; TUNIT-NEXT: br label [[FOR_COND13:%.*]]
1306 ; TUNIT: for.cond13:
1307 ; TUNIT-NEXT: [[INDVARS_IV7:%.*]] = phi i64 [ [[INDVARS_IV_NEXT8:%.*]], [[FOR_INC21:%.*]] ], [ 0, [[FOR_END11]] ]
1308 ; TUNIT-NEXT: [[EXITCOND11:%.*]] = icmp ne i64 [[INDVARS_IV7]], 20
1309 ; TUNIT-NEXT: br i1 [[EXITCOND11]], label [[FOR_BODY16:%.*]], label [[FOR_COND_CLEANUP15:%.*]]
1310 ; TUNIT: for.cond.cleanup15:
1311 ; TUNIT-NEXT: br label [[FOR_END23:%.*]]
1312 ; TUNIT: for.body16:
1313 ; TUNIT-NEXT: [[I19:%.*]] = mul nuw nsw i64 [[INDVARS_IV7]], 10
1314 ; TUNIT-NEXT: [[I20:%.*]] = add nuw nsw i64 [[I19]], 2
1315 ; TUNIT-NEXT: [[ARRAYIDX20:%.*]] = getelementptr inbounds i64, ptr [[BYTES]], i64 [[I20]]
1316 ; TUNIT-NEXT: store i64 0, ptr [[ARRAYIDX20]], align 8, !tbaa [[TBAA28:![0-9]+]]
1317 ; TUNIT-NEXT: br label [[FOR_INC21]]
1319 ; TUNIT-NEXT: [[INDVARS_IV_NEXT8]] = add nuw nsw i64 [[INDVARS_IV7]], 1
1320 ; TUNIT-NEXT: br label [[FOR_COND13]], !llvm.loop [[LOOP30:![0-9]+]]
1322 ; TUNIT-NEXT: [[ARRAYIDX24:%.*]] = getelementptr inbounds i8, ptr [[BYTES]], i64 1023
1323 ; TUNIT-NEXT: store i8 0, ptr [[ARRAYIDX24]], align 1, !tbaa [[TBAA19]]
1324 ; TUNIT-NEXT: [[ARRAYIDX25:%.*]] = getelementptr inbounds i8, ptr [[BYTES]], i64 500
1325 ; TUNIT-NEXT: call void @write_arg(ptr nocapture nofree noundef nonnull writeonly align 4 [[ARRAYIDX25]], i32 noundef 0) #[[ATTR18]]
1326 ; TUNIT-NEXT: br label [[FOR_COND27:%.*]]
1327 ; TUNIT: for.cond27:
1328 ; TUNIT-NEXT: [[INDVARS_IV12:%.*]] = phi i64 [ [[INDVARS_IV_NEXT13:%.*]], [[FOR_INC35:%.*]] ], [ 0, [[FOR_END23]] ]
1329 ; TUNIT-NEXT: [[EXITCOND14:%.*]] = icmp ne i64 [[INDVARS_IV12]], 1024
1330 ; TUNIT-NEXT: br i1 [[EXITCOND14]], label [[FOR_BODY30:%.*]], label [[FOR_COND_CLEANUP29:%.*]]
1331 ; TUNIT: for.cond.cleanup29:
1332 ; TUNIT-NEXT: br label [[FOR_END37:%.*]]
1333 ; TUNIT: for.body30:
1334 ; TUNIT-NEXT: [[ARRAYIDX32:%.*]] = getelementptr inbounds i8, ptr [[BYTES]], i64 [[INDVARS_IV12]]
1335 ; TUNIT-NEXT: [[I22:%.*]] = load i8, ptr [[ARRAYIDX32]], align 1, !tbaa [[TBAA19]]
1336 ; TUNIT-NEXT: [[ARRAYIDX34:%.*]] = getelementptr inbounds [1024 x i8], ptr @globalBytes, i64 0, i64 [[INDVARS_IV12]]
1337 ; TUNIT-NEXT: store i8 [[I22]], ptr [[ARRAYIDX34]], align 1, !tbaa [[TBAA19]]
1338 ; TUNIT-NEXT: br label [[FOR_INC35]]
1340 ; TUNIT-NEXT: [[INDVARS_IV_NEXT13]] = add nuw nsw i64 [[INDVARS_IV12]], 1
1341 ; TUNIT-NEXT: br label [[FOR_COND27]], !llvm.loop [[LOOP31:![0-9]+]]
1343 ; TUNIT-NEXT: ret void
1345 ; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn
1346 ; CGSCC-LABEL: define {{[^@]+}}@noalias_arg_simplifiable_2
1347 ; CGSCC-SAME: (ptr nocapture nofree [[BYTES:%.*]]) #[[ATTR3]] {
1348 ; CGSCC-NEXT: entry:
1349 ; CGSCC-NEXT: br label [[FOR_COND:%.*]]
1351 ; CGSCC-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[FOR_INC:%.*]] ], [ 0, [[ENTRY:%.*]] ]
1352 ; CGSCC-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV]], 100
1353 ; CGSCC-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY:%.*]], label [[FOR_COND_CLEANUP:%.*]]
1354 ; CGSCC: for.cond.cleanup:
1355 ; CGSCC-NEXT: br label [[FOR_END:%.*]]
1357 ; CGSCC-NEXT: [[I:%.*]] = mul nuw nsw i64 [[INDVARS_IV]], 10
1358 ; CGSCC-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i8, ptr [[BYTES]], i64 [[I]]
1359 ; CGSCC-NEXT: store i8 0, ptr [[ARRAYIDX]], align 1, !tbaa [[TBAA15]]
1360 ; CGSCC-NEXT: br label [[FOR_INC]]
1362 ; CGSCC-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
1363 ; CGSCC-NEXT: br label [[FOR_COND]], !llvm.loop [[LOOP28:![0-9]+]]
1365 ; CGSCC-NEXT: br label [[FOR_COND2:%.*]]
1367 ; CGSCC-NEXT: [[INDVARS_IV2:%.*]] = phi i64 [ [[INDVARS_IV_NEXT3:%.*]], [[FOR_INC9:%.*]] ], [ 0, [[FOR_END]] ]
1368 ; CGSCC-NEXT: [[EXITCOND6:%.*]] = icmp ne i64 [[INDVARS_IV2]], 10
1369 ; CGSCC-NEXT: br i1 [[EXITCOND6]], label [[FOR_BODY5:%.*]], label [[FOR_COND_CLEANUP4:%.*]]
1370 ; CGSCC: for.cond.cleanup4:
1371 ; CGSCC-NEXT: br label [[FOR_END11:%.*]]
1373 ; CGSCC-NEXT: [[I16:%.*]] = mul nuw nsw i64 [[INDVARS_IV2]], 10
1374 ; CGSCC-NEXT: [[I17:%.*]] = or i64 [[I16]], 1
1375 ; CGSCC-NEXT: [[ARRAYIDX8:%.*]] = getelementptr inbounds float, ptr [[BYTES]], i64 [[I17]]
1376 ; CGSCC-NEXT: store float 0.000000e+00, ptr [[ARRAYIDX8]], align 4, !tbaa [[TBAA18]]
1377 ; CGSCC-NEXT: br label [[FOR_INC9]]
1379 ; CGSCC-NEXT: [[INDVARS_IV_NEXT3]] = add nuw nsw i64 [[INDVARS_IV2]], 1
1380 ; CGSCC-NEXT: br label [[FOR_COND2]], !llvm.loop [[LOOP29:![0-9]+]]
1382 ; CGSCC-NEXT: br label [[FOR_COND13:%.*]]
1383 ; CGSCC: for.cond13:
1384 ; CGSCC-NEXT: [[INDVARS_IV7:%.*]] = phi i64 [ [[INDVARS_IV_NEXT8:%.*]], [[FOR_INC21:%.*]] ], [ 0, [[FOR_END11]] ]
1385 ; CGSCC-NEXT: [[EXITCOND11:%.*]] = icmp ne i64 [[INDVARS_IV7]], 20
1386 ; CGSCC-NEXT: br i1 [[EXITCOND11]], label [[FOR_BODY16:%.*]], label [[FOR_COND_CLEANUP15:%.*]]
1387 ; CGSCC: for.cond.cleanup15:
1388 ; CGSCC-NEXT: br label [[FOR_END23:%.*]]
1389 ; CGSCC: for.body16:
1390 ; CGSCC-NEXT: [[I19:%.*]] = mul nuw nsw i64 [[INDVARS_IV7]], 10
1391 ; CGSCC-NEXT: [[I20:%.*]] = add nuw nsw i64 [[I19]], 2
1392 ; CGSCC-NEXT: [[ARRAYIDX20:%.*]] = getelementptr inbounds i64, ptr [[BYTES]], i64 [[I20]]
1393 ; CGSCC-NEXT: store i64 0, ptr [[ARRAYIDX20]], align 8, !tbaa [[TBAA20]]
1394 ; CGSCC-NEXT: br label [[FOR_INC21]]
1396 ; CGSCC-NEXT: [[INDVARS_IV_NEXT8]] = add nuw nsw i64 [[INDVARS_IV7]], 1
1397 ; CGSCC-NEXT: br label [[FOR_COND13]], !llvm.loop [[LOOP30:![0-9]+]]
1399 ; CGSCC-NEXT: [[ARRAYIDX24:%.*]] = getelementptr inbounds i8, ptr [[BYTES]], i64 1023
1400 ; CGSCC-NEXT: store i8 0, ptr [[ARRAYIDX24]], align 1, !tbaa [[TBAA15]]
1401 ; CGSCC-NEXT: [[ARRAYIDX25:%.*]] = getelementptr inbounds i8, ptr [[BYTES]], i64 500
1402 ; CGSCC-NEXT: call void @write_arg(ptr nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) [[ARRAYIDX25]], i32 noundef 0) #[[ATTR21]]
1403 ; CGSCC-NEXT: br label [[FOR_COND27:%.*]]
1404 ; CGSCC: for.cond27:
1405 ; CGSCC-NEXT: [[INDVARS_IV12:%.*]] = phi i64 [ [[INDVARS_IV_NEXT13:%.*]], [[FOR_INC35:%.*]] ], [ 0, [[FOR_END23]] ]
1406 ; CGSCC-NEXT: [[EXITCOND14:%.*]] = icmp ne i64 [[INDVARS_IV12]], 1024
1407 ; CGSCC-NEXT: br i1 [[EXITCOND14]], label [[FOR_BODY30:%.*]], label [[FOR_COND_CLEANUP29:%.*]]
1408 ; CGSCC: for.cond.cleanup29:
1409 ; CGSCC-NEXT: br label [[FOR_END37:%.*]]
1410 ; CGSCC: for.body30:
1411 ; CGSCC-NEXT: [[ARRAYIDX32:%.*]] = getelementptr inbounds i8, ptr [[BYTES]], i64 [[INDVARS_IV12]]
1412 ; CGSCC-NEXT: [[I22:%.*]] = load i8, ptr [[ARRAYIDX32]], align 1, !tbaa [[TBAA15]]
1413 ; CGSCC-NEXT: [[ARRAYIDX34:%.*]] = getelementptr inbounds [1024 x i8], ptr @globalBytes, i64 0, i64 [[INDVARS_IV12]]
1414 ; CGSCC-NEXT: store i8 [[I22]], ptr [[ARRAYIDX34]], align 1, !tbaa [[TBAA15]]
1415 ; CGSCC-NEXT: br label [[FOR_INC35]]
1417 ; CGSCC-NEXT: [[INDVARS_IV_NEXT13]] = add nuw nsw i64 [[INDVARS_IV12]], 1
1418 ; CGSCC-NEXT: br label [[FOR_COND27]], !llvm.loop [[LOOP31:![0-9]+]]
1420 ; CGSCC-NEXT: ret void
1425 for.cond: ; preds = %for.inc, %entry
1426 %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
1427 %exitcond = icmp ne i64 %indvars.iv, 100
1428 br i1 %exitcond, label %for.body, label %for.cond.cleanup
1430 for.cond.cleanup: ; preds = %for.cond
1433 for.body: ; preds = %for.cond
1434 %i = mul nuw nsw i64 %indvars.iv, 10
1435 %arrayidx = getelementptr inbounds i8, ptr %Bytes, i64 %i
1436 store i8 0, ptr %arrayidx, align 1, !tbaa !15
1439 for.inc: ; preds = %for.body
1440 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
1441 br label %for.cond, !llvm.loop !28
1443 for.end: ; preds = %for.cond.cleanup
1446 for.cond2: ; preds = %for.inc9, %for.end
1447 %indvars.iv2 = phi i64 [ %indvars.iv.next3, %for.inc9 ], [ 0, %for.end ]
1448 %exitcond6 = icmp ne i64 %indvars.iv2, 10
1449 br i1 %exitcond6, label %for.body5, label %for.cond.cleanup4
1451 for.cond.cleanup4: ; preds = %for.cond2
1454 for.body5: ; preds = %for.cond2
1455 %i16 = mul nuw nsw i64 %indvars.iv2, 10
1456 %i17 = or i64 %i16, 1
1457 %arrayidx8 = getelementptr inbounds float, ptr %Bytes, i64 %i17
1458 store float 0.000000e+00, ptr %arrayidx8, align 4, !tbaa !18
1461 for.inc9: ; preds = %for.body5
1462 %indvars.iv.next3 = add nuw nsw i64 %indvars.iv2, 1
1463 br label %for.cond2, !llvm.loop !29
1465 for.end11: ; preds = %for.cond.cleanup4
1466 br label %for.cond13
1468 for.cond13: ; preds = %for.inc21, %for.end11
1469 %indvars.iv7 = phi i64 [ %indvars.iv.next8, %for.inc21 ], [ 0, %for.end11 ]
1470 %exitcond11 = icmp ne i64 %indvars.iv7, 20
1471 br i1 %exitcond11, label %for.body16, label %for.cond.cleanup15
1473 for.cond.cleanup15: ; preds = %for.cond13
1476 for.body16: ; preds = %for.cond13
1477 %i19 = mul nuw nsw i64 %indvars.iv7, 10
1478 %i20 = add nuw nsw i64 %i19, 2
1479 %arrayidx20 = getelementptr inbounds i64, ptr %Bytes, i64 %i20
1480 store i64 0, ptr %arrayidx20, align 8, !tbaa !20
1483 for.inc21: ; preds = %for.body16
1484 %indvars.iv.next8 = add nuw nsw i64 %indvars.iv7, 1
1485 br label %for.cond13, !llvm.loop !30
1487 for.end23: ; preds = %for.cond.cleanup15
1488 %arrayidx24 = getelementptr inbounds i8, ptr %Bytes, i64 1023
1489 store i8 0, ptr %arrayidx24, align 1, !tbaa !15
1490 %arrayidx25 = getelementptr inbounds i8, ptr %Bytes, i64 500
1491 call void @write_arg(ptr nonnull %arrayidx25, i32 0)
1492 br label %for.cond27
1494 for.cond27: ; preds = %for.inc35, %for.end23
1495 %indvars.iv12 = phi i64 [ %indvars.iv.next13, %for.inc35 ], [ 0, %for.end23 ]
1496 %exitcond14 = icmp ne i64 %indvars.iv12, 1024
1497 br i1 %exitcond14, label %for.body30, label %for.cond.cleanup29
1499 for.cond.cleanup29: ; preds = %for.cond27
1502 for.body30: ; preds = %for.cond27
1503 %arrayidx32 = getelementptr inbounds i8, ptr %Bytes, i64 %indvars.iv12
1504 %i22 = load i8, ptr %arrayidx32, align 1, !tbaa !15
1505 %arrayidx34 = getelementptr inbounds [1024 x i8], ptr @globalBytes, i64 0, i64 %indvars.iv12
1506 store i8 %i22, ptr %arrayidx34, align 1, !tbaa !15
1509 for.inc35: ; preds = %for.body30
1510 %indvars.iv.next13 = add nuw nsw i64 %indvars.iv12, 1
1511 br label %for.cond27, !llvm.loop !31
1513 for.end37: ; preds = %for.cond.cleanup29
1517 ; int local_alloca_not_simplifiable_1() {
1526 define i32 @local_alloca_not_simplifiable_1() {
1527 ; TUNIT-LABEL: define {{[^@]+}}@local_alloca_not_simplifiable_1() {
1528 ; TUNIT-NEXT: entry:
1529 ; TUNIT-NEXT: [[X:%.*]] = alloca i32, align 4
1530 ; TUNIT-NEXT: [[Y:%.*]] = alloca i32, align 4
1531 ; TUNIT-NEXT: call void @llvm.lifetime.start.p0(i64 noundef 4, ptr nocapture nofree noundef nonnull align 4 dereferenceable(4) [[X]]) #[[ATTR17]]
1532 ; TUNIT-NEXT: call void @llvm.lifetime.start.p0(i64 noundef 4, ptr noalias nocapture nofree noundef nonnull align 4 dereferenceable(4) [[Y]]) #[[ATTR17]]
1533 ; TUNIT-NEXT: store i32 1, ptr [[Y]], align 4, !tbaa [[TBAA3]]
1534 ; TUNIT-NEXT: store i32 1, ptr [[X]], align 4, !tbaa [[TBAA3]]
1535 ; TUNIT-NEXT: call void @escape(ptr noundef nonnull align 4 dereferenceable(4) [[X]])
1536 ; TUNIT-NEXT: call void @write_random(ptr noalias nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) [[Y]])
1537 ; TUNIT-NEXT: [[I3:%.*]] = load i32, ptr [[X]], align 4, !tbaa [[TBAA3]]
1538 ; TUNIT-NEXT: [[TOBOOL_NOT:%.*]] = icmp eq i32 [[I3]], 0
1539 ; TUNIT-NEXT: [[COND:%.*]] = select i1 [[TOBOOL_NOT]], i32 2, i32 1
1540 ; TUNIT-NEXT: [[I4:%.*]] = load i32, ptr [[Y]], align 4, !tbaa [[TBAA3]]
1541 ; TUNIT-NEXT: [[ADD:%.*]] = add nsw i32 [[I3]], [[I4]]
1542 ; TUNIT-NEXT: [[ADD1:%.*]] = add nsw i32 [[ADD]], [[COND]]
1543 ; TUNIT-NEXT: call void @llvm.lifetime.end.p0(i64 noundef 4, ptr noalias nocapture nofree noundef nonnull align 4 dereferenceable(4) [[Y]])
1544 ; TUNIT-NEXT: call void @llvm.lifetime.end.p0(i64 noundef 4, ptr nocapture nofree noundef nonnull align 4 dereferenceable(4) [[X]])
1545 ; TUNIT-NEXT: ret i32 [[ADD1]]
1547 ; CGSCC-LABEL: define {{[^@]+}}@local_alloca_not_simplifiable_1() {
1548 ; CGSCC-NEXT: entry:
1549 ; CGSCC-NEXT: [[X:%.*]] = alloca i32, align 4
1550 ; CGSCC-NEXT: [[Y:%.*]] = alloca i32, align 4
1551 ; CGSCC-NEXT: call void @llvm.lifetime.start.p0(i64 noundef 4, ptr nocapture nofree noundef nonnull align 4 dereferenceable(4) [[X]]) #[[ATTR20]]
1552 ; CGSCC-NEXT: call void @llvm.lifetime.start.p0(i64 noundef 4, ptr noalias nocapture nofree noundef nonnull align 4 dereferenceable(4) [[Y]]) #[[ATTR20]]
1553 ; CGSCC-NEXT: store i32 1, ptr [[Y]], align 4, !tbaa [[TBAA3]]
1554 ; CGSCC-NEXT: store i32 1, ptr [[X]], align 4, !tbaa [[TBAA3]]
1555 ; CGSCC-NEXT: call void @escape(ptr noundef nonnull align 4 dereferenceable(4) [[X]])
1556 ; CGSCC-NEXT: call void @write_random(ptr noalias nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) [[Y]])
1557 ; CGSCC-NEXT: [[I3:%.*]] = load i32, ptr [[X]], align 4, !tbaa [[TBAA3]]
1558 ; CGSCC-NEXT: [[TOBOOL_NOT:%.*]] = icmp eq i32 [[I3]], 0
1559 ; CGSCC-NEXT: [[COND:%.*]] = select i1 [[TOBOOL_NOT]], i32 2, i32 1
1560 ; CGSCC-NEXT: [[I4:%.*]] = load i32, ptr [[Y]], align 4, !tbaa [[TBAA3]]
1561 ; CGSCC-NEXT: [[ADD:%.*]] = add nsw i32 [[I3]], [[I4]]
1562 ; CGSCC-NEXT: [[ADD1:%.*]] = add nsw i32 [[ADD]], [[COND]]
1563 ; CGSCC-NEXT: call void @llvm.lifetime.end.p0(i64 noundef 4, ptr noalias nocapture nofree noundef nonnull align 4 dereferenceable(4) [[Y]])
1564 ; CGSCC-NEXT: call void @llvm.lifetime.end.p0(i64 noundef 4, ptr nocapture nofree noundef nonnull align 4 dereferenceable(4) [[X]])
1565 ; CGSCC-NEXT: ret i32 [[ADD1]]
1568 %X = alloca i32, align 4
1569 %Y = alloca i32, align 4
1570 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %X)
1571 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %Y)
1572 store i32 1, ptr %Y, align 4, !tbaa !3
1573 store i32 1, ptr %X, align 4, !tbaa !3
1574 call void @escape(ptr nonnull %X)
1575 call void @write_random(ptr nonnull %Y)
1576 %i3 = load i32, ptr %X, align 4, !tbaa !3
1577 %tobool.not = icmp eq i32 %i3, 0
1578 %cond = select i1 %tobool.not, i32 2, i32 1
1579 %i4 = load i32, ptr %Y, align 4, !tbaa !3
1580 %add = add nsw i32 %i3, %i4
1581 %add1 = add nsw i32 %add, %cond
1582 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %Y)
1583 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %X)
1587 define i8 @local_alloca_not_simplifiable_2(i64 %index1, i64 %index2, i1 %cnd) {
1588 ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn
1589 ; TUNIT-LABEL: define {{[^@]+}}@local_alloca_not_simplifiable_2
1590 ; TUNIT-SAME: (i64 [[INDEX1:%.*]], i64 [[INDEX2:%.*]], i1 noundef [[CND:%.*]]) #[[ATTR3]] {
1591 ; TUNIT-NEXT: entry:
1592 ; TUNIT-NEXT: [[BYTES:%.*]] = alloca [1024 x i8], align 16
1593 ; TUNIT-NEXT: store i8 7, ptr [[BYTES]], align 16
1594 ; TUNIT-NEXT: br i1 [[CND]], label [[LEFT:%.*]], label [[RIGHT:%.*]]
1596 ; TUNIT-NEXT: [[GEP1:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 [[INDEX1]]
1597 ; TUNIT-NEXT: br label [[JOIN:%.*]]
1599 ; TUNIT-NEXT: [[GEP2:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 [[INDEX2]]
1600 ; TUNIT-NEXT: br label [[JOIN]]
1602 ; TUNIT-NEXT: [[GEP_JOIN:%.*]] = phi ptr [ [[GEP1]], [[LEFT]] ], [ [[GEP2]], [[RIGHT]] ]
1603 ; TUNIT-NEXT: store i8 9, ptr [[GEP_JOIN]], align 4
1604 ; TUNIT-NEXT: [[I:%.*]] = load i8, ptr [[BYTES]], align 16
1605 ; TUNIT-NEXT: ret i8 [[I]]
1607 ; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn
1608 ; CGSCC-LABEL: define {{[^@]+}}@local_alloca_not_simplifiable_2
1609 ; CGSCC-SAME: (i64 [[INDEX1:%.*]], i64 [[INDEX2:%.*]], i1 noundef [[CND:%.*]]) #[[ATTR5]] {
1610 ; CGSCC-NEXT: entry:
1611 ; CGSCC-NEXT: [[BYTES:%.*]] = alloca [1024 x i8], align 16
1612 ; CGSCC-NEXT: store i8 7, ptr [[BYTES]], align 16
1613 ; CGSCC-NEXT: br i1 [[CND]], label [[LEFT:%.*]], label [[RIGHT:%.*]]
1615 ; CGSCC-NEXT: [[GEP1:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 [[INDEX1]]
1616 ; CGSCC-NEXT: br label [[JOIN:%.*]]
1618 ; CGSCC-NEXT: [[GEP2:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 [[INDEX2]]
1619 ; CGSCC-NEXT: br label [[JOIN]]
1621 ; CGSCC-NEXT: [[GEP_JOIN:%.*]] = phi ptr [ [[GEP1]], [[LEFT]] ], [ [[GEP2]], [[RIGHT]] ]
1622 ; CGSCC-NEXT: store i8 9, ptr [[GEP_JOIN]], align 4
1623 ; CGSCC-NEXT: [[I:%.*]] = load i8, ptr [[BYTES]], align 16
1624 ; CGSCC-NEXT: ret i8 [[I]]
1627 %Bytes = alloca [1024 x i8], align 16
1628 store i8 7, ptr %Bytes, align 4
1629 br i1 %cnd, label %left, label %right
1631 left: ; preds = %entry
1632 %gep1 = getelementptr inbounds [1024 x i8], ptr %Bytes, i64 0, i64 %index1
1635 right: ; preds = %entry
1636 %gep2 = getelementptr inbounds [1024 x i8], ptr %Bytes, i64 0, i64 %index2
1639 join: ; preds = %right, %left
1640 %gep.join = phi ptr [ %gep1, %left ], [ %gep2, %right ]
1641 store i8 9, ptr %gep.join, align 4
1643 ; This load cannot be replaced by the value 7 from %entry, since the previous
1644 ; store interferes due to its unknown offset.
1645 %i = load i8, ptr %Bytes, align 4
1649 ; We could simplify these if we separate accessed bins wrt. alignment (here mod 4).
1650 define i32 @unknown_access_mixed_simplifiable(i32 %arg1, i32 %arg2) {
1651 ; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
1652 ; CHECK-LABEL: define {{[^@]+}}@unknown_access_mixed_simplifiable
1653 ; CHECK-SAME: (i32 [[ARG1:%.*]], i32 [[ARG2:%.*]]) #[[ATTR4]] {
1654 ; CHECK-NEXT: entry:
1655 ; CHECK-NEXT: [[S:%.*]] = alloca [[STRUCT_S:%.*]], align 4
1656 ; CHECK-NEXT: [[GEP1:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 2
1657 ; CHECK-NEXT: [[GEP2:%.*]] = getelementptr inbounds i32, ptr [[S]], i32 [[ARG1]]
1658 ; CHECK-NEXT: [[GEP3:%.*]] = getelementptr inbounds i32, ptr [[S]], i32 [[ARG2]]
1659 ; CHECK-NEXT: store i32 7, ptr [[GEP1]], align 4
1660 ; CHECK-NEXT: store i32 7, ptr [[GEP2]], align 4
1661 ; CHECK-NEXT: store i32 7, ptr [[GEP3]], align 4
1662 ; CHECK-NEXT: [[L1:%.*]] = load i32, ptr [[GEP1]], align 4
1663 ; CHECK-NEXT: [[L2:%.*]] = load i32, ptr [[GEP2]], align 4
1664 ; CHECK-NEXT: [[L3:%.*]] = load i32, ptr [[GEP3]], align 4
1665 ; CHECK-NEXT: [[ADD1:%.*]] = add i32 [[L1]], [[L2]]
1666 ; CHECK-NEXT: [[ADD2:%.*]] = add i32 [[ADD1]], [[L3]]
1667 ; CHECK-NEXT: ret i32 [[ADD2]]
1670 %s = alloca %struct.S, align 4
1671 %gep1 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 2
1672 %gep2 = getelementptr inbounds i32, ptr %s, i32 %arg1
1673 %gep3 = getelementptr inbounds i32, ptr %s, i32 %arg2
1674 store i32 7, ptr %gep1
1675 store i32 7, ptr %gep2
1676 store i32 7, ptr %gep3
1677 %l1 = load i32, ptr %gep1
1678 %l2 = load i32, ptr %gep2
1679 %l3 = load i32, ptr %gep3
1680 %add1 = add i32 %l1, %l2
1681 %add2 = add i32 %add1, %l3
1685 ; The access to bc4b could go anywhere, nothing is simplifiable.
1686 define i32 @unknown_access_mixed_not_simplifiable(i32 %arg1, i32 %arg2, i32 %arg3) {
1687 ; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
1688 ; CHECK-LABEL: define {{[^@]+}}@unknown_access_mixed_not_simplifiable
1689 ; CHECK-SAME: (i32 [[ARG1:%.*]], i32 [[ARG2:%.*]], i32 [[ARG3:%.*]]) #[[ATTR4]] {
1690 ; CHECK-NEXT: entry:
1691 ; CHECK-NEXT: [[S:%.*]] = alloca [[STRUCT_S:%.*]], align 4
1692 ; CHECK-NEXT: [[GEP1:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 2
1693 ; CHECK-NEXT: [[GEP2:%.*]] = getelementptr inbounds i32, ptr [[S]], i32 [[ARG1]]
1694 ; CHECK-NEXT: [[GEP3:%.*]] = getelementptr inbounds i32, ptr [[S]], i32 [[ARG2]]
1695 ; CHECK-NEXT: [[GEP4:%.*]] = getelementptr inbounds i8, ptr [[S]], i32 [[ARG3]]
1696 ; CHECK-NEXT: store i32 7, ptr [[GEP1]], align 4
1697 ; CHECK-NEXT: store i32 7, ptr [[GEP2]], align 4
1698 ; CHECK-NEXT: store i32 7, ptr [[GEP3]], align 4
1699 ; CHECK-NEXT: store i32 7, ptr [[GEP4]], align 4
1700 ; CHECK-NEXT: [[L1:%.*]] = load i32, ptr [[GEP1]], align 4
1701 ; CHECK-NEXT: [[L2:%.*]] = load i32, ptr [[GEP2]], align 4
1702 ; CHECK-NEXT: [[L3:%.*]] = load i32, ptr [[GEP3]], align 4
1703 ; CHECK-NEXT: [[L4:%.*]] = load i32, ptr [[GEP4]], align 4
1704 ; CHECK-NEXT: [[ADD1:%.*]] = add i32 [[L1]], [[L2]]
1705 ; CHECK-NEXT: [[ADD2:%.*]] = add i32 [[ADD1]], [[L3]]
1706 ; CHECK-NEXT: [[ADD3:%.*]] = add i32 [[ADD2]], [[L4]]
1707 ; CHECK-NEXT: ret i32 [[ADD3]]
1710 %s = alloca %struct.S, align 4
1711 %gep1 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 2
1712 %gep2 = getelementptr inbounds i32, ptr %s, i32 %arg1
1713 %gep3 = getelementptr inbounds i32, ptr %s, i32 %arg2
1714 %gep4 = getelementptr inbounds i8, ptr %s, i32 %arg3
1715 store i32 7, ptr %gep1
1716 store i32 7, ptr %gep2
1717 store i32 7, ptr %gep3
1718 store i32 7, ptr %gep4
1719 %l1 = load i32, ptr %gep1
1720 %l2 = load i32, ptr %gep2
1721 %l3 = load i32, ptr %gep3
1722 %l4 = load i32, ptr %gep4
1723 %add1 = add i32 %l1, %l2
1724 %add2 = add i32 %add1, %l3
1725 %add3 = add i32 %add2, %l4
1729 declare void @escape(ptr)
1732 ; int global_not_simplifiable_1(int cnd) {
1736 define i32 @global_not_simplifiable_1(i32 %cnd) {
1737 ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read)
1738 ; TUNIT-LABEL: define {{[^@]+}}@global_not_simplifiable_1
1739 ; TUNIT-SAME: (i32 [[CND:%.*]]) #[[ATTR6:[0-9]+]] {
1740 ; TUNIT-NEXT: entry:
1741 ; TUNIT-NEXT: [[I:%.*]] = load i32, ptr @Flag0, align 4, !tbaa [[TBAA3]]
1742 ; TUNIT-NEXT: ret i32 [[I]]
1744 ; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read)
1745 ; CGSCC-LABEL: define {{[^@]+}}@global_not_simplifiable_1
1746 ; CGSCC-SAME: (i32 [[CND:%.*]]) #[[ATTR7:[0-9]+]] {
1747 ; CGSCC-NEXT: entry:
1748 ; CGSCC-NEXT: [[I:%.*]] = load i32, ptr @Flag0, align 4, !tbaa [[TBAA3]]
1749 ; CGSCC-NEXT: ret i32 [[I]]
1752 %i = load i32, ptr @Flag0, align 4, !tbaa !3
1756 ; static int Flag1 __attribute__((loader_uninitialized));
1757 ; int static_global_not_simplifiable_1(int cnd) {
1765 define i32 @static_global_not_simplifiable_1(i32 %cnd) {
1766 ; CHECK-LABEL: define {{[^@]+}}@static_global_not_simplifiable_1
1767 ; CHECK-SAME: (i32 [[CND:%.*]]) {
1768 ; CHECK-NEXT: entry:
1769 ; CHECK-NEXT: call void @sync()
1770 ; CHECK-NEXT: [[TOBOOL_NOT:%.*]] = icmp eq i32 [[CND]], 0
1771 ; CHECK-NEXT: br i1 [[TOBOOL_NOT]], label [[IF_END:%.*]], label [[IF_THEN:%.*]]
1773 ; CHECK-NEXT: br label [[IF_END]]
1775 ; CHECK-NEXT: ret i32 1
1778 %i = load i32, ptr @Flag1, align 4, !tbaa !3
1780 %tobool.not = icmp eq i32 %cnd, 0
1781 br i1 %tobool.not, label %if.end, label %if.then
1783 if.then: ; preds = %entry
1784 store i32 1, ptr @Flag1, align 4, !tbaa !3
1787 if.end: ; preds = %if.then, %entry
1791 declare void @sync()
1793 ; static int Flag2 __attribute__((loader_uninitialized));
1794 ; int static_global_simplifiable_4(int cnd) {
1801 define i32 @static_global_simplifiable_4(i32 %cnd) {
1802 ; CHECK-LABEL: define {{[^@]+}}@static_global_simplifiable_4
1803 ; CHECK-SAME: (i32 [[CND:%.*]]) {
1804 ; CHECK-NEXT: entry:
1805 ; CHECK-NEXT: store i32 1, ptr @Flag2, align 4, !tbaa [[TBAA3]]
1806 ; CHECK-NEXT: call void @sync()
1807 ; CHECK-NEXT: [[I:%.*]] = load i32, ptr @Flag2, align 4, !tbaa [[TBAA3]]
1808 ; CHECK-NEXT: store i32 2, ptr @Flag2, align 4, !tbaa [[TBAA3]]
1809 ; CHECK-NEXT: ret i32 [[I]]
1812 store i32 1, ptr @Flag2, align 4, !tbaa !3
1814 %i = load i32, ptr @Flag2, align 4, !tbaa !3
1815 store i32 2, ptr @Flag2, align 4, !tbaa !3
1819 ; static int Flag2 __attribute__((loader_uninitialized));
1820 ; int static_global_not_simplifiable_2(int cnd) {
1827 define i32 @static_global_not_simplifiable_2(i32 %cnd) {
1828 ; TUNIT-LABEL: define {{[^@]+}}@static_global_not_simplifiable_2
1829 ; TUNIT-SAME: (i32 [[CND:%.*]]) {
1830 ; TUNIT-NEXT: entry:
1831 ; TUNIT-NEXT: store i32 1, ptr @Flag4, align 4, !tbaa [[TBAA3]]
1832 ; TUNIT-NEXT: call void @sync() #[[ATTR19:[0-9]+]]
1833 ; TUNIT-NEXT: [[I:%.*]] = load i32, ptr @Flag4, align 4, !tbaa [[TBAA3]]
1834 ; TUNIT-NEXT: store i32 2, ptr @Flag4, align 4, !tbaa [[TBAA3]]
1835 ; TUNIT-NEXT: ret i32 [[I]]
1837 ; CGSCC-LABEL: define {{[^@]+}}@static_global_not_simplifiable_2
1838 ; CGSCC-SAME: (i32 [[CND:%.*]]) {
1839 ; CGSCC-NEXT: entry:
1840 ; CGSCC-NEXT: store i32 1, ptr @Flag4, align 4, !tbaa [[TBAA3]]
1841 ; CGSCC-NEXT: call void @sync() #[[ATTR22:[0-9]+]]
1842 ; CGSCC-NEXT: [[I:%.*]] = load i32, ptr @Flag4, align 4, !tbaa [[TBAA3]]
1843 ; CGSCC-NEXT: store i32 2, ptr @Flag4, align 4, !tbaa [[TBAA3]]
1844 ; CGSCC-NEXT: ret i32 [[I]]
1847 store i32 1, ptr @Flag4, align 4, !tbaa !3
1848 call void @sync() nocallback
1849 %i = load i32, ptr @Flag4, align 4, !tbaa !3
1850 store i32 2, ptr @Flag4, align 4, !tbaa !3
1853 define void @static_global_not_simplifiable_2_helper() {
1854 ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)
1855 ; TUNIT-LABEL: define {{[^@]+}}@static_global_not_simplifiable_2_helper
1856 ; TUNIT-SAME: () #[[ATTR5]] {
1857 ; TUNIT-NEXT: store i32 2, ptr @Flag4, align 4, !tbaa [[TBAA3]]
1858 ; TUNIT-NEXT: ret void
1860 ; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)
1861 ; CGSCC-LABEL: define {{[^@]+}}@static_global_not_simplifiable_2_helper
1862 ; CGSCC-SAME: () #[[ATTR6]] {
1863 ; CGSCC-NEXT: store i32 2, ptr @Flag4, align 4, !tbaa [[TBAA3]]
1864 ; CGSCC-NEXT: ret void
1866 store i32 2, ptr @Flag4, align 4, !tbaa !3
1870 ; Similiar to static_global_simplifiable_3 but with a may-store.
1871 define i32 @static_global_not_simplifiable_3(i1 %c, ptr %p) {
1872 ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn
1873 ; TUNIT-LABEL: define {{[^@]+}}@static_global_not_simplifiable_3
1874 ; TUNIT-SAME: (i1 [[C:%.*]], ptr nocapture nofree writeonly [[P:%.*]]) #[[ATTR3]] {
1875 ; TUNIT-NEXT: [[SEL:%.*]] = select i1 [[C]], ptr @Flag3, ptr [[P]]
1876 ; TUNIT-NEXT: store i32 1, ptr [[SEL]], align 4, !tbaa [[TBAA3]]
1877 ; TUNIT-NEXT: [[I:%.*]] = load i32, ptr @Flag3, align 4, !tbaa [[TBAA3]]
1878 ; TUNIT-NEXT: ret i32 [[I]]
1880 ; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn
1881 ; CGSCC-LABEL: define {{[^@]+}}@static_global_not_simplifiable_3
1882 ; CGSCC-SAME: (i1 [[C:%.*]], ptr nocapture nofree writeonly [[P:%.*]]) #[[ATTR5]] {
1883 ; CGSCC-NEXT: [[SEL:%.*]] = select i1 [[C]], ptr @Flag3, ptr [[P]]
1884 ; CGSCC-NEXT: store i32 1, ptr [[SEL]], align 4, !tbaa [[TBAA3]]
1885 ; CGSCC-NEXT: [[I:%.*]] = load i32, ptr @Flag3, align 4, !tbaa [[TBAA3]]
1886 ; CGSCC-NEXT: ret i32 [[I]]
1888 %sel = select i1 %c, ptr @Flag3, ptr %p
1889 store i32 1, ptr %sel, align 4, !tbaa !3
1890 %i = load i32, ptr @Flag3, align 4, !tbaa !3
1895 ; int write_read{,_static,_static_undef}_global(void) {
1896 ; Gint{,static,_static_undef}1 = 7;
1899 ; void write{,_static,_static_undef}_global(void) {
1900 ; Gint{,static,_static_undef}2 = 7;
1902 ; int read{,_static,_static_undef}_global(void) {
1903 ; return Gint{,static,_static_undef}2;
1906 ; FIXME: We could replace these loads.
1907 define i32 @write_read_global() {
1908 ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn
1909 ; TUNIT-LABEL: define {{[^@]+}}@write_read_global
1910 ; TUNIT-SAME: () #[[ATTR3]] {
1911 ; TUNIT-NEXT: store i32 7, ptr @Gint1, align 4
1912 ; TUNIT-NEXT: [[L:%.*]] = load i32, ptr @Gint1, align 4
1913 ; TUNIT-NEXT: ret i32 [[L]]
1915 ; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn
1916 ; CGSCC-LABEL: define {{[^@]+}}@write_read_global
1917 ; CGSCC-SAME: () #[[ATTR5]] {
1918 ; CGSCC-NEXT: store i32 7, ptr @Gint1, align 4
1919 ; CGSCC-NEXT: [[L:%.*]] = load i32, ptr @Gint1, align 4
1920 ; CGSCC-NEXT: ret i32 [[L]]
1922 store i32 7, ptr @Gint1
1923 %l = load i32, ptr @Gint1
1926 define void @write_global() {
1927 ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)
1928 ; TUNIT-LABEL: define {{[^@]+}}@write_global
1929 ; TUNIT-SAME: () #[[ATTR5]] {
1930 ; TUNIT-NEXT: store i32 7, ptr @Gint2, align 4
1931 ; TUNIT-NEXT: ret void
1933 ; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)
1934 ; CGSCC-LABEL: define {{[^@]+}}@write_global
1935 ; CGSCC-SAME: () #[[ATTR6]] {
1936 ; CGSCC-NEXT: store i32 7, ptr @Gint2, align 4
1937 ; CGSCC-NEXT: ret void
1939 store i32 7, ptr @Gint2
1942 define i32 @read_global() {
1943 ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read)
1944 ; TUNIT-LABEL: define {{[^@]+}}@read_global
1945 ; TUNIT-SAME: () #[[ATTR6]] {
1946 ; TUNIT-NEXT: [[L:%.*]] = load i32, ptr @Gint2, align 4
1947 ; TUNIT-NEXT: ret i32 [[L]]
1949 ; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read)
1950 ; CGSCC-LABEL: define {{[^@]+}}@read_global
1951 ; CGSCC-SAME: () #[[ATTR7]] {
1952 ; CGSCC-NEXT: [[L:%.*]] = load i32, ptr @Gint2, align 4
1953 ; CGSCC-NEXT: ret i32 [[L]]
1955 %l = load i32, ptr @Gint2
1958 define i32 @write_read_static_global() {
1959 ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)
1960 ; TUNIT-LABEL: define {{[^@]+}}@write_read_static_global
1961 ; TUNIT-SAME: () #[[ATTR5]] {
1962 ; TUNIT-NEXT: ret i32 7
1964 ; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)
1965 ; CGSCC-LABEL: define {{[^@]+}}@write_read_static_global
1966 ; CGSCC-SAME: () #[[ATTR6]] {
1967 ; CGSCC-NEXT: ret i32 7
1969 store i32 7, ptr @Gstatic_int1
1970 %l = load i32, ptr @Gstatic_int1
1973 define void @write_static_global() {
1974 ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)
1975 ; TUNIT-LABEL: define {{[^@]+}}@write_static_global
1976 ; TUNIT-SAME: () #[[ATTR5]] {
1977 ; TUNIT-NEXT: store i32 7, ptr @Gstatic_int2, align 4
1978 ; TUNIT-NEXT: ret void
1980 ; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)
1981 ; CGSCC-LABEL: define {{[^@]+}}@write_static_global
1982 ; CGSCC-SAME: () #[[ATTR6]] {
1983 ; CGSCC-NEXT: store i32 7, ptr @Gstatic_int2, align 4
1984 ; CGSCC-NEXT: ret void
1986 store i32 7, ptr @Gstatic_int2
1989 define i32 @read_static_global() {
1990 ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read)
1991 ; TUNIT-LABEL: define {{[^@]+}}@read_static_global
1992 ; TUNIT-SAME: () #[[ATTR6]] {
1993 ; TUNIT-NEXT: [[L:%.*]] = load i32, ptr @Gstatic_int2, align 4
1994 ; TUNIT-NEXT: ret i32 [[L]]
1996 ; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read)
1997 ; CGSCC-LABEL: define {{[^@]+}}@read_static_global
1998 ; CGSCC-SAME: () #[[ATTR7]] {
1999 ; CGSCC-NEXT: [[L:%.*]] = load i32, ptr @Gstatic_int2, align 4
2000 ; CGSCC-NEXT: ret i32 [[L]]
2002 %l = load i32, ptr @Gstatic_int2
2005 define i32 @write_read_static_undef_global() {
2006 ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)
2007 ; TUNIT-LABEL: define {{[^@]+}}@write_read_static_undef_global
2008 ; TUNIT-SAME: () #[[ATTR5]] {
2009 ; TUNIT-NEXT: ret i32 7
2011 ; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)
2012 ; CGSCC-LABEL: define {{[^@]+}}@write_read_static_undef_global
2013 ; CGSCC-SAME: () #[[ATTR6]] {
2014 ; CGSCC-NEXT: ret i32 7
2016 store i32 7, ptr @Gstatic_undef_int1
2017 %l = load i32, ptr @Gstatic_undef_int1
2020 define void @write_static_undef_global() {
2021 ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)
2022 ; TUNIT-LABEL: define {{[^@]+}}@write_static_undef_global
2023 ; TUNIT-SAME: () #[[ATTR5]] {
2024 ; TUNIT-NEXT: ret void
2026 ; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)
2027 ; CGSCC-LABEL: define {{[^@]+}}@write_static_undef_global
2028 ; CGSCC-SAME: () #[[ATTR6]] {
2029 ; CGSCC-NEXT: store i32 7, ptr @Gstatic_undef_int2, align 4
2030 ; CGSCC-NEXT: ret void
2032 store i32 7, ptr @Gstatic_undef_int2
2035 define i32 @read_static_undef_global() {
2036 ; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
2037 ; CHECK-LABEL: define {{[^@]+}}@read_static_undef_global
2038 ; CHECK-SAME: () #[[ATTR4]] {
2039 ; CHECK-NEXT: ret i32 7
2041 %l = load i32, ptr @Gstatic_undef_int2
2045 define i32 @single_read_of_static_global() {
2046 ; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
2047 ; CHECK-LABEL: define {{[^@]+}}@single_read_of_static_global
2048 ; CHECK-SAME: () #[[ATTR4]] {
2049 ; CHECK-NEXT: ret i32 0
2051 %l = load i32, ptr @Gstatic_int3
2055 define i8 @phi_store() {
2056 ; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
2057 ; CHECK-LABEL: define {{[^@]+}}@phi_store
2058 ; CHECK-SAME: () #[[ATTR4]] {
2059 ; CHECK-NEXT: entry:
2060 ; CHECK-NEXT: [[A:%.*]] = alloca i16, align 2
2061 ; CHECK-NEXT: br label [[LOOP:%.*]]
2063 ; CHECK-NEXT: [[P:%.*]] = phi ptr [ [[A]], [[ENTRY:%.*]] ], [ [[G:%.*]], [[LOOP]] ]
2064 ; CHECK-NEXT: [[I:%.*]] = phi i8 [ 0, [[ENTRY]] ], [ [[O:%.*]], [[LOOP]] ]
2065 ; CHECK-NEXT: store i8 1, ptr [[P]], align 1
2066 ; CHECK-NEXT: [[G]] = getelementptr i8, ptr [[P]], i64 1
2067 ; CHECK-NEXT: [[O]] = add nsw i8 [[I]], 1
2068 ; CHECK-NEXT: [[C:%.*]] = icmp eq i8 [[O]], 2
2069 ; CHECK-NEXT: br i1 [[C]], label [[END:%.*]], label [[LOOP]]
2071 ; CHECK-NEXT: [[S:%.*]] = getelementptr i8, ptr [[A]], i64 1
2072 ; CHECK-NEXT: [[L:%.*]] = load i8, ptr [[S]], align 1
2073 ; CHECK-NEXT: ret i8 [[L]]
2079 %p = phi ptr [%a, %entry], [%g, %loop]
2080 %i = phi i8 [0, %entry], [%o, %loop]
2082 %g = getelementptr i8, ptr %p, i64 1
2083 %o = add nsw i8 %i, 1
2084 %c = icmp eq i8 %o, 2
2085 br i1 %c, label %end, label %loop
2087 %s = getelementptr i8, ptr %a, i64 1
2088 %l = load i8, ptr %s
2092 ; FIXME: This function returns 1.
2093 define i8 @phi_no_store_1() {
2095 ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn
2096 ; TUNIT-LABEL: define {{[^@]+}}@phi_no_store_1
2097 ; TUNIT-SAME: () #[[ATTR3]] {
2098 ; TUNIT-NEXT: entry:
2099 ; TUNIT-NEXT: br label [[LOOP:%.*]]
2101 ; TUNIT-NEXT: [[P:%.*]] = phi ptr [ @a1, [[ENTRY:%.*]] ], [ [[G:%.*]], [[LOOP]] ]
2102 ; TUNIT-NEXT: [[I:%.*]] = phi i8 [ 0, [[ENTRY]] ], [ [[O:%.*]], [[LOOP]] ]
2103 ; TUNIT-NEXT: store i8 1, ptr [[P]], align 1
2104 ; TUNIT-NEXT: [[G]] = getelementptr i8, ptr [[P]], i64 1
2105 ; TUNIT-NEXT: [[O]] = add nsw i8 [[I]], 1
2106 ; TUNIT-NEXT: [[C:%.*]] = icmp eq i8 [[O]], 3
2107 ; TUNIT-NEXT: br i1 [[C]], label [[END:%.*]], label [[LOOP]]
2109 ; TUNIT-NEXT: [[S11:%.*]] = getelementptr i8, ptr @a1, i64 2
2110 ; TUNIT-NEXT: [[L11:%.*]] = load i8, ptr [[S11]], align 2
2111 ; TUNIT-NEXT: [[S12:%.*]] = getelementptr i8, ptr @a1, i64 3
2112 ; TUNIT-NEXT: [[L12:%.*]] = load i8, ptr [[S12]], align 1
2113 ; TUNIT-NEXT: [[ADD:%.*]] = add i8 [[L11]], [[L12]]
2114 ; TUNIT-NEXT: ret i8 [[ADD]]
2116 ; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn
2117 ; CGSCC-LABEL: define {{[^@]+}}@phi_no_store_1
2118 ; CGSCC-SAME: () #[[ATTR5]] {
2119 ; CGSCC-NEXT: entry:
2120 ; CGSCC-NEXT: br label [[LOOP:%.*]]
2122 ; CGSCC-NEXT: [[P:%.*]] = phi ptr [ @a1, [[ENTRY:%.*]] ], [ [[G:%.*]], [[LOOP]] ]
2123 ; CGSCC-NEXT: [[I:%.*]] = phi i8 [ 0, [[ENTRY]] ], [ [[O:%.*]], [[LOOP]] ]
2124 ; CGSCC-NEXT: store i8 1, ptr [[P]], align 1
2125 ; CGSCC-NEXT: [[G]] = getelementptr i8, ptr [[P]], i64 1
2126 ; CGSCC-NEXT: [[O]] = add nsw i8 [[I]], 1
2127 ; CGSCC-NEXT: [[C:%.*]] = icmp eq i8 [[O]], 3
2128 ; CGSCC-NEXT: br i1 [[C]], label [[END:%.*]], label [[LOOP]]
2130 ; CGSCC-NEXT: [[S11:%.*]] = getelementptr i8, ptr @a1, i64 2
2131 ; CGSCC-NEXT: [[L11:%.*]] = load i8, ptr [[S11]], align 2
2132 ; CGSCC-NEXT: [[S12:%.*]] = getelementptr i8, ptr @a1, i64 3
2133 ; CGSCC-NEXT: [[L12:%.*]] = load i8, ptr [[S12]], align 1
2134 ; CGSCC-NEXT: [[ADD:%.*]] = add i8 [[L11]], [[L12]]
2135 ; CGSCC-NEXT: ret i8 [[ADD]]
2140 %p = phi ptr [@a1, %entry], [%g, %loop]
2141 %i = phi i8 [0, %entry], [%o, %loop]
2143 %g = getelementptr i8, ptr %p, i64 1
2144 %o = add nsw i8 %i, 1
2145 %c = icmp eq i8 %o, 3
2146 br i1 %c, label %end, label %loop
2148 %s11 = getelementptr i8, ptr @a1, i64 2
2149 %l11 = load i8, ptr %s11
2150 %s12 = getelementptr i8, ptr @a1, i64 3
2151 %l12 = load i8, ptr %s12
2152 %add = add i8 %l11, %l12
2156 ; FIXME: This function returns 1.
2157 define i8 @phi_no_store_2() {
2159 ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn
2160 ; TUNIT-LABEL: define {{[^@]+}}@phi_no_store_2
2161 ; TUNIT-SAME: () #[[ATTR3]] {
2162 ; TUNIT-NEXT: entry:
2163 ; TUNIT-NEXT: br label [[LOOP:%.*]]
2165 ; TUNIT-NEXT: [[P:%.*]] = phi ptr [ @a2, [[ENTRY:%.*]] ], [ [[G:%.*]], [[LOOP]] ]
2166 ; TUNIT-NEXT: [[I:%.*]] = phi i8 [ 0, [[ENTRY]] ], [ [[O:%.*]], [[LOOP]] ]
2167 ; TUNIT-NEXT: store i8 1, ptr [[P]], align 1
2168 ; TUNIT-NEXT: [[G]] = getelementptr i8, ptr @a2, i64 2
2169 ; TUNIT-NEXT: [[O]] = add nsw i8 [[I]], 1
2170 ; TUNIT-NEXT: [[C:%.*]] = icmp eq i8 [[O]], 7
2171 ; TUNIT-NEXT: br i1 [[C]], label [[END:%.*]], label [[LOOP]]
2173 ; TUNIT-NEXT: [[S21:%.*]] = getelementptr i8, ptr @a2, i64 2
2174 ; TUNIT-NEXT: [[L21:%.*]] = load i8, ptr [[S21]], align 2
2175 ; TUNIT-NEXT: [[S22:%.*]] = getelementptr i8, ptr @a2, i64 3
2176 ; TUNIT-NEXT: [[L22:%.*]] = load i8, ptr [[S22]], align 1
2177 ; TUNIT-NEXT: [[ADD:%.*]] = add i8 [[L21]], [[L22]]
2178 ; TUNIT-NEXT: ret i8 [[ADD]]
2180 ; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn
2181 ; CGSCC-LABEL: define {{[^@]+}}@phi_no_store_2
2182 ; CGSCC-SAME: () #[[ATTR5]] {
2183 ; CGSCC-NEXT: entry:
2184 ; CGSCC-NEXT: br label [[LOOP:%.*]]
2186 ; CGSCC-NEXT: [[P:%.*]] = phi ptr [ @a2, [[ENTRY:%.*]] ], [ [[G:%.*]], [[LOOP]] ]
2187 ; CGSCC-NEXT: [[I:%.*]] = phi i8 [ 0, [[ENTRY]] ], [ [[O:%.*]], [[LOOP]] ]
2188 ; CGSCC-NEXT: store i8 1, ptr [[P]], align 1
2189 ; CGSCC-NEXT: [[G]] = getelementptr i8, ptr @a2, i64 2
2190 ; CGSCC-NEXT: [[O]] = add nsw i8 [[I]], 1
2191 ; CGSCC-NEXT: [[C:%.*]] = icmp eq i8 [[O]], 7
2192 ; CGSCC-NEXT: br i1 [[C]], label [[END:%.*]], label [[LOOP]]
2194 ; CGSCC-NEXT: [[S21:%.*]] = getelementptr i8, ptr @a2, i64 2
2195 ; CGSCC-NEXT: [[L21:%.*]] = load i8, ptr [[S21]], align 2
2196 ; CGSCC-NEXT: [[S22:%.*]] = getelementptr i8, ptr @a2, i64 3
2197 ; CGSCC-NEXT: [[L22:%.*]] = load i8, ptr [[S22]], align 1
2198 ; CGSCC-NEXT: [[ADD:%.*]] = add i8 [[L21]], [[L22]]
2199 ; CGSCC-NEXT: ret i8 [[ADD]]
2204 %p = phi ptr [@a2, %entry], [%g, %loop]
2205 %i = phi i8 [0, %entry], [%o, %loop]
2207 %g = getelementptr i8, ptr @a2, i64 2
2208 %o = add nsw i8 %i, 1
2209 %c = icmp eq i8 %o, 7
2210 br i1 %c, label %end, label %loop
2212 %s21 = getelementptr i8, ptr @a2, i64 2
2213 %l21 = load i8, ptr %s21
2214 %s22 = getelementptr i8, ptr @a2, i64 3
2215 %l22 = load i8, ptr %s22
2216 %add = add i8 %l21, %l22
2220 define i8 @phi_no_store_3() {
2221 ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn
2222 ; TUNIT-LABEL: define {{[^@]+}}@phi_no_store_3
2223 ; TUNIT-SAME: () #[[ATTR3]] {
2224 ; TUNIT-NEXT: entry:
2225 ; TUNIT-NEXT: [[S30:%.*]] = getelementptr i8, ptr @a3, i64 3
2226 ; TUNIT-NEXT: store i8 0, ptr [[S30]], align 1
2227 ; TUNIT-NEXT: br label [[LOOP:%.*]]
2229 ; TUNIT-NEXT: [[P:%.*]] = phi ptr [ @a3, [[ENTRY:%.*]] ], [ [[G:%.*]], [[LOOP]] ]
2230 ; TUNIT-NEXT: [[I:%.*]] = phi i8 [ 0, [[ENTRY]] ], [ [[O:%.*]], [[LOOP]] ]
2231 ; TUNIT-NEXT: store i8 1, ptr [[P]], align 1
2232 ; TUNIT-NEXT: [[G]] = getelementptr i8, ptr @a3, i64 2
2233 ; TUNIT-NEXT: [[O]] = add nsw i8 [[I]], 1
2234 ; TUNIT-NEXT: [[C:%.*]] = icmp eq i8 [[O]], 7
2235 ; TUNIT-NEXT: br i1 [[C]], label [[END:%.*]], label [[LOOP]]
2237 ; TUNIT-NEXT: [[S31:%.*]] = getelementptr i8, ptr @a3, i64 2
2238 ; TUNIT-NEXT: [[L31:%.*]] = load i8, ptr [[S31]], align 2
2239 ; TUNIT-NEXT: [[S32:%.*]] = getelementptr i8, ptr @a3, i64 3
2240 ; TUNIT-NEXT: [[L32:%.*]] = load i8, ptr [[S32]], align 1
2241 ; TUNIT-NEXT: [[ADD:%.*]] = add i8 [[L31]], [[L32]]
2242 ; TUNIT-NEXT: [[S34:%.*]] = getelementptr i8, ptr @a3, i64 4
2243 ; TUNIT-NEXT: [[L34:%.*]] = load i8, ptr [[S34]], align 4
2244 ; TUNIT-NEXT: [[ADD2:%.*]] = add i8 [[ADD]], [[L34]]
2245 ; TUNIT-NEXT: ret i8 [[ADD2]]
2247 ; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn
2248 ; CGSCC-LABEL: define {{[^@]+}}@phi_no_store_3
2249 ; CGSCC-SAME: () #[[ATTR5]] {
2250 ; CGSCC-NEXT: entry:
2251 ; CGSCC-NEXT: [[S30:%.*]] = getelementptr i8, ptr @a3, i64 3
2252 ; CGSCC-NEXT: store i8 0, ptr [[S30]], align 1
2253 ; CGSCC-NEXT: br label [[LOOP:%.*]]
2255 ; CGSCC-NEXT: [[P:%.*]] = phi ptr [ @a3, [[ENTRY:%.*]] ], [ [[G:%.*]], [[LOOP]] ]
2256 ; CGSCC-NEXT: [[I:%.*]] = phi i8 [ 0, [[ENTRY]] ], [ [[O:%.*]], [[LOOP]] ]
2257 ; CGSCC-NEXT: store i8 1, ptr [[P]], align 1
2258 ; CGSCC-NEXT: [[G]] = getelementptr i8, ptr @a3, i64 2
2259 ; CGSCC-NEXT: [[O]] = add nsw i8 [[I]], 1
2260 ; CGSCC-NEXT: [[C:%.*]] = icmp eq i8 [[O]], 7
2261 ; CGSCC-NEXT: br i1 [[C]], label [[END:%.*]], label [[LOOP]]
2263 ; CGSCC-NEXT: [[S31:%.*]] = getelementptr i8, ptr @a3, i64 2
2264 ; CGSCC-NEXT: [[L31:%.*]] = load i8, ptr [[S31]], align 2
2265 ; CGSCC-NEXT: [[S32:%.*]] = getelementptr i8, ptr @a3, i64 3
2266 ; CGSCC-NEXT: [[L32:%.*]] = load i8, ptr [[S32]], align 1
2267 ; CGSCC-NEXT: [[ADD:%.*]] = add i8 [[L31]], [[L32]]
2268 ; CGSCC-NEXT: [[S34:%.*]] = getelementptr i8, ptr @a3, i64 4
2269 ; CGSCC-NEXT: [[L34:%.*]] = load i8, ptr [[S34]], align 4
2270 ; CGSCC-NEXT: [[ADD2:%.*]] = add i8 [[ADD]], [[L34]]
2271 ; CGSCC-NEXT: ret i8 [[ADD2]]
2274 %s30 = getelementptr i8, ptr @a3, i64 3
2275 store i8 0, ptr %s30
2278 %p = phi ptr [@a3, %entry], [%g, %loop]
2279 %i = phi i8 [0, %entry], [%o, %loop]
2281 %g = getelementptr i8, ptr @a3, i64 2
2282 %o = add nsw i8 %i, 1
2283 %c = icmp eq i8 %o, 7
2284 br i1 %c, label %end, label %loop
2286 %s31 = getelementptr i8, ptr @a3, i64 2
2287 %l31 = load i8, ptr %s31
2288 %s32 = getelementptr i8, ptr @a3, i64 3
2289 %l32 = load i8, ptr %s32
2290 %add = add i8 %l31, %l32
2291 %s34 = getelementptr i8, ptr @a3, i64 4
2292 %l34 = load i8, ptr %s34
2293 %add2 = add i8 %add, %l34
2297 define i8 @cast_and_load_1() {
2298 ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn
2299 ; TUNIT-LABEL: define {{[^@]+}}@cast_and_load_1
2300 ; TUNIT-SAME: () #[[ATTR3]] {
2301 ; TUNIT-NEXT: store i32 42, ptr @bytes1, align 4
2302 ; TUNIT-NEXT: [[L:%.*]] = load i8, ptr @bytes1, align 4
2303 ; TUNIT-NEXT: ret i8 [[L]]
2305 ; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn
2306 ; CGSCC-LABEL: define {{[^@]+}}@cast_and_load_1
2307 ; CGSCC-SAME: () #[[ATTR5]] {
2308 ; CGSCC-NEXT: store i32 42, ptr @bytes1, align 4
2309 ; CGSCC-NEXT: [[L:%.*]] = load i8, ptr @bytes1, align 4
2310 ; CGSCC-NEXT: ret i8 [[L]]
2312 store i32 42, ptr @bytes1
2313 %l = load i8, ptr @bytes1
2317 define i64 @cast_and_load_2() {
2318 ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn
2319 ; TUNIT-LABEL: define {{[^@]+}}@cast_and_load_2
2320 ; TUNIT-SAME: () #[[ATTR3]] {
2321 ; TUNIT-NEXT: store i32 42, ptr @bytes2, align 4
2322 ; TUNIT-NEXT: [[L:%.*]] = load i64, ptr @bytes2, align 4
2323 ; TUNIT-NEXT: ret i64 [[L]]
2325 ; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn
2326 ; CGSCC-LABEL: define {{[^@]+}}@cast_and_load_2
2327 ; CGSCC-SAME: () #[[ATTR5]] {
2328 ; CGSCC-NEXT: store i32 42, ptr @bytes2, align 4
2329 ; CGSCC-NEXT: [[L:%.*]] = load i64, ptr @bytes2, align 4
2330 ; CGSCC-NEXT: ret i64 [[L]]
2332 store i32 42, ptr @bytes2
2333 %l = load i64, ptr @bytes2
2337 define void @recursive_load_store(i64 %N, i32 %v) {
2339 ; TUNIT: Function Attrs: nofree norecurse nosync nounwind memory(write)
2340 ; TUNIT-LABEL: define {{[^@]+}}@recursive_load_store
2341 ; TUNIT-SAME: (i64 [[N:%.*]], i32 [[V:%.*]]) #[[ATTR7:[0-9]+]] {
2342 ; TUNIT-NEXT: entry:
2343 ; TUNIT-NEXT: br label [[FOR_COND:%.*]]
2345 ; TUNIT-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY:%.*]] ], [ 0, [[ENTRY:%.*]] ]
2346 ; TUNIT-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV]], [[N]]
2347 ; TUNIT-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY]], label [[FOR_END:%.*]]
2349 ; TUNIT-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
2350 ; TUNIT-NEXT: br label [[FOR_COND]]
2352 ; TUNIT-NEXT: ret void
2354 ; CGSCC: Function Attrs: nofree norecurse nosync nounwind memory(write)
2355 ; CGSCC-LABEL: define {{[^@]+}}@recursive_load_store
2356 ; CGSCC-SAME: (i64 [[N:%.*]], i32 [[V:%.*]]) #[[ATTR8:[0-9]+]] {
2357 ; CGSCC-NEXT: entry:
2358 ; CGSCC-NEXT: br label [[FOR_COND:%.*]]
2360 ; CGSCC-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY:%.*]] ], [ 0, [[ENTRY:%.*]] ]
2361 ; CGSCC-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV]], [[N]]
2362 ; CGSCC-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY]], label [[FOR_END:%.*]]
2364 ; CGSCC-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
2365 ; CGSCC-NEXT: br label [[FOR_COND]]
2367 ; CGSCC-NEXT: ret void
2370 store i32 %v, ptr @rec_storage
2374 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
2375 %exitcond = icmp ne i64 %indvars.iv, %N
2376 br i1 %exitcond, label %for.body, label %for.end
2379 %ll = load i32, ptr @rec_storage
2380 store i32 %ll, ptr @rec_storage
2381 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
2385 %lr = load i32, ptr @rec_storage
2386 store i32 %lr, ptr @rec_storage
2390 define dso_local i32 @round_trip_malloc(i32 %x) {
2391 ; CHECK-LABEL: define {{[^@]+}}@round_trip_malloc
2392 ; CHECK-SAME: (i32 returned [[X:%.*]]) {
2393 ; CHECK-NEXT: entry:
2394 ; CHECK-NEXT: [[CALL_H2S:%.*]] = alloca i8, i64 4, align 1
2395 ; CHECK-NEXT: store i32 [[X]], ptr [[CALL_H2S]], align 4
2396 ; CHECK-NEXT: ret i32 [[X]]
2399 %call = call noalias ptr @malloc(i64 4) norecurse
2400 store i32 %x, ptr %call, align 4
2401 %0 = load i32, ptr %call, align 4
2402 call void @free(ptr %call) norecurse
2406 define dso_local i32 @round_trip_malloc_constant() {
2407 ; CHECK-LABEL: define {{[^@]+}}@round_trip_malloc_constant() {
2408 ; CHECK-NEXT: entry:
2409 ; CHECK-NEXT: ret i32 7
2412 %call = call noalias ptr @malloc(i64 4) norecurse
2413 store i32 7, ptr %call, align 4
2414 %0 = load i32, ptr %call, align 4
2415 call void @free(ptr %call) norecurse
2419 declare noalias ptr @malloc(i64) allockind("alloc,uninitialized") allocsize(0) "alloc-family"="malloc"
2421 declare void @free(ptr) allockind("free") "alloc-family"="malloc"
2423 define dso_local i32 @conditional_malloc(i32 %x) {
2424 ; CHECK-LABEL: define {{[^@]+}}@conditional_malloc
2425 ; CHECK-SAME: (i32 returned [[X:%.*]]) {
2426 ; CHECK-NEXT: entry:
2427 ; CHECK-NEXT: [[CALL_H2S:%.*]] = alloca i8, i64 4, align 1
2428 ; CHECK-NEXT: [[TOBOOL:%.*]] = icmp ne i32 [[X]], 0
2429 ; CHECK-NEXT: br i1 [[TOBOOL]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
2431 ; CHECK-NEXT: store i32 [[X]], ptr [[CALL_H2S]], align 4
2432 ; CHECK-NEXT: br label [[IF_END]]
2434 ; CHECK-NEXT: ret i32 [[X]]
2437 %call = call noalias ptr @malloc(i64 4) norecurse
2438 %tobool = icmp ne i32 %x, 0
2439 br i1 %tobool, label %if.then, label %if.end
2441 if.then: ; preds = %entry
2442 store i32 %x, ptr %call, align 4
2445 if.end: ; preds = %if.then, %entry
2446 %0 = load i32, ptr %call, align 4
2450 define dso_local i32 @round_trip_calloc(i32 %x) {
2451 ; CHECK-LABEL: define {{[^@]+}}@round_trip_calloc
2452 ; CHECK-SAME: (i32 returned [[X:%.*]]) {
2453 ; CHECK-NEXT: entry:
2454 ; CHECK-NEXT: [[CALL_H2S:%.*]] = alloca i8, i64 4, align 1
2455 ; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr [[CALL_H2S]], i8 0, i64 4, i1 false)
2456 ; CHECK-NEXT: store i32 [[X]], ptr [[CALL_H2S]], align 4
2457 ; CHECK-NEXT: ret i32 [[X]]
2460 %call = call noalias ptr @calloc(i64 4, i64 1) norecurse
2461 store i32 %x, ptr %call, align 4
2462 %0 = load i32, ptr %call, align 4
2466 define dso_local i32 @round_trip_calloc_constant() {
2467 ; CHECK-LABEL: define {{[^@]+}}@round_trip_calloc_constant() {
2468 ; CHECK-NEXT: entry:
2469 ; CHECK-NEXT: [[CALL_H2S:%.*]] = alloca i8, i64 4, align 1
2470 ; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr [[CALL_H2S]], i8 0, i64 4, i1 false)
2471 ; CHECK-NEXT: ret i32 11
2474 %call = call noalias ptr @calloc(i64 4, i64 1) norecurse
2475 store i32 11, ptr %call, align 4
2476 %0 = load i32, ptr %call, align 4
2480 declare noalias ptr @calloc(i64, i64) allockind("alloc,zeroed") allocsize(0, 1) "alloc-family"="malloc"
2482 define dso_local i32 @conditional_calloc(i32 %x) {
2483 ; CHECK-LABEL: define {{[^@]+}}@conditional_calloc
2484 ; CHECK-SAME: (i32 [[X:%.*]]) {
2485 ; CHECK-NEXT: entry:
2486 ; CHECK-NEXT: [[CALL_H2S:%.*]] = alloca i8, i64 4, align 1
2487 ; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr [[CALL_H2S]], i8 0, i64 4, i1 false)
2488 ; CHECK-NEXT: [[TOBOOL:%.*]] = icmp ne i32 [[X]], 0
2489 ; CHECK-NEXT: br i1 [[TOBOOL]], label [[IF_END:%.*]], label [[IF_THEN:%.*]]
2491 ; CHECK-NEXT: store i32 [[X]], ptr [[CALL_H2S]], align 4
2492 ; CHECK-NEXT: br label [[IF_END]]
2494 ; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[CALL_H2S]], align 4
2495 ; CHECK-NEXT: ret i32 [[TMP0]]
2498 %call = call noalias ptr @calloc(i64 1, i64 4) norecurse
2499 %tobool = icmp ne i32 %x, 0
2500 br i1 %tobool, label %if.end, label %if.then
2502 if.then: ; preds = %entry
2503 store i32 %x, ptr %call, align 4
2506 if.end: ; preds = %if.then, %entry
2507 %0 = load i32, ptr %call, align 4
2508 call void @free(ptr %call) norecurse
2512 define dso_local i32 @conditional_calloc_zero(i1 %c) {
2513 ; CHECK-LABEL: define {{[^@]+}}@conditional_calloc_zero
2514 ; CHECK-SAME: (i1 [[C:%.*]]) {
2515 ; CHECK-NEXT: entry:
2516 ; CHECK-NEXT: [[CALL_H2S:%.*]] = alloca i8, i64 4, align 1
2517 ; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr [[CALL_H2S]], i8 0, i64 4, i1 false)
2518 ; CHECK-NEXT: br i1 [[C]], label [[IF_END:%.*]], label [[IF_THEN:%.*]]
2520 ; CHECK-NEXT: br label [[IF_END]]
2522 ; CHECK-NEXT: ret i32 0
2525 %call = call noalias ptr @calloc(i64 1, i64 4) norecurse
2526 br i1 %c, label %if.end, label %if.then
2528 if.then: ; preds = %entry
2529 store i32 0, ptr %call, align 4
2532 if.end: ; preds = %if.then, %entry
2533 %0 = load i32, ptr %call, align 4
2534 call void @free(ptr %call) norecurse
2538 define dso_local ptr @malloc_like(i32 %s) {
2539 ; TUNIT-LABEL: define {{[^@]+}}@malloc_like
2540 ; TUNIT-SAME: (i32 [[S:%.*]]) {
2541 ; TUNIT-NEXT: entry:
2542 ; TUNIT-NEXT: [[CONV:%.*]] = sext i32 [[S]] to i64
2543 ; TUNIT-NEXT: [[CALL:%.*]] = call noalias ptr @malloc(i64 [[CONV]]) #[[ATTR20:[0-9]+]]
2544 ; TUNIT-NEXT: ret ptr [[CALL]]
2546 ; CGSCC-LABEL: define {{[^@]+}}@malloc_like
2547 ; CGSCC-SAME: (i32 [[S:%.*]]) {
2548 ; CGSCC-NEXT: entry:
2549 ; CGSCC-NEXT: [[CONV:%.*]] = sext i32 [[S]] to i64
2550 ; CGSCC-NEXT: [[CALL:%.*]] = call noalias ptr @malloc(i64 [[CONV]]) #[[ATTR23:[0-9]+]]
2551 ; CGSCC-NEXT: ret ptr [[CALL]]
2554 %conv = sext i32 %s to i64
2555 %call = call noalias ptr @malloc(i64 %conv) norecurse
2559 define dso_local i32 @round_trip_malloc_like(i32 %x) {
2560 ; TUNIT-LABEL: define {{[^@]+}}@round_trip_malloc_like
2561 ; TUNIT-SAME: (i32 [[X:%.*]]) {
2562 ; TUNIT-NEXT: entry:
2563 ; TUNIT-NEXT: [[CALL:%.*]] = call noalias ptr @malloc_like(i32 noundef 4) #[[ATTR20]]
2564 ; TUNIT-NEXT: store i32 [[X]], ptr [[CALL]], align 4
2565 ; TUNIT-NEXT: [[TMP0:%.*]] = load i32, ptr [[CALL]], align 4
2566 ; TUNIT-NEXT: call void @free(ptr noundef nonnull align 4 dereferenceable(4) [[CALL]]) #[[ATTR20]]
2567 ; TUNIT-NEXT: ret i32 [[TMP0]]
2569 ; CGSCC-LABEL: define {{[^@]+}}@round_trip_malloc_like
2570 ; CGSCC-SAME: (i32 [[X:%.*]]) {
2571 ; CGSCC-NEXT: entry:
2572 ; CGSCC-NEXT: [[CALL:%.*]] = call noalias ptr @malloc_like(i32 noundef 4) #[[ATTR23]]
2573 ; CGSCC-NEXT: store i32 [[X]], ptr [[CALL]], align 4
2574 ; CGSCC-NEXT: [[TMP0:%.*]] = load i32, ptr [[CALL]], align 4
2575 ; CGSCC-NEXT: call void @free(ptr noundef nonnull align 4 dereferenceable(4) [[CALL]]) #[[ATTR23]]
2576 ; CGSCC-NEXT: ret i32 [[TMP0]]
2579 %call = call ptr @malloc_like(i32 4) norecurse
2580 store i32 %x, ptr %call, align 4
2581 %0 = load i32, ptr %call, align 4
2582 call void @free(ptr %call) norecurse
2586 define dso_local i32 @round_trip_unknown_alloc(i32 %x) {
2587 ; TUNIT-LABEL: define {{[^@]+}}@round_trip_unknown_alloc
2588 ; TUNIT-SAME: (i32 [[X:%.*]]) {
2589 ; TUNIT-NEXT: entry:
2590 ; TUNIT-NEXT: [[CALL:%.*]] = call noalias ptr @unknown_alloc(i32 noundef 4) #[[ATTR20]]
2591 ; TUNIT-NEXT: store i32 [[X]], ptr [[CALL]], align 4
2592 ; TUNIT-NEXT: [[TMP0:%.*]] = load i32, ptr [[CALL]], align 4
2593 ; TUNIT-NEXT: call void @free(ptr noundef nonnull align 4 dereferenceable(4) [[CALL]]) #[[ATTR20]]
2594 ; TUNIT-NEXT: ret i32 [[TMP0]]
2596 ; CGSCC-LABEL: define {{[^@]+}}@round_trip_unknown_alloc
2597 ; CGSCC-SAME: (i32 [[X:%.*]]) {
2598 ; CGSCC-NEXT: entry:
2599 ; CGSCC-NEXT: [[CALL:%.*]] = call noalias ptr @unknown_alloc(i32 noundef 4) #[[ATTR23]]
2600 ; CGSCC-NEXT: store i32 [[X]], ptr [[CALL]], align 4
2601 ; CGSCC-NEXT: [[TMP0:%.*]] = load i32, ptr [[CALL]], align 4
2602 ; CGSCC-NEXT: call void @free(ptr noundef nonnull align 4 dereferenceable(4) [[CALL]]) #[[ATTR23]]
2603 ; CGSCC-NEXT: ret i32 [[TMP0]]
2606 %call = call ptr @unknown_alloc(i32 4) norecurse
2607 store i32 %x, ptr %call, align 4
2608 %0 = load i32, ptr %call, align 4
2609 call void @free(ptr %call) norecurse
2613 declare noalias ptr @unknown_alloc(i32)
2615 define dso_local i32 @conditional_unknown_alloc(i32 %x) {
2616 ; TUNIT-LABEL: define {{[^@]+}}@conditional_unknown_alloc
2617 ; TUNIT-SAME: (i32 [[X:%.*]]) {
2618 ; TUNIT-NEXT: entry:
2619 ; TUNIT-NEXT: [[CALL:%.*]] = call noalias ptr @unknown_alloc(i32 noundef 4) #[[ATTR20]]
2620 ; TUNIT-NEXT: [[TOBOOL:%.*]] = icmp ne i32 [[X]], 0
2621 ; TUNIT-NEXT: br i1 [[TOBOOL]], label [[IF_END:%.*]], label [[IF_THEN:%.*]]
2623 ; TUNIT-NEXT: store i32 [[X]], ptr [[CALL]], align 4
2624 ; TUNIT-NEXT: br label [[IF_END]]
2626 ; TUNIT-NEXT: [[TMP0:%.*]] = load i32, ptr [[CALL]], align 4
2627 ; TUNIT-NEXT: call void @free(ptr nonnull align 4 dereferenceable(4) [[CALL]]) #[[ATTR20]]
2628 ; TUNIT-NEXT: ret i32 [[TMP0]]
2630 ; CGSCC-LABEL: define {{[^@]+}}@conditional_unknown_alloc
2631 ; CGSCC-SAME: (i32 [[X:%.*]]) {
2632 ; CGSCC-NEXT: entry:
2633 ; CGSCC-NEXT: [[CALL:%.*]] = call noalias ptr @unknown_alloc(i32 noundef 4) #[[ATTR23]]
2634 ; CGSCC-NEXT: [[TOBOOL:%.*]] = icmp ne i32 [[X]], 0
2635 ; CGSCC-NEXT: br i1 [[TOBOOL]], label [[IF_END:%.*]], label [[IF_THEN:%.*]]
2637 ; CGSCC-NEXT: store i32 [[X]], ptr [[CALL]], align 4
2638 ; CGSCC-NEXT: br label [[IF_END]]
2640 ; CGSCC-NEXT: [[TMP0:%.*]] = load i32, ptr [[CALL]], align 4
2641 ; CGSCC-NEXT: call void @free(ptr nonnull align 4 dereferenceable(4) [[CALL]]) #[[ATTR23]]
2642 ; CGSCC-NEXT: ret i32 [[TMP0]]
2645 %call = call noalias ptr @unknown_alloc(i32 4) norecurse
2646 %tobool = icmp ne i32 %x, 0
2647 br i1 %tobool, label %if.end, label %if.then
2649 if.then: ; preds = %entry
2650 store i32 %x, ptr %call, align 4
2653 if.end: ; preds = %if.then, %entry
2654 %0 = load i32, ptr %call, align 4
2655 call void @free(ptr %call) norecurse
2659 %struct.STy = type { ptr, ptr, ptr }
2661 @global = internal global %struct.STy zeroinitializer, align 8
2663 ; We mark %dst as writeonly and %src as readonly, that is (for now) all we can expect.
2664 define dso_local void @test_nested_memory(ptr %dst, ptr %src) {
2665 ; TUNIT-LABEL: define {{[^@]+}}@test_nested_memory
2666 ; TUNIT-SAME: (ptr nocapture nofree writeonly [[DST:%.*]], ptr nocapture nofree readonly [[SRC:%.*]]) {
2667 ; TUNIT-NEXT: entry:
2668 ; TUNIT-NEXT: [[CALL_H2S:%.*]] = alloca i8, i64 24, align 1
2669 ; TUNIT-NEXT: [[LOCAL:%.*]] = alloca [[STRUCT_STY:%.*]], align 8
2670 ; TUNIT-NEXT: [[INNER:%.*]] = getelementptr inbounds [[STRUCT_STY]], ptr [[LOCAL]], i64 0, i32 2
2671 ; TUNIT-NEXT: store ptr @global, ptr [[INNER]], align 8
2672 ; TUNIT-NEXT: store ptr [[DST]], ptr [[CALL_H2S]], align 8
2673 ; TUNIT-NEXT: [[SRC2:%.*]] = getelementptr inbounds i8, ptr [[CALL_H2S]], i64 8
2674 ; TUNIT-NEXT: store ptr [[SRC]], ptr [[SRC2]], align 8
2675 ; TUNIT-NEXT: store ptr [[CALL_H2S]], ptr getelementptr inbounds ([[STRUCT_STY]], ptr @global, i64 0, i32 2), align 8
2676 ; TUNIT-NEXT: [[TMP0:%.*]] = load ptr, ptr [[LOCAL]], align 8
2677 ; TUNIT-NEXT: [[LOCAL_B8:%.*]] = getelementptr i8, ptr [[LOCAL]], i64 8
2678 ; TUNIT-NEXT: [[TMP1:%.*]] = load ptr, ptr [[LOCAL_B8]], align 8
2679 ; TUNIT-NEXT: [[LOCAL_B16:%.*]] = getelementptr i8, ptr [[LOCAL]], i64 16
2680 ; TUNIT-NEXT: [[TMP2:%.*]] = load ptr, ptr [[LOCAL_B16]], align 8
2681 ; TUNIT-NEXT: call fastcc void @nested_memory_callee(ptr [[TMP0]], ptr [[TMP1]], ptr [[TMP2]]) #[[ATTR21:[0-9]+]]
2682 ; TUNIT-NEXT: ret void
2684 ; CGSCC-LABEL: define {{[^@]+}}@test_nested_memory
2685 ; CGSCC-SAME: (ptr nofree [[DST:%.*]], ptr nofree [[SRC:%.*]]) {
2686 ; CGSCC-NEXT: entry:
2687 ; CGSCC-NEXT: [[LOCAL:%.*]] = alloca [[STRUCT_STY:%.*]], align 8
2688 ; CGSCC-NEXT: [[INNER:%.*]] = getelementptr inbounds [[STRUCT_STY]], ptr [[LOCAL]], i64 0, i32 2
2689 ; CGSCC-NEXT: [[CALL:%.*]] = call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24)
2690 ; CGSCC-NEXT: store ptr [[DST]], ptr [[CALL]], align 8
2691 ; CGSCC-NEXT: [[SRC2:%.*]] = getelementptr inbounds i8, ptr [[CALL]], i64 8
2692 ; CGSCC-NEXT: store ptr [[SRC]], ptr [[SRC2]], align 8
2693 ; CGSCC-NEXT: store ptr [[CALL]], ptr getelementptr inbounds ([[STRUCT_STY]], ptr @global, i64 0, i32 2), align 8
2694 ; CGSCC-NEXT: call fastcc void @nested_memory_callee(ptr nofree align 4294967296 undef, ptr nofree align 4294967296 undef, ptr nofree noundef nonnull align 8 dereferenceable(24) @global) #[[ATTR24:[0-9]+]]
2695 ; CGSCC-NEXT: ret void
2698 %local = alloca %struct.STy, align 8
2699 %inner = getelementptr inbounds %struct.STy, ptr %local, i64 0, i32 2
2700 store ptr @global, ptr %inner, align 8
2701 %call = call noalias dereferenceable_or_null(24) ptr @malloc(i64 24) #4
2702 store ptr %dst, ptr %call, align 8
2703 %src2 = getelementptr inbounds i8, ptr %call, i64 8
2704 store ptr %src, ptr %src2, align 8
2705 store ptr %call, ptr getelementptr inbounds (%struct.STy, ptr @global, i64 0, i32 2), align 8
2706 call fastcc void @nested_memory_callee(ptr nonnull %local)
2710 define internal fastcc void @nested_memory_callee(ptr nocapture readonly %S) nofree norecurse nounwind uwtable {
2711 ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn uwtable
2712 ; TUNIT-LABEL: define {{[^@]+}}@nested_memory_callee
2713 ; TUNIT-SAME: (ptr [[TMP0:%.*]], ptr [[TMP1:%.*]], ptr [[TMP2:%.*]]) #[[ATTR11:[0-9]+]] {
2714 ; TUNIT-NEXT: entry:
2715 ; TUNIT-NEXT: [[S_PRIV:%.*]] = alloca [[STRUCT_STY:%.*]], align 8
2716 ; TUNIT-NEXT: store ptr [[TMP0]], ptr [[S_PRIV]], align 8
2717 ; TUNIT-NEXT: [[S_PRIV_B8:%.*]] = getelementptr i8, ptr [[S_PRIV]], i64 8
2718 ; TUNIT-NEXT: store ptr [[TMP1]], ptr [[S_PRIV_B8]], align 8
2719 ; TUNIT-NEXT: [[S_PRIV_B16:%.*]] = getelementptr i8, ptr [[S_PRIV]], i64 16
2720 ; TUNIT-NEXT: store ptr [[TMP2]], ptr [[S_PRIV_B16]], align 8
2721 ; TUNIT-NEXT: [[INNER:%.*]] = getelementptr inbounds [[STRUCT_STY]], ptr [[S_PRIV]], i64 0, i32 2
2722 ; TUNIT-NEXT: [[TMP3:%.*]] = load ptr, ptr [[INNER]], align 8
2723 ; TUNIT-NEXT: [[INNER1:%.*]] = getelementptr inbounds [[STRUCT_STY]], ptr [[TMP3]], i64 0, i32 2
2724 ; TUNIT-NEXT: [[TMP4:%.*]] = load ptr, ptr [[INNER1]], align 8
2725 ; TUNIT-NEXT: [[SRC:%.*]] = getelementptr inbounds [[STRUCT_STY]], ptr [[TMP4]], i64 0, i32 1
2726 ; TUNIT-NEXT: [[TMP5:%.*]] = load ptr, ptr [[SRC]], align 8
2727 ; TUNIT-NEXT: [[TMP6:%.*]] = load double, ptr [[TMP5]], align 8
2728 ; TUNIT-NEXT: [[CONV:%.*]] = fptrunc double [[TMP6]] to float
2729 ; TUNIT-NEXT: [[TMP7:%.*]] = load ptr, ptr [[TMP4]], align 8
2730 ; TUNIT-NEXT: store float [[CONV]], ptr [[TMP7]], align 4
2731 ; TUNIT-NEXT: ret void
2733 ; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn uwtable
2734 ; CGSCC-LABEL: define {{[^@]+}}@nested_memory_callee
2735 ; CGSCC-SAME: (ptr nofree [[TMP0:%.*]], ptr nofree [[TMP1:%.*]], ptr nofree [[TMP2:%.*]]) #[[ATTR12:[0-9]+]] {
2736 ; CGSCC-NEXT: entry:
2737 ; CGSCC-NEXT: [[S_PRIV:%.*]] = alloca [[STRUCT_STY:%.*]], align 8
2738 ; CGSCC-NEXT: store ptr [[TMP0]], ptr [[S_PRIV]], align 8
2739 ; CGSCC-NEXT: [[S_PRIV_B8:%.*]] = getelementptr i8, ptr [[S_PRIV]], i64 8
2740 ; CGSCC-NEXT: store ptr [[TMP1]], ptr [[S_PRIV_B8]], align 8
2741 ; CGSCC-NEXT: [[S_PRIV_B16:%.*]] = getelementptr i8, ptr [[S_PRIV]], i64 16
2742 ; CGSCC-NEXT: store ptr [[TMP2]], ptr [[S_PRIV_B16]], align 8
2743 ; CGSCC-NEXT: [[INNER:%.*]] = getelementptr inbounds [[STRUCT_STY]], ptr [[S_PRIV]], i64 0, i32 2
2744 ; CGSCC-NEXT: [[TMP3:%.*]] = load ptr, ptr [[INNER]], align 8
2745 ; CGSCC-NEXT: [[INNER1:%.*]] = getelementptr inbounds [[STRUCT_STY]], ptr [[TMP3]], i64 0, i32 2
2746 ; CGSCC-NEXT: [[TMP4:%.*]] = load ptr, ptr [[INNER1]], align 8
2747 ; CGSCC-NEXT: [[SRC:%.*]] = getelementptr inbounds [[STRUCT_STY]], ptr [[TMP4]], i64 0, i32 1
2748 ; CGSCC-NEXT: [[TMP5:%.*]] = load ptr, ptr [[SRC]], align 8
2749 ; CGSCC-NEXT: [[TMP6:%.*]] = load double, ptr [[TMP5]], align 8
2750 ; CGSCC-NEXT: [[CONV:%.*]] = fptrunc double [[TMP6]] to float
2751 ; CGSCC-NEXT: [[TMP7:%.*]] = load ptr, ptr [[TMP4]], align 8
2752 ; CGSCC-NEXT: store float [[CONV]], ptr [[TMP7]], align 4
2753 ; CGSCC-NEXT: ret void
2756 %inner = getelementptr inbounds %struct.STy, ptr %S, i64 0, i32 2
2757 %0 = load ptr, ptr %inner, align 8
2758 %inner1 = getelementptr inbounds %struct.STy, ptr %0, i64 0, i32 2
2759 %1 = load ptr, ptr %inner1, align 8
2760 %src = getelementptr inbounds %struct.STy, ptr %1, i64 0, i32 1
2761 %2 = load ptr, ptr %src, align 8
2762 %3 = load double, ptr %2, align 8
2763 %conv = fptrunc double %3 to float
2764 %4 = load ptr, ptr %1, align 8
2765 store float %conv, ptr %4, align 4
2769 ; Make sure the access %1 is not forwarded to the loads %2 and %3 as the indices are
2770 ; varying and the accesses thus not "exact". This used to simplify %cmp12 to true.
2771 define hidden void @no_propagation_of_unknown_index_access(ptr %in, ptr %out, i32 %idx) #0 {
2772 ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite)
2773 ; TUNIT-LABEL: define {{[^@]+}}@no_propagation_of_unknown_index_access
2774 ; TUNIT-SAME: (ptr nocapture nofree readonly [[IN:%.*]], ptr nocapture nofree writeonly [[OUT:%.*]], i32 [[IDX:%.*]]) #[[ATTR1]] {
2775 ; TUNIT-NEXT: entry:
2776 ; TUNIT-NEXT: [[BUF:%.*]] = alloca [128 x i32], align 16
2777 ; TUNIT-NEXT: call void @llvm.lifetime.start.p0(i64 noundef 512, ptr noalias nocapture nofree noundef nonnull align 16 dereferenceable(512) [[BUF]]) #[[ATTR17]]
2778 ; TUNIT-NEXT: br label [[FOR_COND:%.*]]
2780 ; TUNIT-NEXT: [[I_0:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INC:%.*]], [[FOR_BODY:%.*]] ]
2781 ; TUNIT-NEXT: [[CMP:%.*]] = icmp slt i32 [[I_0]], 128
2782 ; TUNIT-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[FOR_COND_CLEANUP:%.*]]
2783 ; TUNIT: for.cond.cleanup:
2784 ; TUNIT-NEXT: br label [[FOR_COND4:%.*]]
2786 ; TUNIT-NEXT: [[IDXPROM:%.*]] = sext i32 [[I_0]] to i64
2787 ; TUNIT-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, ptr [[IN]], i64 [[IDXPROM]]
2788 ; TUNIT-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARRAYIDX]], align 4
2789 ; TUNIT-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds [128 x i32], ptr [[BUF]], i64 0, i64 [[IDXPROM]]
2790 ; TUNIT-NEXT: store i32 [[TMP0]], ptr [[ARRAYIDX2]], align 4
2791 ; TUNIT-NEXT: [[INC]] = add nsw i32 [[I_0]], 1
2792 ; TUNIT-NEXT: br label [[FOR_COND]], !llvm.loop [[TBAA10]]
2794 ; TUNIT-NEXT: [[I3_0:%.*]] = phi i32 [ 0, [[FOR_COND_CLEANUP]] ], [ [[INC16:%.*]], [[FOR_BODY7:%.*]] ]
2795 ; TUNIT-NEXT: [[CMP5:%.*]] = icmp slt i32 [[I3_0]], 128
2796 ; TUNIT-NEXT: br i1 [[CMP5]], label [[FOR_BODY7]], label [[FOR_COND_CLEANUP6:%.*]]
2797 ; TUNIT: for.cond.cleanup6:
2798 ; TUNIT-NEXT: call void @llvm.lifetime.end.p0(i64 noundef 512, ptr noalias nocapture nofree noundef nonnull align 16 dereferenceable(512) [[BUF]]) #[[ATTR17]]
2799 ; TUNIT-NEXT: ret void
2801 ; TUNIT-NEXT: [[IDXPROM8:%.*]] = sext i32 [[I3_0]] to i64
2802 ; TUNIT-NEXT: [[ARRAYIDX9:%.*]] = getelementptr inbounds [128 x i32], ptr [[BUF]], i64 0, i64 [[IDXPROM8]]
2803 ; TUNIT-NEXT: [[TMP1:%.*]] = load i32, ptr [[ARRAYIDX9]], align 4
2804 ; TUNIT-NEXT: [[IDXPROM10:%.*]] = sext i32 [[IDX]] to i64
2805 ; TUNIT-NEXT: [[ARRAYIDX11:%.*]] = getelementptr inbounds [128 x i32], ptr [[BUF]], i64 0, i64 [[IDXPROM10]]
2806 ; TUNIT-NEXT: [[TMP2:%.*]] = load i32, ptr [[ARRAYIDX11]], align 4
2807 ; TUNIT-NEXT: [[CMP12:%.*]] = icmp sle i32 [[TMP1]], [[TMP2]]
2808 ; TUNIT-NEXT: [[CONV:%.*]] = zext i1 [[CMP12]] to i32
2809 ; TUNIT-NEXT: [[ARRAYIDX14:%.*]] = getelementptr inbounds i32, ptr [[OUT]], i64 [[IDXPROM8]]
2810 ; TUNIT-NEXT: store i32 [[CONV]], ptr [[ARRAYIDX14]], align 4
2811 ; TUNIT-NEXT: [[INC16]] = add nsw i32 [[I3_0]], 1
2812 ; TUNIT-NEXT: br label [[FOR_COND4]], !llvm.loop [[TBAA12]]
2814 ; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite)
2815 ; CGSCC-LABEL: define {{[^@]+}}@no_propagation_of_unknown_index_access
2816 ; CGSCC-SAME: (ptr nocapture nofree readonly [[IN:%.*]], ptr nocapture nofree writeonly [[OUT:%.*]], i32 [[IDX:%.*]]) #[[ATTR13:[0-9]+]] {
2817 ; CGSCC-NEXT: entry:
2818 ; CGSCC-NEXT: [[BUF:%.*]] = alloca [128 x i32], align 16
2819 ; CGSCC-NEXT: call void @llvm.lifetime.start.p0(i64 noundef 512, ptr noalias nocapture nofree noundef nonnull align 16 dereferenceable(512) [[BUF]]) #[[ATTR20]]
2820 ; CGSCC-NEXT: br label [[FOR_COND:%.*]]
2822 ; CGSCC-NEXT: [[I_0:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INC:%.*]], [[FOR_BODY:%.*]] ]
2823 ; CGSCC-NEXT: [[CMP:%.*]] = icmp slt i32 [[I_0]], 128
2824 ; CGSCC-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[FOR_COND_CLEANUP:%.*]]
2825 ; CGSCC: for.cond.cleanup:
2826 ; CGSCC-NEXT: br label [[FOR_COND4:%.*]]
2828 ; CGSCC-NEXT: [[IDXPROM:%.*]] = sext i32 [[I_0]] to i64
2829 ; CGSCC-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, ptr [[IN]], i64 [[IDXPROM]]
2830 ; CGSCC-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARRAYIDX]], align 4
2831 ; CGSCC-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds [128 x i32], ptr [[BUF]], i64 0, i64 [[IDXPROM]]
2832 ; CGSCC-NEXT: store i32 [[TMP0]], ptr [[ARRAYIDX2]], align 4
2833 ; CGSCC-NEXT: [[INC]] = add nsw i32 [[I_0]], 1
2834 ; CGSCC-NEXT: br label [[FOR_COND]], !llvm.loop [[TBAA10]]
2836 ; CGSCC-NEXT: [[I3_0:%.*]] = phi i32 [ 0, [[FOR_COND_CLEANUP]] ], [ [[INC16:%.*]], [[FOR_BODY7:%.*]] ]
2837 ; CGSCC-NEXT: [[CMP5:%.*]] = icmp slt i32 [[I3_0]], 128
2838 ; CGSCC-NEXT: br i1 [[CMP5]], label [[FOR_BODY7]], label [[FOR_COND_CLEANUP6:%.*]]
2839 ; CGSCC: for.cond.cleanup6:
2840 ; CGSCC-NEXT: call void @llvm.lifetime.end.p0(i64 noundef 512, ptr noalias nocapture nofree noundef nonnull align 16 dereferenceable(512) [[BUF]]) #[[ATTR20]]
2841 ; CGSCC-NEXT: ret void
2843 ; CGSCC-NEXT: [[IDXPROM8:%.*]] = sext i32 [[I3_0]] to i64
2844 ; CGSCC-NEXT: [[ARRAYIDX9:%.*]] = getelementptr inbounds [128 x i32], ptr [[BUF]], i64 0, i64 [[IDXPROM8]]
2845 ; CGSCC-NEXT: [[TMP1:%.*]] = load i32, ptr [[ARRAYIDX9]], align 4
2846 ; CGSCC-NEXT: [[IDXPROM10:%.*]] = sext i32 [[IDX]] to i64
2847 ; CGSCC-NEXT: [[ARRAYIDX11:%.*]] = getelementptr inbounds [128 x i32], ptr [[BUF]], i64 0, i64 [[IDXPROM10]]
2848 ; CGSCC-NEXT: [[TMP2:%.*]] = load i32, ptr [[ARRAYIDX11]], align 4
2849 ; CGSCC-NEXT: [[CMP12:%.*]] = icmp sle i32 [[TMP1]], [[TMP2]]
2850 ; CGSCC-NEXT: [[CONV:%.*]] = zext i1 [[CMP12]] to i32
2851 ; CGSCC-NEXT: [[ARRAYIDX14:%.*]] = getelementptr inbounds i32, ptr [[OUT]], i64 [[IDXPROM8]]
2852 ; CGSCC-NEXT: store i32 [[CONV]], ptr [[ARRAYIDX14]], align 4
2853 ; CGSCC-NEXT: [[INC16]] = add nsw i32 [[I3_0]], 1
2854 ; CGSCC-NEXT: br label [[FOR_COND4]], !llvm.loop [[TBAA12]]
2857 %buf = alloca [128 x i32], align 16
2858 call void @llvm.lifetime.start.p0(i64 512, ptr %buf) #2
2861 for.cond: ; preds = %for.body, %entry
2862 %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
2863 %cmp = icmp slt i32 %i.0, 128
2864 br i1 %cmp, label %for.body, label %for.cond.cleanup
2866 for.cond.cleanup: ; preds = %for.cond
2869 for.body: ; preds = %for.cond
2870 %idxprom = sext i32 %i.0 to i64
2871 %arrayidx = getelementptr inbounds i32, ptr %in, i64 %idxprom
2872 %0 = load i32, ptr %arrayidx, align 4
2873 %arrayidx2 = getelementptr inbounds [128 x i32], ptr %buf, i64 0, i64 %idxprom
2874 store i32 %0, ptr %arrayidx2, align 4
2875 %inc = add nsw i32 %i.0, 1
2876 br label %for.cond, !llvm.loop !10
2878 for.cond4: ; preds = %for.body7, %for.cond.cleanup
2879 %i3.0 = phi i32 [ 0, %for.cond.cleanup ], [ %inc16, %for.body7 ]
2880 %cmp5 = icmp slt i32 %i3.0, 128
2881 br i1 %cmp5, label %for.body7, label %for.cond.cleanup6
2883 for.cond.cleanup6: ; preds = %for.cond4
2884 call void @llvm.lifetime.end.p0(i64 512, ptr %buf) #2
2887 for.body7: ; preds = %for.cond4
2888 %idxprom8 = sext i32 %i3.0 to i64
2889 %arrayidx9 = getelementptr inbounds [128 x i32], ptr %buf, i64 0, i64 %idxprom8
2890 %1 = load i32, ptr %arrayidx9, align 4
2891 %idxprom10 = sext i32 %idx to i64
2892 %arrayidx11 = getelementptr inbounds [128 x i32], ptr %buf, i64 0, i64 %idxprom10
2893 %2 = load i32, ptr %arrayidx11, align 4
2894 %cmp12 = icmp sle i32 %1, %2
2895 %conv = zext i1 %cmp12 to i32
2896 %arrayidx14 = getelementptr inbounds i32, ptr %out, i64 %idxprom8
2897 store i32 %conv, ptr %arrayidx14, align 4
2898 %inc16 = add nsw i32 %i3.0, 1
2899 br label %for.cond4, !llvm.loop !12
2902 ; Ensure we do not return true.
2903 define internal i1 @alloca_non_unique(ptr %p, i32 %in, i1 %c) {
2904 ; TUNIT: Function Attrs: nofree nosync nounwind memory(argmem: readwrite)
2905 ; TUNIT-LABEL: define {{[^@]+}}@alloca_non_unique
2906 ; TUNIT-SAME: (ptr noalias nocapture nofree readonly align 4 [[P:%.*]], i32 [[IN:%.*]], i1 noundef [[C:%.*]]) #[[ATTR12:[0-9]+]] {
2907 ; TUNIT-NEXT: [[A:%.*]] = alloca i32, align 4
2908 ; TUNIT-NEXT: store i32 [[IN]], ptr [[A]], align 4
2909 ; TUNIT-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
2911 ; TUNIT-NEXT: [[R:%.*]] = call i1 @alloca_non_unique(ptr noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[A]], i32 noundef 42, i1 noundef false) #[[ATTR14:[0-9]+]]
2912 ; TUNIT-NEXT: ret i1 [[R]]
2914 ; TUNIT-NEXT: [[L:%.*]] = load i32, ptr [[P]], align 4
2915 ; TUNIT-NEXT: [[CMP:%.*]] = icmp eq i32 [[IN]], [[L]]
2916 ; TUNIT-NEXT: ret i1 [[CMP]]
2918 ; CGSCC: Function Attrs: nofree nosync nounwind memory(argmem: readwrite)
2919 ; CGSCC-LABEL: define {{[^@]+}}@alloca_non_unique
2920 ; CGSCC-SAME: (ptr noalias nocapture nofree readonly align 4 [[P:%.*]], i32 [[IN:%.*]], i1 noundef [[C:%.*]]) #[[ATTR14:[0-9]+]] {
2921 ; CGSCC-NEXT: [[A:%.*]] = alloca i32, align 4
2922 ; CGSCC-NEXT: store i32 [[IN]], ptr [[A]], align 4
2923 ; CGSCC-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
2925 ; CGSCC-NEXT: [[R:%.*]] = call i1 @alloca_non_unique(ptr noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[A]], i32 noundef 42, i1 noundef false) #[[ATTR17:[0-9]+]]
2926 ; CGSCC-NEXT: ret i1 [[R]]
2928 ; CGSCC-NEXT: [[L:%.*]] = load i32, ptr [[P]], align 4
2929 ; CGSCC-NEXT: [[CMP:%.*]] = icmp eq i32 [[IN]], [[L]]
2930 ; CGSCC-NEXT: ret i1 [[CMP]]
2933 store i32 %in, ptr %a
2934 br i1 %c, label %t, label %f
2936 %r = call i1 @alloca_non_unique(ptr %a, i32 42, i1 false)
2939 %l = load i32, ptr %p
2940 %cmp = icmp eq i32 %in, %l
2944 ; Ensure we do not return true.
2945 define i1 @alloca_non_unique_caller(i32 %in, i1 %c) {
2946 ; TUNIT: Function Attrs: nofree norecurse nosync nounwind memory(none)
2947 ; TUNIT-LABEL: define {{[^@]+}}@alloca_non_unique_caller
2948 ; TUNIT-SAME: (i32 [[IN:%.*]], i1 [[C:%.*]]) #[[ATTR13:[0-9]+]] {
2949 ; TUNIT-NEXT: [[R:%.*]] = call i1 @alloca_non_unique(ptr undef, i32 [[IN]], i1 noundef [[C]]) #[[ATTR14]]
2950 ; TUNIT-NEXT: ret i1 [[R]]
2952 ; CGSCC: Function Attrs: nofree nosync nounwind memory(none)
2953 ; CGSCC-LABEL: define {{[^@]+}}@alloca_non_unique_caller
2954 ; CGSCC-SAME: (i32 [[IN:%.*]], i1 noundef [[C:%.*]]) #[[ATTR15:[0-9]+]] {
2955 ; CGSCC-NEXT: [[R:%.*]] = call i1 @alloca_non_unique(ptr nofree undef, i32 [[IN]], i1 noundef [[C]]) #[[ATTR25:[0-9]+]]
2956 ; CGSCC-NEXT: ret i1 [[R]]
2958 %r = call i1 @alloca_non_unique(ptr undef, i32 %in, i1 %c)
2962 ; Ensure we do not return %bad or %l, but %sel
2963 define i32 @scope_value_traversal(i32 %bad, i1 %c, i1 %c2) {
2964 ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
2965 ; TUNIT-LABEL: define {{[^@]+}}@scope_value_traversal
2966 ; TUNIT-SAME: (i32 [[BAD:%.*]], i1 [[C:%.*]], i1 [[C2:%.*]]) #[[ATTR4]] {
2967 ; TUNIT-NEXT: [[A:%.*]] = alloca i32, align 4
2968 ; TUNIT-NEXT: store i32 [[BAD]], ptr [[A]], align 4
2969 ; TUNIT-NEXT: call void @scope_value_traversal_helper(ptr noalias nocapture nofree noundef nonnull align 4 dereferenceable(4) [[A]], i1 [[C2]]) #[[ATTR22:[0-9]+]]
2970 ; TUNIT-NEXT: [[L:%.*]] = load i32, ptr [[A]], align 4
2971 ; TUNIT-NEXT: [[SEL:%.*]] = select i1 [[C]], i32 [[BAD]], i32 [[L]]
2972 ; TUNIT-NEXT: ret i32 [[SEL]]
2974 ; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
2975 ; CGSCC-LABEL: define {{[^@]+}}@scope_value_traversal
2976 ; CGSCC-SAME: (i32 [[BAD:%.*]], i1 [[C:%.*]], i1 [[C2:%.*]]) #[[ATTR16:[0-9]+]] {
2977 ; CGSCC-NEXT: [[A:%.*]] = alloca i32, align 4
2978 ; CGSCC-NEXT: store i32 [[BAD]], ptr [[A]], align 4
2979 ; CGSCC-NEXT: call void @scope_value_traversal_helper(ptr noalias nocapture nofree noundef nonnull align 4 dereferenceable(4) [[A]], i1 [[C2]]) #[[ATTR26:[0-9]+]]
2980 ; CGSCC-NEXT: [[L:%.*]] = load i32, ptr [[A]], align 4
2981 ; CGSCC-NEXT: [[SEL:%.*]] = select i1 [[C]], i32 [[BAD]], i32 [[L]]
2982 ; CGSCC-NEXT: ret i32 [[SEL]]
2985 store i32 %bad, ptr %a
2986 call void @scope_value_traversal_helper(ptr %a, i1 %c2)
2987 %l = load i32, ptr %a
2988 %sel = select i1 %c, i32 %bad, i32 %l
2992 define void @scope_value_traversal_helper(ptr %a, i1 %c) {
2993 ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite)
2994 ; TUNIT-LABEL: define {{[^@]+}}@scope_value_traversal_helper
2995 ; TUNIT-SAME: (ptr nocapture nofree noundef nonnull align 4 dereferenceable(4) [[A:%.*]], i1 [[C:%.*]]) #[[ATTR1]] {
2996 ; TUNIT-NEXT: [[L:%.*]] = load i32, ptr [[A]], align 4
2997 ; TUNIT-NEXT: [[SEL:%.*]] = select i1 [[C]], i32 [[L]], i32 42
2998 ; TUNIT-NEXT: store i32 [[SEL]], ptr [[A]], align 4
2999 ; TUNIT-NEXT: ret void
3001 ; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite)
3002 ; CGSCC-LABEL: define {{[^@]+}}@scope_value_traversal_helper
3003 ; CGSCC-SAME: (ptr nocapture nofree noundef nonnull align 4 dereferenceable(4) [[A:%.*]], i1 [[C:%.*]]) #[[ATTR13]] {
3004 ; CGSCC-NEXT: [[L:%.*]] = load i32, ptr [[A]], align 4
3005 ; CGSCC-NEXT: [[SEL:%.*]] = select i1 [[C]], i32 [[L]], i32 42
3006 ; CGSCC-NEXT: store i32 [[SEL]], ptr [[A]], align 4
3007 ; CGSCC-NEXT: ret void
3009 %l = load i32, ptr %a
3010 %sel = select i1 %c, i32 %l, i32 42
3011 store i32 %sel, ptr %a
3015 define i8 @gep_index_from_binary_operator(i1 %cnd1, i1 %cnd2) {
3016 ; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
3017 ; CHECK-LABEL: define {{[^@]+}}@gep_index_from_binary_operator
3018 ; CHECK-SAME: (i1 [[CND1:%.*]], i1 [[CND2:%.*]]) #[[ATTR4]] {
3019 ; CHECK-NEXT: entry:
3020 ; CHECK-NEXT: [[BYTES:%.*]] = alloca [1024 x i8], align 16
3021 ; CHECK-NEXT: [[GEP_FIXED:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 12
3022 ; CHECK-NEXT: ret i8 100
3025 %Bytes = alloca [1024 x i8], align 16
3026 %offset = add i64 5, 7
3027 %gep.fixed = getelementptr inbounds [1024 x i8], ptr %Bytes, i64 0, i64 12
3028 %gep.sum = getelementptr inbounds [1024 x i8], ptr %Bytes, i64 0, i64 %offset
3029 store i8 100, ptr %gep.fixed, align 4
3030 %i = load i8, ptr %gep.sum, align 4
3034 define i8 @gep_index_from_memory(i1 %cnd1, i1 %cnd2) {
3035 ; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
3036 ; CHECK-LABEL: define {{[^@]+}}@gep_index_from_memory
3037 ; CHECK-SAME: (i1 [[CND1:%.*]], i1 [[CND2:%.*]]) #[[ATTR4]] {
3038 ; CHECK-NEXT: entry:
3039 ; CHECK-NEXT: [[BYTES:%.*]] = alloca [1024 x i8], align 16
3040 ; CHECK-NEXT: [[GEP_LOADED:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 12
3041 ; CHECK-NEXT: ret i8 100
3044 %Bytes = alloca [1024 x i8], align 16
3045 %addr = alloca i64, align 16
3046 store i64 12, ptr %addr, align 8
3047 %offset = load i64, ptr %addr, align 8
3048 %gep.fixed = getelementptr inbounds [1024 x i8], ptr %Bytes, i64 0, i64 12
3050 %gep.loaded = getelementptr inbounds [1024 x i8], ptr %Bytes, i64 0, i64 %offset
3051 store i8 100, ptr %gep.loaded, align 4
3053 %i = load i8, ptr %gep.fixed, align 4
3057 @G = internal global i32 0, align 4
3059 ; Ensure this is not flattened to return 3
3060 define i32 @a(i1 %c) {
3061 ; TUNIT: Function Attrs: nofree nosync nounwind
3062 ; TUNIT-LABEL: define {{[^@]+}}@a
3063 ; TUNIT-SAME: (i1 noundef [[C:%.*]]) #[[ATTR14]] {
3064 ; TUNIT-NEXT: store i32 3, ptr @G, align 4
3065 ; TUNIT-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
3067 ; TUNIT-NEXT: [[REC:%.*]] = call i32 @a(i1 noundef false) #[[ATTR14]]
3068 ; TUNIT-NEXT: br label [[F]]
3070 ; TUNIT-NEXT: [[R:%.*]] = load i32, ptr @G, align 4
3071 ; TUNIT-NEXT: store i32 5, ptr @G, align 4
3072 ; TUNIT-NEXT: ret i32 [[R]]
3074 ; CGSCC: Function Attrs: nofree nosync nounwind
3075 ; CGSCC-LABEL: define {{[^@]+}}@a
3076 ; CGSCC-SAME: (i1 noundef [[C:%.*]]) #[[ATTR17]] {
3077 ; CGSCC-NEXT: store i32 3, ptr @G, align 4
3078 ; CGSCC-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
3080 ; CGSCC-NEXT: [[REC:%.*]] = call i32 @a(i1 noundef false) #[[ATTR17]]
3081 ; CGSCC-NEXT: br label [[F]]
3083 ; CGSCC-NEXT: [[R:%.*]] = load i32, ptr @G, align 4
3084 ; CGSCC-NEXT: store i32 5, ptr @G, align 4
3085 ; CGSCC-NEXT: ret i32 [[R]]
3088 br i1 %c, label %t, label %f
3091 %rec = call i32 @a(i1 false)
3095 %r = load i32, ptr @G
3100 @GC = internal global i32 undef, align 4
3101 define void @atomicrmw(ptr %p, i32 %i, i1 %cnd) {
3102 ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn
3103 ; TUNIT-LABEL: define {{[^@]+}}@atomicrmw
3104 ; TUNIT-SAME: (ptr nofree [[P:%.*]], i32 [[I:%.*]], i1 noundef [[CND:%.*]]) #[[ATTR3]] {
3105 ; TUNIT-NEXT: br i1 [[CND]], label [[T:%.*]], label [[M:%.*]]
3107 ; TUNIT-NEXT: br label [[M]]
3109 ; TUNIT-NEXT: [[ARMW:%.*]] = atomicrmw add ptr @GC, i32 [[I]] monotonic, align 4
3110 ; TUNIT-NEXT: ret void
3112 ; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn
3113 ; CGSCC-LABEL: define {{[^@]+}}@atomicrmw
3114 ; CGSCC-SAME: (ptr nofree [[P:%.*]], i32 [[I:%.*]], i1 noundef [[CND:%.*]]) #[[ATTR5]] {
3115 ; CGSCC-NEXT: br i1 [[CND]], label [[T:%.*]], label [[M:%.*]]
3117 ; CGSCC-NEXT: br label [[M]]
3119 ; CGSCC-NEXT: [[ARMW:%.*]] = atomicrmw add ptr @GC, i32 [[I]] monotonic, align 4
3120 ; CGSCC-NEXT: ret void
3122 %alloca = alloca <2 x ptr>
3123 %gep1 = getelementptr ptr, ptr %alloca, i32 0
3124 %gep2 = getelementptr ptr, ptr %alloca, i32 1
3125 store <2 x ptr> <ptr @GC, ptr @GC>, ptr %alloca
3126 br i1 %cnd, label %t, label %m
3128 store ptr null, ptr %gep2
3131 %l1 = load ptr, ptr %gep1
3132 %l2 = load ptr, ptr %gep2
3133 %c1 = icmp eq ptr %l2, %p
3134 call void @llvm.assume(i1 %c1)
3135 %s = select i1 true, ptr %l1, ptr %l2
3136 %armw = atomicrmw add ptr %s, i32 %i monotonic
3140 @GRS = internal thread_local global i32 undef
3141 @GRS2 = global i32 undef
3143 define i32 @recSimplify(i32 %v, i1 %cond) {
3144 ; TUNIT: Function Attrs: nofree nosync nounwind
3145 ; TUNIT-LABEL: define {{[^@]+}}@recSimplify
3146 ; TUNIT-SAME: (i32 [[V:%.*]], i1 noundef [[COND:%.*]]) #[[ATTR14]] {
3147 ; TUNIT-NEXT: br i1 [[COND]], label [[REC:%.*]], label [[COMP:%.*]]
3149 ; TUNIT-NEXT: [[RV:%.*]] = call i32 @recSimplify(i32 undef, i1 noundef false) #[[ATTR14]]
3150 ; TUNIT-NEXT: ret i32 1
3152 ; TUNIT-NEXT: store i32 1, ptr @GRS2, align 4
3153 ; TUNIT-NEXT: ret i32 1
3155 ; CGSCC: Function Attrs: nofree nosync nounwind
3156 ; CGSCC-LABEL: define {{[^@]+}}@recSimplify
3157 ; CGSCC-SAME: (i32 [[V:%.*]], i1 noundef [[COND:%.*]]) #[[ATTR17]] {
3158 ; CGSCC-NEXT: br i1 [[COND]], label [[REC:%.*]], label [[COMP:%.*]]
3160 ; CGSCC-NEXT: [[RV:%.*]] = call i32 @recSimplify(i32 [[V]], i1 noundef false) #[[ATTR17]]
3161 ; CGSCC-NEXT: ret i32 [[RV]]
3163 ; CGSCC-NEXT: store i32 [[V]], ptr @GRS, align 4
3164 ; CGSCC-NEXT: store i32 1, ptr @GRS2, align 4
3165 ; CGSCC-NEXT: [[L:%.*]] = load i32, ptr @GRS, align 4
3166 ; CGSCC-NEXT: [[C:%.*]] = icmp eq i32 [[L]], 1
3167 ; CGSCC-NEXT: call void @llvm.assume(i1 noundef [[C]]) #[[ATTR27:[0-9]+]]
3168 ; CGSCC-NEXT: [[R:%.*]] = call i32 @recSimplify2() #[[ATTR27]]
3169 ; CGSCC-NEXT: ret i32 [[R]]
3171 br i1 %cond, label %rec, label %comp
3173 %rv = call i32 @recSimplify(i32 %v, i1 false)
3176 store i32 %v, ptr @GRS
3177 %s1 = select i1 %cond, i32 1, i32 1
3178 %s2 = select i1 %cond, i32 1, i32 %s1
3179 store i32 %s2, ptr @GRS2
3180 %l = load i32, ptr @GRS
3181 %c = icmp eq i32 %l, %s2
3182 call void @llvm.assume(i1 %c)
3183 %r = call i32 @recSimplify2()
3187 define internal i32 @recSimplify2() {
3188 ; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read)
3189 ; CGSCC-LABEL: define {{[^@]+}}@recSimplify2
3190 ; CGSCC-SAME: () #[[ATTR7]] {
3191 ; CGSCC-NEXT: [[R:%.*]] = load i32, ptr @GRS, align 4
3192 ; CGSCC-NEXT: ret i32 [[R]]
3194 %r = load i32, ptr @GRS
3198 declare void @llvm.assume(i1 noundef)
3201 !llvm.module.flags = !{!0, !1}
3204 !0 = !{i32 1, !"wchar_size", i32 4}
3205 !1 = !{i32 7, !"uwtable", i32 1}
3206 !2 = !{!"clang version 13.0.0"}
3207 !3 = !{!4, !4, i64 0}
3208 !4 = !{!"int", !5, i64 0}
3209 !5 = !{!"omnipotent char", !6, i64 0}
3210 !6 = !{!"Simple C/C++ TBAA"}
3211 !7 = !{!8, !9, i64 12}
3212 !8 = !{!"S", !4, i64 0, !4, i64 4, !4, i64 8, !9, i64 12, !9, i64 16, !9, i64 20}
3213 !9 = !{!"float", !5, i64 0}
3214 !10 = !{!8, !9, i64 16}
3215 !11 = !{!8, !9, i64 20}
3216 !12 = !{!8, !4, i64 0}
3217 !13 = !{!8, !4, i64 4}
3218 !14 = !{!8, !4, i64 8}
3219 !15 = !{!5, !5, i64 0}
3220 !16 = distinct !{!16, !17}
3221 !17 = !{!"llvm.loop.mustprogress"}
3222 !18 = !{!9, !9, i64 0}
3223 !19 = distinct !{!19, !17}
3224 !20 = !{!21, !21, i64 0}
3225 !21 = !{!"long long", !5, i64 0}
3226 !22 = distinct !{!22, !17}
3227 !23 = distinct !{!23, !17}
3228 !24 = distinct !{!24, !17}
3229 !25 = distinct !{!25, !17}
3230 !26 = distinct !{!26, !17}
3231 !27 = distinct !{!27, !17}
3232 !28 = distinct !{!28, !17}
3233 !29 = distinct !{!29, !17}
3234 !30 = distinct !{!30, !17}
3235 !31 = distinct !{!31, !17}
3237 ; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) }
3238 ; TUNIT: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) }
3239 ; TUNIT: attributes #[[ATTR2:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
3240 ; TUNIT: attributes #[[ATTR3]] = { mustprogress nofree norecurse nosync nounwind willreturn }
3241 ; TUNIT: attributes #[[ATTR4]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
3242 ; TUNIT: attributes #[[ATTR5]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(write) }
3243 ; TUNIT: attributes #[[ATTR6]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(read) }
3244 ; TUNIT: attributes #[[ATTR7]] = { nofree norecurse nosync nounwind memory(write) }
3245 ; TUNIT: attributes #[[ATTR8:[0-9]+]] = { allockind("alloc,uninitialized") allocsize(0) "alloc-family"="malloc" }
3246 ; TUNIT: attributes #[[ATTR9:[0-9]+]] = { allockind("free") "alloc-family"="malloc" }
3247 ; TUNIT: attributes #[[ATTR10:[0-9]+]] = { allockind("alloc,zeroed") allocsize(0,1) "alloc-family"="malloc" }
3248 ; TUNIT: attributes #[[ATTR11]] = { mustprogress nofree norecurse nosync nounwind willreturn uwtable }
3249 ; TUNIT: attributes #[[ATTR12]] = { nofree nosync nounwind memory(argmem: readwrite) }
3250 ; TUNIT: attributes #[[ATTR13]] = { nofree norecurse nosync nounwind memory(none) }
3251 ; TUNIT: attributes #[[ATTR14]] = { nofree nosync nounwind }
3252 ; TUNIT: attributes #[[ATTR15:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
3253 ; TUNIT: attributes #[[ATTR16:[0-9]+]] = { nocallback nofree nounwind willreturn memory(argmem: write) }
3254 ; TUNIT: attributes #[[ATTR17]] = { nofree willreturn }
3255 ; TUNIT: attributes #[[ATTR18]] = { nofree nosync nounwind willreturn memory(write) }
3256 ; TUNIT: attributes #[[ATTR19]] = { nocallback }
3257 ; TUNIT: attributes #[[ATTR20]] = { norecurse }
3258 ; TUNIT: attributes #[[ATTR21]] = { nounwind }
3259 ; TUNIT: attributes #[[ATTR22]] = { nofree nosync nounwind willreturn }
3261 ; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) }
3262 ; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree nosync nounwind willreturn memory(argmem: readwrite) }
3263 ; CGSCC: attributes #[[ATTR2:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
3264 ; CGSCC: attributes #[[ATTR3]] = { mustprogress nofree nosync nounwind willreturn }
3265 ; CGSCC: attributes #[[ATTR4]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
3266 ; CGSCC: attributes #[[ATTR5]] = { mustprogress nofree norecurse nosync nounwind willreturn }
3267 ; CGSCC: attributes #[[ATTR6]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(write) }
3268 ; CGSCC: attributes #[[ATTR7]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(read) }
3269 ; CGSCC: attributes #[[ATTR8]] = { nofree norecurse nosync nounwind memory(write) }
3270 ; CGSCC: attributes #[[ATTR9:[0-9]+]] = { allockind("alloc,uninitialized") allocsize(0) "alloc-family"="malloc" }
3271 ; CGSCC: attributes #[[ATTR10:[0-9]+]] = { allockind("free") "alloc-family"="malloc" }
3272 ; CGSCC: attributes #[[ATTR11:[0-9]+]] = { allockind("alloc,zeroed") allocsize(0,1) "alloc-family"="malloc" }
3273 ; CGSCC: attributes #[[ATTR12]] = { mustprogress nofree norecurse nosync nounwind willreturn uwtable }
3274 ; CGSCC: attributes #[[ATTR13]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) }
3275 ; CGSCC: attributes #[[ATTR14]] = { nofree nosync nounwind memory(argmem: readwrite) }
3276 ; CGSCC: attributes #[[ATTR15]] = { nofree nosync nounwind memory(none) }
3277 ; CGSCC: attributes #[[ATTR16]] = { mustprogress nofree nosync nounwind willreturn memory(none) }
3278 ; CGSCC: attributes #[[ATTR17]] = { nofree nosync nounwind }
3279 ; CGSCC: attributes #[[ATTR18:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
3280 ; CGSCC: attributes #[[ATTR19:[0-9]+]] = { nocallback nofree nounwind willreturn memory(argmem: write) }
3281 ; CGSCC: attributes #[[ATTR20]] = { nofree willreturn }
3282 ; CGSCC: attributes #[[ATTR21]] = { nofree nounwind willreturn memory(write) }
3283 ; CGSCC: attributes #[[ATTR22]] = { nocallback }
3284 ; CGSCC: attributes #[[ATTR23]] = { norecurse }
3285 ; CGSCC: attributes #[[ATTR24]] = { nounwind }
3286 ; CGSCC: attributes #[[ATTR25]] = { nofree nounwind }
3287 ; CGSCC: attributes #[[ATTR26]] = { nofree nounwind willreturn }
3288 ; CGSCC: attributes #[[ATTR27]] = { nofree }
3290 ; TUNIT: [[META0:![0-9]+]] = !{i32 1, !"wchar_size", i32 4}
3291 ; TUNIT: [[META1:![0-9]+]] = !{i32 7, !"uwtable", i32 1}
3292 ; TUNIT: [[META2:![0-9]+]] = !{!"{{.*}}clang version {{.*}}"}
3293 ; TUNIT: [[TBAA3]] = !{[[META4:![0-9]+]], [[META4]], i64 0}
3294 ; TUNIT: [[META4]] = !{!"int", [[META5:![0-9]+]], i64 0}
3295 ; TUNIT: [[META5]] = !{!"omnipotent char", [[META6:![0-9]+]], i64 0}
3296 ; TUNIT: [[META6]] = !{!"Simple C/C++ TBAA"}
3297 ; TUNIT: [[TBAA7]] = !{[[META8:![0-9]+]], [[META9:![0-9]+]], i64 12}
3298 ; TUNIT: [[META8]] = !{!"S", [[META4]], i64 0, [[META4]], i64 4, [[META4]], i64 8, [[META9]], i64 12, [[META9]], i64 16, [[META9]], i64 20}
3299 ; TUNIT: [[META9]] = !{!"float", [[META5]], i64 0}
3300 ; TUNIT: [[TBAA10]] = !{[[META8]], [[META9]], i64 16}
3301 ; TUNIT: [[TBAA11]] = !{[[META8]], [[META9]], i64 20}
3302 ; TUNIT: [[TBAA12]] = !{[[META8]], [[META4]], i64 0}
3303 ; TUNIT: [[TBAA13]] = !{[[META8]], [[META4]], i64 4}
3304 ; TUNIT: [[TBAA14]] = !{[[META8]], [[META4]], i64 8}
3305 ; TUNIT: [[LOOP15]] = distinct !{[[LOOP15]], [[META16:![0-9]+]]}
3306 ; TUNIT: [[META16]] = !{!"llvm.loop.mustprogress"}
3307 ; TUNIT: [[LOOP17]] = distinct !{[[LOOP17]], [[META16]]}
3308 ; TUNIT: [[LOOP18]] = distinct !{[[LOOP18]], [[META16]]}
3309 ; TUNIT: [[TBAA19]] = !{[[META5]], [[META5]], i64 0}
3310 ; TUNIT: [[LOOP20]] = distinct !{[[LOOP20]], [[META16]]}
3311 ; TUNIT: [[LOOP21]] = distinct !{[[LOOP21]], [[META16]]}
3312 ; TUNIT: [[LOOP22]] = distinct !{[[LOOP22]], [[META16]]}
3313 ; TUNIT: [[LOOP23]] = distinct !{[[LOOP23]], [[META16]]}
3314 ; TUNIT: [[LOOP24]] = distinct !{[[LOOP24]], [[META16]]}
3315 ; TUNIT: [[LOOP25]] = distinct !{[[LOOP25]], [[META16]]}
3316 ; TUNIT: [[TBAA26]] = !{[[META9]], [[META9]], i64 0}
3317 ; TUNIT: [[LOOP27]] = distinct !{[[LOOP27]], [[META16]]}
3318 ; TUNIT: [[TBAA28]] = !{[[META29:![0-9]+]], [[META29]], i64 0}
3319 ; TUNIT: [[META29]] = !{!"long long", [[META5]], i64 0}
3320 ; TUNIT: [[LOOP30]] = distinct !{[[LOOP30]], [[META16]]}
3321 ; TUNIT: [[LOOP31]] = distinct !{[[LOOP31]], [[META16]]}
3323 ; CGSCC: [[META0:![0-9]+]] = !{i32 1, !"wchar_size", i32 4}
3324 ; CGSCC: [[META1:![0-9]+]] = !{i32 7, !"uwtable", i32 1}
3325 ; CGSCC: [[META2:![0-9]+]] = !{!"{{.*}}clang version {{.*}}"}
3326 ; CGSCC: [[TBAA3]] = !{[[META4:![0-9]+]], [[META4]], i64 0}
3327 ; CGSCC: [[META4]] = !{!"int", [[META5:![0-9]+]], i64 0}
3328 ; CGSCC: [[META5]] = !{!"omnipotent char", [[META6:![0-9]+]], i64 0}
3329 ; CGSCC: [[META6]] = !{!"Simple C/C++ TBAA"}
3330 ; CGSCC: [[TBAA7]] = !{[[META8:![0-9]+]], [[META9:![0-9]+]], i64 12}
3331 ; CGSCC: [[META8]] = !{!"S", [[META4]], i64 0, [[META4]], i64 4, [[META4]], i64 8, [[META9]], i64 12, [[META9]], i64 16, [[META9]], i64 20}
3332 ; CGSCC: [[META9]] = !{!"float", [[META5]], i64 0}
3333 ; CGSCC: [[TBAA10]] = !{[[META8]], [[META9]], i64 16}
3334 ; CGSCC: [[TBAA11]] = !{[[META8]], [[META9]], i64 20}
3335 ; CGSCC: [[TBAA12]] = !{[[META8]], [[META4]], i64 0}
3336 ; CGSCC: [[TBAA13]] = !{[[META8]], [[META4]], i64 4}
3337 ; CGSCC: [[TBAA14]] = !{[[META8]], [[META4]], i64 8}
3338 ; CGSCC: [[TBAA15]] = !{[[META5]], [[META5]], i64 0}
3339 ; CGSCC: [[LOOP16]] = distinct !{[[LOOP16]], [[META17:![0-9]+]]}
3340 ; CGSCC: [[META17]] = !{!"llvm.loop.mustprogress"}
3341 ; CGSCC: [[TBAA18]] = !{[[META9]], [[META9]], i64 0}
3342 ; CGSCC: [[LOOP19]] = distinct !{[[LOOP19]], [[META17]]}
3343 ; CGSCC: [[TBAA20]] = !{[[META21:![0-9]+]], [[META21]], i64 0}
3344 ; CGSCC: [[META21]] = !{!"long long", [[META5]], i64 0}
3345 ; CGSCC: [[LOOP22]] = distinct !{[[LOOP22]], [[META17]]}
3346 ; CGSCC: [[LOOP23]] = distinct !{[[LOOP23]], [[META17]]}
3347 ; CGSCC: [[LOOP24]] = distinct !{[[LOOP24]], [[META17]]}
3348 ; CGSCC: [[LOOP25]] = distinct !{[[LOOP25]], [[META17]]}
3349 ; CGSCC: [[LOOP26]] = distinct !{[[LOOP26]], [[META17]]}
3350 ; CGSCC: [[LOOP27]] = distinct !{[[LOOP27]], [[META17]]}
3351 ; CGSCC: [[LOOP28]] = distinct !{[[LOOP28]], [[META17]]}
3352 ; CGSCC: [[LOOP29]] = distinct !{[[LOOP29]], [[META17]]}
3353 ; CGSCC: [[LOOP30]] = distinct !{[[LOOP30]], [[META17]]}
3354 ; CGSCC: [[LOOP31]] = distinct !{[[LOOP31]], [[META17]]}