1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=loop-idiom < %s -S | FileCheck %s
4 %struct.S = type { i32, i32, i8 }
6 ; unsigned copy_noalias(S* __restrict a, S *b, int n) {
7 ; for (int i = 0; i < n; i++) {
10 ; return sizeof(a[0]);
13 ; Function Attrs: nofree nounwind uwtable mustprogress
14 define dso_local i32 @copy_noalias(ptr noalias nocapture %a, ptr nocapture readonly %b, i32 %n) local_unnamed_addr {
15 ; CHECK-LABEL: @copy_noalias(
17 ; CHECK-NEXT: [[CMP7:%.*]] = icmp sgt i32 [[N:%.*]], 0
18 ; CHECK-NEXT: br i1 [[CMP7]], label [[FOR_BODY_PREHEADER:%.*]], label [[FOR_COND_CLEANUP:%.*]]
19 ; CHECK: for.body.preheader:
20 ; CHECK-NEXT: [[TMP0:%.*]] = zext i32 [[N]] to i64
21 ; CHECK-NEXT: [[TMP1:%.*]] = mul nuw nsw i64 [[TMP0]], 12
22 ; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[A:%.*]], ptr align 4 [[B:%.*]], i64 [[TMP1]], i1 false)
23 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
24 ; CHECK: for.cond.cleanup.loopexit:
25 ; CHECK-NEXT: br label [[FOR_COND_CLEANUP]]
26 ; CHECK: for.cond.cleanup:
27 ; CHECK-NEXT: ret i32 12
29 ; CHECK-NEXT: [[I_08:%.*]] = phi i32 [ [[INC:%.*]], [[FOR_BODY]] ], [ 0, [[FOR_BODY_PREHEADER]] ]
30 ; CHECK-NEXT: [[IDXPROM:%.*]] = zext i32 [[I_08]] to i64
31 ; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [[STRUCT_S:%.*]], ptr [[B]], i64 [[IDXPROM]]
32 ; CHECK-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[A]], i64 [[IDXPROM]]
33 ; CHECK-NEXT: [[INC]] = add nuw nsw i32 [[I_08]], 1
34 ; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[INC]], [[N]]
35 ; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[FOR_COND_CLEANUP_LOOPEXIT:%.*]]
38 %cmp7 = icmp sgt i32 %n, 0
39 br i1 %cmp7, label %for.body.preheader, label %for.cond.cleanup
41 for.body.preheader: ; preds = %entry
44 for.cond.cleanup.loopexit: ; preds = %for.body
45 br label %for.cond.cleanup
47 for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry
50 for.body: ; preds = %for.body, %for.body.preheader
51 %i.08 = phi i32 [ %inc, %for.body ], [ 0, %for.body.preheader ]
52 %idxprom = zext i32 %i.08 to i64
53 %arrayidx = getelementptr inbounds %struct.S, ptr %b, i64 %idxprom
54 %arrayidx2 = getelementptr inbounds %struct.S, ptr %a, i64 %idxprom
55 call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 4 dereferenceable(12) %arrayidx2, ptr nonnull align 4 dereferenceable(12) %arrayidx, i64 12, i1 false)
56 %inc = add nuw nsw i32 %i.08, 1
57 %cmp = icmp slt i32 %inc, %n
58 br i1 %cmp, label %for.body, label %for.cond.cleanup.loopexit
61 ; unsigned copy_may_alias(S *a, S *b, int n) {
62 ; for (int i = 0; i < n; i++) {
65 ; return sizeof(a[0]);
68 ; Function Attrs: nofree nounwind uwtable mustprogress
69 define dso_local i32 @copy_may_alias(ptr nocapture %a, ptr nocapture readonly %b, i32 %n) local_unnamed_addr {
70 ; CHECK-LABEL: @copy_may_alias(
72 ; CHECK-NEXT: [[CMP7:%.*]] = icmp sgt i32 [[N:%.*]], 0
73 ; CHECK-NEXT: br i1 [[CMP7]], label [[FOR_BODY_PREHEADER:%.*]], label [[FOR_COND_CLEANUP:%.*]]
74 ; CHECK: for.body.preheader:
75 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
76 ; CHECK: for.cond.cleanup.loopexit:
77 ; CHECK-NEXT: br label [[FOR_COND_CLEANUP]]
78 ; CHECK: for.cond.cleanup:
79 ; CHECK-NEXT: ret i32 12
81 ; CHECK-NEXT: [[I_08:%.*]] = phi i32 [ [[INC:%.*]], [[FOR_BODY]] ], [ 0, [[FOR_BODY_PREHEADER]] ]
82 ; CHECK-NEXT: [[IDXPROM:%.*]] = zext i32 [[I_08]] to i64
83 ; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [[STRUCT_S:%.*]], ptr [[B:%.*]], i64 [[IDXPROM]]
84 ; CHECK-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[A:%.*]], i64 [[IDXPROM]]
85 ; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 4 dereferenceable(12) [[ARRAYIDX2]], ptr nonnull align 4 dereferenceable(12) [[ARRAYIDX]], i64 12, i1 false)
86 ; CHECK-NEXT: [[INC]] = add nuw nsw i32 [[I_08]], 1
87 ; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[INC]], [[N]]
88 ; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[FOR_COND_CLEANUP_LOOPEXIT:%.*]]
91 %cmp7 = icmp sgt i32 %n, 0
92 br i1 %cmp7, label %for.body.preheader, label %for.cond.cleanup
94 for.body.preheader: ; preds = %entry
97 for.cond.cleanup.loopexit: ; preds = %for.body
98 br label %for.cond.cleanup
100 for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry
103 for.body: ; preds = %for.body, %for.body.preheader
104 %i.08 = phi i32 [ %inc, %for.body ], [ 0, %for.body.preheader ]
105 %idxprom = zext i32 %i.08 to i64
106 %arrayidx = getelementptr inbounds %struct.S, ptr %b, i64 %idxprom
107 %arrayidx2 = getelementptr inbounds %struct.S, ptr %a, i64 %idxprom
108 call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 4 dereferenceable(12) %arrayidx2, ptr nonnull align 4 dereferenceable(12) %arrayidx, i64 12, i1 false)
109 %inc = add nuw nsw i32 %i.08, 1
110 %cmp = icmp slt i32 %inc, %n
111 br i1 %cmp, label %for.body, label %for.cond.cleanup.loopexit
114 %struct.R = type <{ i8, i32, i8 }>
116 ; void copy_noalias_read(S* __restrict x, S* __restrict y, int n, int &s) {
117 ; for (int i = 0; i < n; i++) {
123 ; Function Attrs: nofree nounwind uwtable mustprogress
124 define dso_local void @copy_noalias_read(ptr noalias nocapture %x, ptr noalias nocapture readonly %y, i32 %n, ptr nocapture nonnull align 4 dereferenceable(4) %s) local_unnamed_addr {
125 ; CHECK-LABEL: @copy_noalias_read(
127 ; CHECK-NEXT: [[CMP11:%.*]] = icmp sgt i32 [[N:%.*]], 0
128 ; CHECK-NEXT: br i1 [[CMP11]], label [[FOR_BODY_LR_PH:%.*]], label [[FOR_COND_CLEANUP:%.*]]
129 ; CHECK: for.body.lr.ph:
130 ; CHECK-NEXT: [[S_PROMOTED:%.*]] = load i32, ptr [[S:%.*]], align 4
131 ; CHECK-NEXT: [[TMP0:%.*]] = zext i32 [[N]] to i64
132 ; CHECK-NEXT: [[TMP1:%.*]] = mul nuw nsw i64 [[TMP0]], 6
133 ; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 [[X:%.*]], ptr align 1 [[Y:%.*]], i64 [[TMP1]], i1 false)
134 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
135 ; CHECK: for.cond.for.cond.cleanup_crit_edge:
136 ; CHECK-NEXT: [[ADD_LCSSA:%.*]] = phi i32 [ [[ADD:%.*]], [[FOR_BODY]] ]
137 ; CHECK-NEXT: store i32 [[ADD_LCSSA]], ptr [[S]], align 4
138 ; CHECK-NEXT: br label [[FOR_COND_CLEANUP]]
139 ; CHECK: for.cond.cleanup:
140 ; CHECK-NEXT: ret void
142 ; CHECK-NEXT: [[ADD13:%.*]] = phi i32 [ [[S_PROMOTED]], [[FOR_BODY_LR_PH]] ], [ [[ADD]], [[FOR_BODY]] ]
143 ; CHECK-NEXT: [[I_012:%.*]] = phi i32 [ 0, [[FOR_BODY_LR_PH]] ], [ [[INC:%.*]], [[FOR_BODY]] ]
144 ; CHECK-NEXT: [[IDXPROM:%.*]] = zext i32 [[I_012]] to i64
145 ; CHECK-NEXT: [[I:%.*]] = getelementptr inbounds [[STRUCT_R:%.*]], ptr [[X]], i64 [[IDXPROM]], i32 0
146 ; CHECK-NEXT: [[I1:%.*]] = getelementptr inbounds [[STRUCT_R]], ptr [[Y]], i64 [[IDXPROM]], i32 0
147 ; CHECK-NEXT: [[B:%.*]] = getelementptr inbounds [[STRUCT_R]], ptr [[Y]], i64 [[IDXPROM]], i32 1
148 ; CHECK-NEXT: [[I2:%.*]] = load i32, ptr [[B]], align 1
149 ; CHECK-NEXT: [[ADD]] = add nsw i32 [[ADD13]], [[I2]]
150 ; CHECK-NEXT: [[INC]] = add nuw nsw i32 [[I_012]], 1
151 ; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[INC]], [[N]]
152 ; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[FOR_COND_FOR_COND_CLEANUP_CRIT_EDGE:%.*]]
155 %cmp11 = icmp sgt i32 %n, 0
156 br i1 %cmp11, label %for.body.lr.ph, label %for.cond.cleanup
158 for.body.lr.ph: ; preds = %entry
159 %s.promoted = load i32, ptr %s, align 4
162 for.cond.for.cond.cleanup_crit_edge: ; preds = %for.body
163 %add.lcssa = phi i32 [ %add, %for.body ]
164 store i32 %add.lcssa, ptr %s, align 4
165 br label %for.cond.cleanup
167 for.cond.cleanup: ; preds = %for.cond.for.cond.cleanup_crit_edge, %entry
170 for.body: ; preds = %for.body, %for.body.lr.ph
171 %add13 = phi i32 [ %s.promoted, %for.body.lr.ph ], [ %add, %for.body ]
172 %i.012 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.body ]
173 %idxprom = zext i32 %i.012 to i64
174 %i = getelementptr inbounds %struct.R, ptr %x, i64 %idxprom, i32 0
175 %i1 = getelementptr inbounds %struct.R, ptr %y, i64 %idxprom, i32 0
176 call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 dereferenceable(6) %i, ptr nonnull align 1 dereferenceable(6) %i1, i64 6, i1 false)
177 %b = getelementptr inbounds %struct.R, ptr %y, i64 %idxprom, i32 1
178 %i2 = load i32, ptr %b, align 1
179 %add = add nsw i32 %add13, %i2
180 %inc = add nuw nsw i32 %i.012, 1
181 %cmp = icmp slt i32 %inc, %n
182 br i1 %cmp, label %for.body, label %for.cond.for.cond.cleanup_crit_edge
185 ; unsigned copy_noalias_negative_stride(S* __restrict__ a, S* b, int n) {
186 ; for (int i = n; i >= 0; i--) {
189 ; return sizeof(a[0]);
192 ; Function Attrs: nofree nosync nounwind uwtable mustprogress
193 define dso_local i32 @copy_noalias_negative_stride(ptr noalias nocapture %arg, ptr nocapture readonly %arg1, i32 %arg2) local_unnamed_addr {
194 ; CHECK-LABEL: @copy_noalias_negative_stride(
196 ; CHECK-NEXT: [[I:%.*]] = icmp sgt i32 [[ARG2:%.*]], -1
197 ; CHECK-NEXT: br i1 [[I]], label [[BB3:%.*]], label [[BB5:%.*]]
199 ; CHECK-NEXT: [[TMP0:%.*]] = add i32 [[ARG2]], 1
200 ; CHECK-NEXT: [[TMP1:%.*]] = zext i32 [[TMP0]] to i64
201 ; CHECK-NEXT: [[TMP2:%.*]] = mul nuw nsw i64 [[TMP1]], 12
202 ; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[ARG:%.*]], ptr align 4 [[ARG1:%.*]], i64 [[TMP2]], i1 false)
203 ; CHECK-NEXT: br label [[BB6:%.*]]
205 ; CHECK-NEXT: br label [[BB5]]
207 ; CHECK-NEXT: ret i32 12
209 ; CHECK-NEXT: [[I7:%.*]] = phi i32 [ [[I13:%.*]], [[BB6]] ], [ [[ARG2]], [[BB3]] ]
210 ; CHECK-NEXT: [[I8:%.*]] = zext i32 [[I7]] to i64
211 ; CHECK-NEXT: [[I9:%.*]] = getelementptr inbounds [[STRUCT_S:%.*]], ptr [[ARG1]], i64 [[I8]]
212 ; CHECK-NEXT: [[I10:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[ARG]], i64 [[I8]]
213 ; CHECK-NEXT: [[I13]] = add nsw i32 [[I7]], -1
214 ; CHECK-NEXT: [[I14:%.*]] = icmp sgt i32 [[I7]], 0
215 ; CHECK-NEXT: br i1 [[I14]], label [[BB6]], label [[BB4:%.*]]
218 %i = icmp sgt i32 %arg2, -1
219 br i1 %i, label %bb3, label %bb5
227 bb5: ; preds = %bb4, %bb
230 bb6: ; preds = %bb6, %bb3
231 %i7 = phi i32 [ %i13, %bb6 ], [ %arg2, %bb3 ]
232 %i8 = zext i32 %i7 to i64
233 %i9 = getelementptr inbounds %struct.S, ptr %arg1, i64 %i8
234 %i10 = getelementptr inbounds %struct.S, ptr %arg, i64 %i8
235 tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %i10, ptr noundef nonnull align 4 dereferenceable(12) %i9, i64 12, i1 false)
236 %i13 = add nsw i32 %i7, -1
237 %i14 = icmp sgt i32 %i7, 0
238 br i1 %i14, label %bb6, label %bb4
241 ; unsigned copy_noalias_opposite_stride(S* __restrict__ a, S* b, int n) {
242 ; for (int i = 0, j = n; i < n && j >= 0; i++, j--) {
245 ; return sizeof(a[0]);
248 ; Function Attrs: nofree nosync nounwind uwtable mustprogress
249 define dso_local i32 @copy_noalias_opposite_stride(ptr noalias nocapture %arg, ptr nocapture readonly %arg1, i32 %arg2) local_unnamed_addr {
250 ; CHECK-LABEL: @copy_noalias_opposite_stride(
252 ; CHECK-NEXT: [[I:%.*]] = icmp sgt i32 [[ARG2:%.*]], 0
253 ; CHECK-NEXT: br i1 [[I]], label [[BB3:%.*]], label [[BB5:%.*]]
255 ; CHECK-NEXT: br label [[BB6:%.*]]
257 ; CHECK-NEXT: br label [[BB5]]
259 ; CHECK-NEXT: ret i32 12
261 ; CHECK-NEXT: [[I7:%.*]] = phi i32 [ [[I16:%.*]], [[BB6]] ], [ [[ARG2]], [[BB3]] ]
262 ; CHECK-NEXT: [[I8:%.*]] = phi i32 [ [[I15:%.*]], [[BB6]] ], [ 0, [[BB3]] ]
263 ; CHECK-NEXT: [[I9:%.*]] = zext i32 [[I7]] to i64
264 ; CHECK-NEXT: [[I10:%.*]] = getelementptr inbounds [[STRUCT_S:%.*]], ptr [[ARG1:%.*]], i64 [[I9]]
265 ; CHECK-NEXT: [[I11:%.*]] = zext i32 [[I8]] to i64
266 ; CHECK-NEXT: [[I12:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[ARG:%.*]], i64 [[I11]]
267 ; CHECK-NEXT: tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) [[I12]], ptr noundef nonnull align 4 dereferenceable(12) [[I10]], i64 12, i1 false)
268 ; CHECK-NEXT: [[I15]] = add nuw nsw i32 [[I8]], 1
269 ; CHECK-NEXT: [[I16]] = add nsw i32 [[I7]], -1
270 ; CHECK-NEXT: [[I17:%.*]] = icmp slt i32 [[I15]], [[ARG2]]
271 ; CHECK-NEXT: [[I18:%.*]] = icmp sgt i32 [[I7]], 0
272 ; CHECK-NEXT: [[I19:%.*]] = and i1 [[I17]], [[I18]]
273 ; CHECK-NEXT: br i1 [[I19]], label [[BB6]], label [[BB4:%.*]]
276 %i = icmp sgt i32 %arg2, 0
277 br i1 %i, label %bb3, label %bb5
285 bb5: ; preds = %bb4, %bb
288 bb6: ; preds = %bb6, %bb3
289 %i7 = phi i32 [ %i16, %bb6 ], [ %arg2, %bb3 ]
290 %i8 = phi i32 [ %i15, %bb6 ], [ 0, %bb3 ]
291 %i9 = zext i32 %i7 to i64
292 %i10 = getelementptr inbounds %struct.S, ptr %arg1, i64 %i9
293 %i11 = zext i32 %i8 to i64
294 %i12 = getelementptr inbounds %struct.S, ptr %arg, i64 %i11
295 tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %i12, ptr noundef nonnull align 4 dereferenceable(12) %i10, i64 12, i1 false)
296 %i15 = add nuw nsw i32 %i8, 1
297 %i16 = add nsw i32 %i7, -1
298 %i17 = icmp slt i32 %i15, %arg2
299 %i18 = icmp sgt i32 %i7, 0
300 %i19 = and i1 %i17, %i18
301 br i1 %i19, label %bb6, label %bb4
304 %struct.SPacked = type <{ i32, i32, i8 }>
306 ; Function Attrs: nofree nounwind uwtable mustprogress
307 define dso_local i32 @copy_noalias_packed(ptr noalias nocapture %a, ptr nocapture readonly %b, i32 %n) local_unnamed_addr {
308 ; CHECK-LABEL: @copy_noalias_packed(
310 ; CHECK-NEXT: [[CMP7:%.*]] = icmp sgt i32 [[N:%.*]], 0
311 ; CHECK-NEXT: br i1 [[CMP7]], label [[FOR_BODY_PREHEADER:%.*]], label [[FOR_COND_CLEANUP:%.*]]
312 ; CHECK: for.body.preheader:
313 ; CHECK-NEXT: [[TMP0:%.*]] = zext i32 [[N]] to i64
314 ; CHECK-NEXT: [[TMP1:%.*]] = mul nuw nsw i64 [[TMP0]], 9
315 ; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 [[A:%.*]], ptr align 1 [[B:%.*]], i64 [[TMP1]], i1 false)
316 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
317 ; CHECK: for.cond.cleanup.loopexit:
318 ; CHECK-NEXT: br label [[FOR_COND_CLEANUP]]
319 ; CHECK: for.cond.cleanup:
320 ; CHECK-NEXT: ret i32 9
322 ; CHECK-NEXT: [[I_08:%.*]] = phi i32 [ [[INC:%.*]], [[FOR_BODY]] ], [ 0, [[FOR_BODY_PREHEADER]] ]
323 ; CHECK-NEXT: [[IDXPROM:%.*]] = zext i32 [[I_08]] to i64
324 ; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [[STRUCT_SPACKED:%.*]], ptr [[B]], i64 [[IDXPROM]]
325 ; CHECK-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds [[STRUCT_SPACKED]], ptr [[A]], i64 [[IDXPROM]]
326 ; CHECK-NEXT: [[INC]] = add nuw nsw i32 [[I_08]], 1
327 ; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[INC]], [[N]]
328 ; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[FOR_COND_CLEANUP_LOOPEXIT:%.*]]
331 %cmp7 = icmp sgt i32 %n, 0
332 br i1 %cmp7, label %for.body.preheader, label %for.cond.cleanup
334 for.body.preheader: ; preds = %entry
337 for.cond.cleanup.loopexit: ; preds = %for.body
338 br label %for.cond.cleanup
340 for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry
343 for.body: ; preds = %for.body, %for.body.preheader
344 %i.08 = phi i32 [ %inc, %for.body ], [ 0, %for.body.preheader ]
345 %idxprom = zext i32 %i.08 to i64
346 %arrayidx = getelementptr inbounds %struct.SPacked, ptr %b, i64 %idxprom
347 %arrayidx2 = getelementptr inbounds %struct.SPacked, ptr %a, i64 %idxprom
348 call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 dereferenceable(9) %arrayidx2, ptr nonnull align 1 dereferenceable(9) %arrayidx, i64 9, i1 false)
349 %inc = add nuw nsw i32 %i.08, 1
350 %cmp = icmp slt i32 %inc, %n
351 br i1 %cmp, label %for.body, label %for.cond.cleanup.loopexit
354 %struct.SAligned = type { i32, i32, i8, [7 x i8] }
356 define dso_local i32 @copy_noalias_aligned(ptr noalias nocapture %a, ptr nocapture readonly %b, i32 %n) local_unnamed_addr {
357 ; CHECK-LABEL: @copy_noalias_aligned(
359 ; CHECK-NEXT: [[CMP7:%.*]] = icmp sgt i32 [[N:%.*]], 0
360 ; CHECK-NEXT: br i1 [[CMP7]], label [[FOR_BODY_PREHEADER:%.*]], label [[FOR_COND_CLEANUP:%.*]]
361 ; CHECK: for.body.preheader:
362 ; CHECK-NEXT: [[TMP0:%.*]] = zext i32 [[N]] to i64
363 ; CHECK-NEXT: [[TMP1:%.*]] = shl nuw nsw i64 [[TMP0]], 4
364 ; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 16 [[A:%.*]], ptr align 16 [[B:%.*]], i64 [[TMP1]], i1 false)
365 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
366 ; CHECK: for.cond.cleanup.loopexit:
367 ; CHECK-NEXT: br label [[FOR_COND_CLEANUP]]
368 ; CHECK: for.cond.cleanup:
369 ; CHECK-NEXT: ret i32 16
371 ; CHECK-NEXT: [[I_08:%.*]] = phi i32 [ [[INC:%.*]], [[FOR_BODY]] ], [ 0, [[FOR_BODY_PREHEADER]] ]
372 ; CHECK-NEXT: [[IDXPROM:%.*]] = zext i32 [[I_08]] to i64
373 ; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [[STRUCT_SALIGNED:%.*]], ptr [[B]], i64 [[IDXPROM]]
374 ; CHECK-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds [[STRUCT_SALIGNED]], ptr [[A]], i64 [[IDXPROM]]
375 ; CHECK-NEXT: [[INC]] = add nuw nsw i32 [[I_08]], 1
376 ; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[INC]], [[N]]
377 ; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[FOR_COND_CLEANUP_LOOPEXIT:%.*]]
380 %cmp7 = icmp sgt i32 %n, 0
381 br i1 %cmp7, label %for.body.preheader, label %for.cond.cleanup
383 for.body.preheader: ; preds = %entry
386 for.cond.cleanup.loopexit: ; preds = %for.body
387 br label %for.cond.cleanup
389 for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry
392 for.body: ; preds = %for.body, %for.body.preheader
393 %i.08 = phi i32 [ %inc, %for.body ], [ 0, %for.body.preheader ]
394 %idxprom = zext i32 %i.08 to i64
395 %arrayidx = getelementptr inbounds %struct.SAligned, ptr %b, i64 %idxprom
396 %arrayidx2 = getelementptr inbounds %struct.SAligned, ptr %a, i64 %idxprom
397 call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 dereferenceable(16) %arrayidx2, ptr nonnull align 16 dereferenceable(16) %arrayidx, i64 16, i1 false)
398 %inc = add nuw nsw i32 %i.08, 1
399 %cmp = icmp slt i32 %inc, %n
400 br i1 %cmp, label %for.body, label %for.cond.cleanup.loopexit
403 ; Function Attrs: argmemonly nofree nosync nounwind willreturn
404 declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1