1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -S -passes='indvars' -verify-loop-info -verify-dom-info -verify-scev | FileCheck %s
4 target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
6 ; Simple case of direct extend of index
7 ; --------------------------------------
9 define void @sext_no_offset(ptr %A, i32 %M) {
10 ; CHECK-LABEL: @sext_no_offset(
12 ; CHECK-NEXT: [[SMAX:%.*]] = call i32 @llvm.smax.i32(i32 [[M:%.*]], i32 1)
13 ; CHECK-NEXT: [[WIDE_TRIP_COUNT:%.*]] = zext i32 [[SMAX]] to i64
14 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
16 ; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ], [ 0, [[ENTRY:%.*]] ]
17 ; CHECK-NEXT: [[ARRAYIDX_US:%.*]] = getelementptr inbounds i32, ptr [[A:%.*]], i64 [[INDVARS_IV]]
18 ; CHECK-NEXT: tail call void @use_ptr(ptr [[ARRAYIDX_US]])
19 ; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
20 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV_NEXT]], [[WIDE_TRIP_COUNT]]
21 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY]], label [[EXIT:%.*]]
23 ; CHECK-NEXT: ret void
29 %j.016.us = phi i32 [ 0, %entry ], [ %inc.us, %for.body ]
30 %idxprom.us = sext i32 %j.016.us to i64
31 %arrayidx.us = getelementptr inbounds i32, ptr %A, i64 %idxprom.us
32 tail call void @use_ptr(ptr %arrayidx.us)
33 %inc.us = add nuw nsw i32 %j.016.us, 1
34 %cmp2.us = icmp slt i32 %inc.us, %M
35 br i1 %cmp2.us, label %for.body, label %exit
41 define void @zext_no_offset(ptr %A, i32 %M) {
42 ; CHECK-LABEL: @zext_no_offset(
44 ; CHECK-NEXT: [[SMAX:%.*]] = call i32 @llvm.smax.i32(i32 [[M:%.*]], i32 1)
45 ; CHECK-NEXT: [[WIDE_TRIP_COUNT:%.*]] = zext i32 [[SMAX]] to i64
46 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
48 ; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ], [ 0, [[ENTRY:%.*]] ]
49 ; CHECK-NEXT: [[ARRAYIDX_US:%.*]] = getelementptr inbounds i32, ptr [[A:%.*]], i64 [[INDVARS_IV]]
50 ; CHECK-NEXT: tail call void @use_ptr(ptr [[ARRAYIDX_US]])
51 ; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
52 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV_NEXT]], [[WIDE_TRIP_COUNT]]
53 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY]], label [[EXIT:%.*]]
55 ; CHECK-NEXT: ret void
61 %j.016.us = phi i32 [ 0, %entry ], [ %inc.us, %for.body ]
62 %idxprom.us = zext i32 %j.016.us to i64
63 %arrayidx.us = getelementptr inbounds i32, ptr %A, i64 %idxprom.us
64 tail call void @use_ptr(ptr %arrayidx.us)
65 %inc.us = add nuw nsw i32 %j.016.us, 1
66 %cmp2.us = icmp slt i32 %inc.us, %M
67 br i1 %cmp2.us, label %for.body, label %exit
73 define void @zext_nneg_no_offset(ptr %A, i32 %M) {
74 ; CHECK-LABEL: @zext_nneg_no_offset(
76 ; CHECK-NEXT: [[SMAX:%.*]] = call i32 @llvm.smax.i32(i32 [[M:%.*]], i32 1)
77 ; CHECK-NEXT: [[WIDE_TRIP_COUNT:%.*]] = zext i32 [[SMAX]] to i64
78 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
80 ; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ], [ 0, [[ENTRY:%.*]] ]
81 ; CHECK-NEXT: [[ARRAYIDX_US:%.*]] = getelementptr inbounds i32, ptr [[A:%.*]], i64 [[INDVARS_IV]]
82 ; CHECK-NEXT: tail call void @use_ptr(ptr [[ARRAYIDX_US]])
83 ; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
84 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV_NEXT]], [[WIDE_TRIP_COUNT]]
85 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY]], label [[EXIT:%.*]]
87 ; CHECK-NEXT: ret void
93 %j.016.us = phi i32 [ 0, %entry ], [ %inc.us, %for.body ]
94 %idxprom.us = zext nneg i32 %j.016.us to i64
95 %arrayidx.us = getelementptr inbounds i32, ptr %A, i64 %idxprom.us
96 tail call void @use_ptr(ptr %arrayidx.us)
97 %inc.us = add nuw nsw i32 %j.016.us, 1
98 %cmp2.us = icmp slt i32 %inc.us, %M
99 br i1 %cmp2.us, label %for.body, label %exit
105 ; Offset with a loop invariant value, various combinations
106 ; --------------------------------------
108 define void @sext_add_nsw(ptr %A, i32 %offset, i32 %M) {
109 ; CHECK-LABEL: @sext_add_nsw(
111 ; CHECK-NEXT: [[TMP0:%.*]] = sext i32 [[OFFSET:%.*]] to i64
112 ; CHECK-NEXT: [[SMAX:%.*]] = call i32 @llvm.smax.i32(i32 [[M:%.*]], i32 1)
113 ; CHECK-NEXT: [[WIDE_TRIP_COUNT:%.*]] = zext i32 [[SMAX]] to i64
114 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
116 ; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ], [ 0, [[ENTRY:%.*]] ]
117 ; CHECK-NEXT: [[TMP1:%.*]] = add nsw i64 [[INDVARS_IV]], [[TMP0]]
118 ; CHECK-NEXT: [[ARRAYIDX_US:%.*]] = getelementptr inbounds i32, ptr [[A:%.*]], i64 [[TMP1]]
119 ; CHECK-NEXT: tail call void @use_ptr(ptr [[ARRAYIDX_US]])
120 ; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
121 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV_NEXT]], [[WIDE_TRIP_COUNT]]
122 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY]], label [[EXIT:%.*]]
124 ; CHECK-NEXT: ret void
130 %j.016.us = phi i32 [ 0, %entry ], [ %inc.us, %for.body ]
131 %add.us = add nsw i32 %j.016.us, %offset
132 %idxprom.us = sext i32 %add.us to i64
133 %arrayidx.us = getelementptr inbounds i32, ptr %A, i64 %idxprom.us
134 tail call void @use_ptr(ptr %arrayidx.us)
135 %inc.us = add nuw nsw i32 %j.016.us, 1
136 %cmp2.us = icmp slt i32 %inc.us, %M
137 br i1 %cmp2.us, label %for.body, label %exit
143 define void @sext_add_nuw(ptr %A, i32 %offset, i32 %M) {
144 ; CHECK-LABEL: @sext_add_nuw(
146 ; CHECK-NEXT: [[TMP0:%.*]] = zext i32 [[OFFSET:%.*]] to i64
147 ; CHECK-NEXT: [[SMAX:%.*]] = call i32 @llvm.smax.i32(i32 [[M:%.*]], i32 1)
148 ; CHECK-NEXT: [[WIDE_TRIP_COUNT:%.*]] = zext i32 [[SMAX]] to i64
149 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
151 ; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ], [ 0, [[ENTRY:%.*]] ]
152 ; CHECK-NEXT: [[TMP1:%.*]] = add nuw nsw i64 [[INDVARS_IV]], [[TMP0]]
153 ; CHECK-NEXT: [[TMP2:%.*]] = trunc i64 [[TMP1]] to i32
154 ; CHECK-NEXT: [[IDXPROM_US:%.*]] = sext i32 [[TMP2]] to i64
155 ; CHECK-NEXT: [[ARRAYIDX_US:%.*]] = getelementptr inbounds i32, ptr [[A:%.*]], i64 [[IDXPROM_US]]
156 ; CHECK-NEXT: tail call void @use_ptr(ptr [[ARRAYIDX_US]])
157 ; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
158 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV_NEXT]], [[WIDE_TRIP_COUNT]]
159 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY]], label [[EXIT:%.*]]
161 ; CHECK-NEXT: ret void
167 %j.016.us = phi i32 [ 0, %entry ], [ %inc.us, %for.body ]
168 %add.us = add nuw i32 %j.016.us, %offset
169 %idxprom.us = sext i32 %add.us to i64
170 %arrayidx.us = getelementptr inbounds i32, ptr %A, i64 %idxprom.us
171 tail call void @use_ptr(ptr %arrayidx.us)
172 %inc.us = add nuw nsw i32 %j.016.us, 1
173 %cmp2.us = icmp slt i32 %inc.us, %M
174 br i1 %cmp2.us, label %for.body, label %exit
180 define void @sext_add_noflags(ptr %A, i32 %offset, i32 %M) {
181 ; CHECK-LABEL: @sext_add_noflags(
183 ; CHECK-NEXT: [[SMAX:%.*]] = call i32 @llvm.smax.i32(i32 [[M:%.*]], i32 1)
184 ; CHECK-NEXT: [[WIDE_TRIP_COUNT:%.*]] = zext i32 [[SMAX]] to i64
185 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
187 ; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ], [ 0, [[ENTRY:%.*]] ]
188 ; CHECK-NEXT: [[TMP0:%.*]] = trunc i64 [[INDVARS_IV]] to i32
189 ; CHECK-NEXT: [[ADD_US:%.*]] = add i32 [[TMP0]], [[OFFSET:%.*]]
190 ; CHECK-NEXT: [[IDXPROM_US:%.*]] = sext i32 [[ADD_US]] to i64
191 ; CHECK-NEXT: [[ARRAYIDX_US:%.*]] = getelementptr inbounds i32, ptr [[A:%.*]], i64 [[IDXPROM_US]]
192 ; CHECK-NEXT: tail call void @use_ptr(ptr [[ARRAYIDX_US]])
193 ; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
194 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV_NEXT]], [[WIDE_TRIP_COUNT]]
195 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY]], label [[EXIT:%.*]]
197 ; CHECK-NEXT: ret void
203 %j.016.us = phi i32 [ 0, %entry ], [ %inc.us, %for.body ]
204 %add.us = add i32 %j.016.us, %offset
205 %idxprom.us = sext i32 %add.us to i64
206 %arrayidx.us = getelementptr inbounds i32, ptr %A, i64 %idxprom.us
207 tail call void @use_ptr(ptr %arrayidx.us)
208 %inc.us = add nuw nsw i32 %j.016.us, 1
209 %cmp2.us = icmp slt i32 %inc.us, %M
210 br i1 %cmp2.us, label %for.body, label %exit
216 define void @zext_add_nsw(ptr %A, i32 %offset, i32 %M) {
217 ; CHECK-LABEL: @zext_add_nsw(
219 ; CHECK-NEXT: [[TMP0:%.*]] = sext i32 [[OFFSET:%.*]] to i64
220 ; CHECK-NEXT: [[SMAX:%.*]] = call i32 @llvm.smax.i32(i32 [[M:%.*]], i32 1)
221 ; CHECK-NEXT: [[WIDE_TRIP_COUNT:%.*]] = zext i32 [[SMAX]] to i64
222 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
224 ; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ], [ 0, [[ENTRY:%.*]] ]
225 ; CHECK-NEXT: [[TMP1:%.*]] = add nsw i64 [[INDVARS_IV]], [[TMP0]]
226 ; CHECK-NEXT: [[TMP2:%.*]] = trunc i64 [[TMP1]] to i32
227 ; CHECK-NEXT: [[IDXPROM_US:%.*]] = zext i32 [[TMP2]] to i64
228 ; CHECK-NEXT: [[ARRAYIDX_US:%.*]] = getelementptr inbounds i32, ptr [[A:%.*]], i64 [[IDXPROM_US]]
229 ; CHECK-NEXT: tail call void @use_ptr(ptr [[ARRAYIDX_US]])
230 ; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
231 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV_NEXT]], [[WIDE_TRIP_COUNT]]
232 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY]], label [[EXIT:%.*]]
234 ; CHECK-NEXT: ret void
240 %j.016.us = phi i32 [ 0, %entry ], [ %inc.us, %for.body ]
241 %add.us = add nsw i32 %j.016.us, %offset
242 %idxprom.us = zext i32 %add.us to i64
243 %arrayidx.us = getelementptr inbounds i32, ptr %A, i64 %idxprom.us
244 tail call void @use_ptr(ptr %arrayidx.us)
245 %inc.us = add nuw nsw i32 %j.016.us, 1
246 %cmp2.us = icmp slt i32 %inc.us, %M
247 br i1 %cmp2.us, label %for.body, label %exit
253 define void @zext_add_nuw(ptr %A, i32 %offset, i32 %M) {
254 ; CHECK-LABEL: @zext_add_nuw(
256 ; CHECK-NEXT: [[TMP0:%.*]] = zext i32 [[OFFSET:%.*]] to i64
257 ; CHECK-NEXT: [[SMAX:%.*]] = call i32 @llvm.smax.i32(i32 [[M:%.*]], i32 1)
258 ; CHECK-NEXT: [[WIDE_TRIP_COUNT:%.*]] = zext i32 [[SMAX]] to i64
259 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
261 ; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ], [ 0, [[ENTRY:%.*]] ]
262 ; CHECK-NEXT: [[TMP1:%.*]] = add nuw nsw i64 [[INDVARS_IV]], [[TMP0]]
263 ; CHECK-NEXT: [[ARRAYIDX_US:%.*]] = getelementptr inbounds i32, ptr [[A:%.*]], i64 [[TMP1]]
264 ; CHECK-NEXT: tail call void @use_ptr(ptr [[ARRAYIDX_US]])
265 ; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
266 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV_NEXT]], [[WIDE_TRIP_COUNT]]
267 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY]], label [[EXIT:%.*]]
269 ; CHECK-NEXT: ret void
275 %j.016.us = phi i32 [ 0, %entry ], [ %inc.us, %for.body ]
276 %add.us = add nuw i32 %j.016.us, %offset
277 %idxprom.us = zext i32 %add.us to i64
278 %arrayidx.us = getelementptr inbounds i32, ptr %A, i64 %idxprom.us
279 tail call void @use_ptr(ptr %arrayidx.us)
280 %inc.us = add nuw nsw i32 %j.016.us, 1
281 %cmp2.us = icmp slt i32 %inc.us, %M
282 br i1 %cmp2.us, label %for.body, label %exit
288 define void @zext_add_noflags(ptr %A, i32 %offset, i32 %M) {
289 ; CHECK-LABEL: @zext_add_noflags(
291 ; CHECK-NEXT: [[SMAX:%.*]] = call i32 @llvm.smax.i32(i32 [[M:%.*]], i32 1)
292 ; CHECK-NEXT: [[WIDE_TRIP_COUNT:%.*]] = zext i32 [[SMAX]] to i64
293 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
295 ; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ], [ 0, [[ENTRY:%.*]] ]
296 ; CHECK-NEXT: [[TMP0:%.*]] = trunc i64 [[INDVARS_IV]] to i32
297 ; CHECK-NEXT: [[ADD_US:%.*]] = add i32 [[TMP0]], [[OFFSET:%.*]]
298 ; CHECK-NEXT: [[IDXPROM_US:%.*]] = zext i32 [[ADD_US]] to i64
299 ; CHECK-NEXT: [[ARRAYIDX_US:%.*]] = getelementptr inbounds i32, ptr [[A:%.*]], i64 [[IDXPROM_US]]
300 ; CHECK-NEXT: tail call void @use_ptr(ptr [[ARRAYIDX_US]])
301 ; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
302 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV_NEXT]], [[WIDE_TRIP_COUNT]]
303 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY]], label [[EXIT:%.*]]
305 ; CHECK-NEXT: ret void
311 %j.016.us = phi i32 [ 0, %entry ], [ %inc.us, %for.body ]
312 %add.us = add i32 %j.016.us, %offset
313 %idxprom.us = zext i32 %add.us to i64
314 %arrayidx.us = getelementptr inbounds i32, ptr %A, i64 %idxprom.us
315 tail call void @use_ptr(ptr %arrayidx.us)
316 %inc.us = add nuw nsw i32 %j.016.us, 1
317 %cmp2.us = icmp slt i32 %inc.us, %M
318 br i1 %cmp2.us, label %for.body, label %exit
324 define void @zext_nneg_add_nsw(ptr %A, i32 %offset, i32 %M) {
325 ; CHECK-LABEL: @zext_nneg_add_nsw(
327 ; CHECK-NEXT: [[TMP0:%.*]] = sext i32 [[OFFSET:%.*]] to i64
328 ; CHECK-NEXT: [[SMAX:%.*]] = call i32 @llvm.smax.i32(i32 [[M:%.*]], i32 1)
329 ; CHECK-NEXT: [[WIDE_TRIP_COUNT:%.*]] = zext i32 [[SMAX]] to i64
330 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
332 ; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ], [ 0, [[ENTRY:%.*]] ]
333 ; CHECK-NEXT: [[TMP1:%.*]] = add nsw i64 [[INDVARS_IV]], [[TMP0]]
334 ; CHECK-NEXT: [[TMP2:%.*]] = trunc i64 [[TMP1]] to i32
335 ; CHECK-NEXT: [[IDXPROM_US:%.*]] = zext nneg i32 [[TMP2]] to i64
336 ; CHECK-NEXT: [[ARRAYIDX_US:%.*]] = getelementptr inbounds i32, ptr [[A:%.*]], i64 [[IDXPROM_US]]
337 ; CHECK-NEXT: tail call void @use_ptr(ptr [[ARRAYIDX_US]])
338 ; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
339 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV_NEXT]], [[WIDE_TRIP_COUNT]]
340 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY]], label [[EXIT:%.*]]
342 ; CHECK-NEXT: ret void
348 %j.016.us = phi i32 [ 0, %entry ], [ %inc.us, %for.body ]
349 %add.us = add nsw i32 %j.016.us, %offset
350 %idxprom.us = zext nneg i32 %add.us to i64
351 %arrayidx.us = getelementptr inbounds i32, ptr %A, i64 %idxprom.us
352 tail call void @use_ptr(ptr %arrayidx.us)
353 %inc.us = add nuw nsw i32 %j.016.us, 1
354 %cmp2.us = icmp slt i32 %inc.us, %M
355 br i1 %cmp2.us, label %for.body, label %exit
361 define void @zext_nneg_add_nuw(ptr %A, i32 %offset, i32 %M) {
362 ; CHECK-LABEL: @zext_nneg_add_nuw(
364 ; CHECK-NEXT: [[TMP0:%.*]] = zext i32 [[OFFSET:%.*]] to i64
365 ; CHECK-NEXT: [[SMAX:%.*]] = call i32 @llvm.smax.i32(i32 [[M:%.*]], i32 1)
366 ; CHECK-NEXT: [[WIDE_TRIP_COUNT:%.*]] = zext i32 [[SMAX]] to i64
367 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
369 ; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ], [ 0, [[ENTRY:%.*]] ]
370 ; CHECK-NEXT: [[TMP1:%.*]] = add nuw nsw i64 [[INDVARS_IV]], [[TMP0]]
371 ; CHECK-NEXT: [[ARRAYIDX_US:%.*]] = getelementptr inbounds i32, ptr [[A:%.*]], i64 [[TMP1]]
372 ; CHECK-NEXT: tail call void @use_ptr(ptr [[ARRAYIDX_US]])
373 ; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
374 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV_NEXT]], [[WIDE_TRIP_COUNT]]
375 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY]], label [[EXIT:%.*]]
377 ; CHECK-NEXT: ret void
383 %j.016.us = phi i32 [ 0, %entry ], [ %inc.us, %for.body ]
384 %add.us = add nuw i32 %j.016.us, %offset
385 %idxprom.us = zext nneg i32 %add.us to i64
386 %arrayidx.us = getelementptr inbounds i32, ptr %A, i64 %idxprom.us
387 tail call void @use_ptr(ptr %arrayidx.us)
388 %inc.us = add nuw nsw i32 %j.016.us, 1
389 %cmp2.us = icmp slt i32 %inc.us, %M
390 br i1 %cmp2.us, label %for.body, label %exit
396 define void @zext_nneg_add_noflags(ptr %A, i32 %offset, i32 %M) {
397 ; CHECK-LABEL: @zext_nneg_add_noflags(
399 ; CHECK-NEXT: [[SMAX:%.*]] = call i32 @llvm.smax.i32(i32 [[M:%.*]], i32 1)
400 ; CHECK-NEXT: [[WIDE_TRIP_COUNT:%.*]] = zext i32 [[SMAX]] to i64
401 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
403 ; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ], [ 0, [[ENTRY:%.*]] ]
404 ; CHECK-NEXT: [[TMP0:%.*]] = trunc i64 [[INDVARS_IV]] to i32
405 ; CHECK-NEXT: [[ADD_US:%.*]] = add i32 [[TMP0]], [[OFFSET:%.*]]
406 ; CHECK-NEXT: [[IDXPROM_US:%.*]] = zext nneg i32 [[ADD_US]] to i64
407 ; CHECK-NEXT: [[ARRAYIDX_US:%.*]] = getelementptr inbounds i32, ptr [[A:%.*]], i64 [[IDXPROM_US]]
408 ; CHECK-NEXT: tail call void @use_ptr(ptr [[ARRAYIDX_US]])
409 ; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
410 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV_NEXT]], [[WIDE_TRIP_COUNT]]
411 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY]], label [[EXIT:%.*]]
413 ; CHECK-NEXT: ret void
419 %j.016.us = phi i32 [ 0, %entry ], [ %inc.us, %for.body ]
420 %add.us = add i32 %j.016.us, %offset
421 %idxprom.us = zext nneg i32 %add.us to i64
422 %arrayidx.us = getelementptr inbounds i32, ptr %A, i64 %idxprom.us
423 tail call void @use_ptr(ptr %arrayidx.us)
424 %inc.us = add nuw nsw i32 %j.016.us, 1
425 %cmp2.us = icmp slt i32 %inc.us, %M
426 br i1 %cmp2.us, label %for.body, label %exit
432 ; Offset is multiplied by a multiple
433 ; --------------------------------------
435 define void @sext_mul_nsw(ptr %A, i32 %multiple, i32 %M) {
436 ; CHECK-LABEL: @sext_mul_nsw(
438 ; CHECK-NEXT: [[TMP0:%.*]] = sext i32 [[MULTIPLE:%.*]] to i64
439 ; CHECK-NEXT: [[SMAX:%.*]] = call i32 @llvm.smax.i32(i32 [[M:%.*]], i32 1)
440 ; CHECK-NEXT: [[WIDE_TRIP_COUNT:%.*]] = zext i32 [[SMAX]] to i64
441 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
443 ; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ], [ 0, [[ENTRY:%.*]] ]
444 ; CHECK-NEXT: [[TMP1:%.*]] = mul nsw i64 [[INDVARS_IV]], [[TMP0]]
445 ; CHECK-NEXT: [[ARRAYIDX_US:%.*]] = getelementptr inbounds i32, ptr [[A:%.*]], i64 [[TMP1]]
446 ; CHECK-NEXT: tail call void @use_ptr(ptr [[ARRAYIDX_US]])
447 ; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
448 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV_NEXT]], [[WIDE_TRIP_COUNT]]
449 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY]], label [[EXIT:%.*]]
451 ; CHECK-NEXT: ret void
457 %j.016.us = phi i32 [ 0, %entry ], [ %inc.us, %for.body ]
458 %mul.us = mul nsw i32 %j.016.us, %multiple
459 %idxprom.us = sext i32 %mul.us to i64
460 %arrayidx.us = getelementptr inbounds i32, ptr %A, i64 %idxprom.us
461 tail call void @use_ptr(ptr %arrayidx.us)
462 %inc.us = add nuw nsw i32 %j.016.us, 1
463 %cmp2.us = icmp slt i32 %inc.us, %M
464 br i1 %cmp2.us, label %for.body, label %exit
470 define void @sext_mul_nuw(ptr %A, i32 %multiple, i32 %M) {
471 ; CHECK-LABEL: @sext_mul_nuw(
473 ; CHECK-NEXT: [[TMP0:%.*]] = zext i32 [[MULTIPLE:%.*]] to i64
474 ; CHECK-NEXT: [[SMAX:%.*]] = call i32 @llvm.smax.i32(i32 [[M:%.*]], i32 1)
475 ; CHECK-NEXT: [[WIDE_TRIP_COUNT:%.*]] = zext i32 [[SMAX]] to i64
476 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
478 ; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ], [ 0, [[ENTRY:%.*]] ]
479 ; CHECK-NEXT: [[TMP1:%.*]] = mul nuw nsw i64 [[INDVARS_IV]], [[TMP0]]
480 ; CHECK-NEXT: [[TMP2:%.*]] = trunc i64 [[TMP1]] to i32
481 ; CHECK-NEXT: [[IDXPROM_US:%.*]] = sext i32 [[TMP2]] to i64
482 ; CHECK-NEXT: [[ARRAYIDX_US:%.*]] = getelementptr inbounds i32, ptr [[A:%.*]], i64 [[IDXPROM_US]]
483 ; CHECK-NEXT: tail call void @use_ptr(ptr [[ARRAYIDX_US]])
484 ; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
485 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV_NEXT]], [[WIDE_TRIP_COUNT]]
486 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY]], label [[EXIT:%.*]]
488 ; CHECK-NEXT: ret void
494 %j.016.us = phi i32 [ 0, %entry ], [ %inc.us, %for.body ]
495 %mul.us = mul nuw i32 %j.016.us, %multiple
496 %idxprom.us = sext i32 %mul.us to i64
497 %arrayidx.us = getelementptr inbounds i32, ptr %A, i64 %idxprom.us
498 tail call void @use_ptr(ptr %arrayidx.us)
499 %inc.us = add nuw nsw i32 %j.016.us, 1
500 %cmp2.us = icmp slt i32 %inc.us, %M
501 br i1 %cmp2.us, label %for.body, label %exit
507 define void @sext_mul_noflags(ptr %A, i32 %multiple, i32 %M) {
508 ; CHECK-LABEL: @sext_mul_noflags(
510 ; CHECK-NEXT: [[SMAX:%.*]] = call i32 @llvm.smax.i32(i32 [[M:%.*]], i32 1)
511 ; CHECK-NEXT: [[WIDE_TRIP_COUNT:%.*]] = zext i32 [[SMAX]] to i64
512 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
514 ; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ], [ 0, [[ENTRY:%.*]] ]
515 ; CHECK-NEXT: [[TMP0:%.*]] = trunc i64 [[INDVARS_IV]] to i32
516 ; CHECK-NEXT: [[MUL_US:%.*]] = mul i32 [[TMP0]], [[MULTIPLE:%.*]]
517 ; CHECK-NEXT: [[IDXPROM_US:%.*]] = sext i32 [[MUL_US]] to i64
518 ; CHECK-NEXT: [[ARRAYIDX_US:%.*]] = getelementptr inbounds i32, ptr [[A:%.*]], i64 [[IDXPROM_US]]
519 ; CHECK-NEXT: tail call void @use_ptr(ptr [[ARRAYIDX_US]])
520 ; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
521 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV_NEXT]], [[WIDE_TRIP_COUNT]]
522 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY]], label [[EXIT:%.*]]
524 ; CHECK-NEXT: ret void
530 %j.016.us = phi i32 [ 0, %entry ], [ %inc.us, %for.body ]
531 %mul.us = mul i32 %j.016.us, %multiple
532 %idxprom.us = sext i32 %mul.us to i64
533 %arrayidx.us = getelementptr inbounds i32, ptr %A, i64 %idxprom.us
534 tail call void @use_ptr(ptr %arrayidx.us)
535 %inc.us = add nuw nsw i32 %j.016.us, 1
536 %cmp2.us = icmp slt i32 %inc.us, %M
537 br i1 %cmp2.us, label %for.body, label %exit
543 define void @zext_mul_nsw(ptr %A, i32 %multiple, i32 %M) {
544 ; CHECK-LABEL: @zext_mul_nsw(
546 ; CHECK-NEXT: [[TMP0:%.*]] = sext i32 [[MULTIPLE:%.*]] to i64
547 ; CHECK-NEXT: [[SMAX:%.*]] = call i32 @llvm.smax.i32(i32 [[M:%.*]], i32 1)
548 ; CHECK-NEXT: [[WIDE_TRIP_COUNT:%.*]] = zext i32 [[SMAX]] to i64
549 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
551 ; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ], [ 0, [[ENTRY:%.*]] ]
552 ; CHECK-NEXT: [[TMP1:%.*]] = mul nsw i64 [[INDVARS_IV]], [[TMP0]]
553 ; CHECK-NEXT: [[TMP2:%.*]] = trunc i64 [[TMP1]] to i32
554 ; CHECK-NEXT: [[IDXPROM_US:%.*]] = zext i32 [[TMP2]] to i64
555 ; CHECK-NEXT: [[ARRAYIDX_US:%.*]] = getelementptr inbounds i32, ptr [[A:%.*]], i64 [[IDXPROM_US]]
556 ; CHECK-NEXT: tail call void @use_ptr(ptr [[ARRAYIDX_US]])
557 ; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
558 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV_NEXT]], [[WIDE_TRIP_COUNT]]
559 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY]], label [[EXIT:%.*]]
561 ; CHECK-NEXT: ret void
567 %j.016.us = phi i32 [ 0, %entry ], [ %inc.us, %for.body ]
568 %mul.us = mul nsw i32 %j.016.us, %multiple
569 %idxprom.us = zext i32 %mul.us to i64
570 %arrayidx.us = getelementptr inbounds i32, ptr %A, i64 %idxprom.us
571 tail call void @use_ptr(ptr %arrayidx.us)
572 %inc.us = add nuw nsw i32 %j.016.us, 1
573 %cmp2.us = icmp slt i32 %inc.us, %M
574 br i1 %cmp2.us, label %for.body, label %exit
580 define void @zext_mul_nuw(ptr %A, i32 %multiple, i32 %M) {
581 ; CHECK-LABEL: @zext_mul_nuw(
583 ; CHECK-NEXT: [[TMP0:%.*]] = zext i32 [[MULTIPLE:%.*]] to i64
584 ; CHECK-NEXT: [[SMAX:%.*]] = call i32 @llvm.smax.i32(i32 [[M:%.*]], i32 1)
585 ; CHECK-NEXT: [[WIDE_TRIP_COUNT:%.*]] = zext i32 [[SMAX]] to i64
586 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
588 ; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ], [ 0, [[ENTRY:%.*]] ]
589 ; CHECK-NEXT: [[TMP1:%.*]] = mul nuw nsw i64 [[INDVARS_IV]], [[TMP0]]
590 ; CHECK-NEXT: [[ARRAYIDX_US:%.*]] = getelementptr inbounds i32, ptr [[A:%.*]], i64 [[TMP1]]
591 ; CHECK-NEXT: tail call void @use_ptr(ptr [[ARRAYIDX_US]])
592 ; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
593 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV_NEXT]], [[WIDE_TRIP_COUNT]]
594 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY]], label [[EXIT:%.*]]
596 ; CHECK-NEXT: ret void
602 %j.016.us = phi i32 [ 0, %entry ], [ %inc.us, %for.body ]
603 %mul.us = mul nuw i32 %j.016.us, %multiple
604 %idxprom.us = zext i32 %mul.us to i64
605 %arrayidx.us = getelementptr inbounds i32, ptr %A, i64 %idxprom.us
606 tail call void @use_ptr(ptr %arrayidx.us)
607 %inc.us = add nuw nsw i32 %j.016.us, 1
608 %cmp2.us = icmp slt i32 %inc.us, %M
609 br i1 %cmp2.us, label %for.body, label %exit
615 define void @zext_mul_noflags(ptr %A, i32 %multiple, i32 %M) {
616 ; CHECK-LABEL: @zext_mul_noflags(
618 ; CHECK-NEXT: [[SMAX:%.*]] = call i32 @llvm.smax.i32(i32 [[M:%.*]], i32 1)
619 ; CHECK-NEXT: [[WIDE_TRIP_COUNT:%.*]] = zext i32 [[SMAX]] to i64
620 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
622 ; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ], [ 0, [[ENTRY:%.*]] ]
623 ; CHECK-NEXT: [[TMP0:%.*]] = trunc i64 [[INDVARS_IV]] to i32
624 ; CHECK-NEXT: [[MUL_US:%.*]] = mul i32 [[TMP0]], [[MULTIPLE:%.*]]
625 ; CHECK-NEXT: [[IDXPROM_US:%.*]] = zext i32 [[MUL_US]] to i64
626 ; CHECK-NEXT: [[ARRAYIDX_US:%.*]] = getelementptr inbounds i32, ptr [[A:%.*]], i64 [[IDXPROM_US]]
627 ; CHECK-NEXT: tail call void @use_ptr(ptr [[ARRAYIDX_US]])
628 ; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
629 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV_NEXT]], [[WIDE_TRIP_COUNT]]
630 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY]], label [[EXIT:%.*]]
632 ; CHECK-NEXT: ret void
638 %j.016.us = phi i32 [ 0, %entry ], [ %inc.us, %for.body ]
639 %mul.us = mul i32 %j.016.us, %multiple
640 %idxprom.us = zext i32 %mul.us to i64
641 %arrayidx.us = getelementptr inbounds i32, ptr %A, i64 %idxprom.us
642 tail call void @use_ptr(ptr %arrayidx.us)
643 %inc.us = add nuw nsw i32 %j.016.us, 1
644 %cmp2.us = icmp slt i32 %inc.us, %M
645 br i1 %cmp2.us, label %for.body, label %exit
651 define void @zext_nneg_mul_nsw(ptr %A, i32 %multiple, i32 %M) {
652 ; CHECK-LABEL: @zext_nneg_mul_nsw(
654 ; CHECK-NEXT: [[TMP0:%.*]] = sext i32 [[MULTIPLE:%.*]] to i64
655 ; CHECK-NEXT: [[SMAX:%.*]] = call i32 @llvm.smax.i32(i32 [[M:%.*]], i32 1)
656 ; CHECK-NEXT: [[WIDE_TRIP_COUNT:%.*]] = zext i32 [[SMAX]] to i64
657 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
659 ; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ], [ 0, [[ENTRY:%.*]] ]
660 ; CHECK-NEXT: [[TMP1:%.*]] = mul nsw i64 [[INDVARS_IV]], [[TMP0]]
661 ; CHECK-NEXT: [[TMP2:%.*]] = trunc i64 [[TMP1]] to i32
662 ; CHECK-NEXT: [[IDXPROM_US:%.*]] = zext nneg i32 [[TMP2]] to i64
663 ; CHECK-NEXT: [[ARRAYIDX_US:%.*]] = getelementptr inbounds i32, ptr [[A:%.*]], i64 [[IDXPROM_US]]
664 ; CHECK-NEXT: tail call void @use_ptr(ptr [[ARRAYIDX_US]])
665 ; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
666 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV_NEXT]], [[WIDE_TRIP_COUNT]]
667 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY]], label [[EXIT:%.*]]
669 ; CHECK-NEXT: ret void
675 %j.016.us = phi i32 [ 0, %entry ], [ %inc.us, %for.body ]
676 %mul.us = mul nsw i32 %j.016.us, %multiple
677 %idxprom.us = zext nneg i32 %mul.us to i64
678 %arrayidx.us = getelementptr inbounds i32, ptr %A, i64 %idxprom.us
679 tail call void @use_ptr(ptr %arrayidx.us)
680 %inc.us = add nuw nsw i32 %j.016.us, 1
681 %cmp2.us = icmp slt i32 %inc.us, %M
682 br i1 %cmp2.us, label %for.body, label %exit
688 define void @zext_nneg_mul_nuw(ptr %A, i32 %multiple, i32 %M) {
689 ; CHECK-LABEL: @zext_nneg_mul_nuw(
691 ; CHECK-NEXT: [[TMP0:%.*]] = zext i32 [[MULTIPLE:%.*]] to i64
692 ; CHECK-NEXT: [[SMAX:%.*]] = call i32 @llvm.smax.i32(i32 [[M:%.*]], i32 1)
693 ; CHECK-NEXT: [[WIDE_TRIP_COUNT:%.*]] = zext i32 [[SMAX]] to i64
694 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
696 ; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ], [ 0, [[ENTRY:%.*]] ]
697 ; CHECK-NEXT: [[TMP1:%.*]] = mul nuw nsw i64 [[INDVARS_IV]], [[TMP0]]
698 ; CHECK-NEXT: [[ARRAYIDX_US:%.*]] = getelementptr inbounds i32, ptr [[A:%.*]], i64 [[TMP1]]
699 ; CHECK-NEXT: tail call void @use_ptr(ptr [[ARRAYIDX_US]])
700 ; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
701 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV_NEXT]], [[WIDE_TRIP_COUNT]]
702 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY]], label [[EXIT:%.*]]
704 ; CHECK-NEXT: ret void
710 %j.016.us = phi i32 [ 0, %entry ], [ %inc.us, %for.body ]
711 %mul.us = mul nuw i32 %j.016.us, %multiple
712 %idxprom.us = zext nneg i32 %mul.us to i64
713 %arrayidx.us = getelementptr inbounds i32, ptr %A, i64 %idxprom.us
714 tail call void @use_ptr(ptr %arrayidx.us)
715 %inc.us = add nuw nsw i32 %j.016.us, 1
716 %cmp2.us = icmp slt i32 %inc.us, %M
717 br i1 %cmp2.us, label %for.body, label %exit
723 define void @zext_nneg_mul_noflags(ptr %A, i32 %multiple, i32 %M) {
724 ; CHECK-LABEL: @zext_nneg_mul_noflags(
726 ; CHECK-NEXT: [[SMAX:%.*]] = call i32 @llvm.smax.i32(i32 [[M:%.*]], i32 1)
727 ; CHECK-NEXT: [[WIDE_TRIP_COUNT:%.*]] = zext i32 [[SMAX]] to i64
728 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
730 ; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ], [ 0, [[ENTRY:%.*]] ]
731 ; CHECK-NEXT: [[TMP0:%.*]] = trunc i64 [[INDVARS_IV]] to i32
732 ; CHECK-NEXT: [[MUL_US:%.*]] = mul i32 [[TMP0]], [[MULTIPLE:%.*]]
733 ; CHECK-NEXT: [[IDXPROM_US:%.*]] = zext nneg i32 [[MUL_US]] to i64
734 ; CHECK-NEXT: [[ARRAYIDX_US:%.*]] = getelementptr inbounds i32, ptr [[A:%.*]], i64 [[IDXPROM_US]]
735 ; CHECK-NEXT: tail call void @use_ptr(ptr [[ARRAYIDX_US]])
736 ; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
737 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV_NEXT]], [[WIDE_TRIP_COUNT]]
738 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY]], label [[EXIT:%.*]]
740 ; CHECK-NEXT: ret void
746 %j.016.us = phi i32 [ 0, %entry ], [ %inc.us, %for.body ]
747 %mul.us = mul i32 %j.016.us, %multiple
748 %idxprom.us = zext nneg i32 %mul.us to i64
749 %arrayidx.us = getelementptr inbounds i32, ptr %A, i64 %idxprom.us
750 tail call void @use_ptr(ptr %arrayidx.us)
751 %inc.us = add nuw nsw i32 %j.016.us, 1
752 %cmp2.us = icmp slt i32 %inc.us, %M
753 br i1 %cmp2.us, label %for.body, label %exit
759 declare dso_local void @use_ptr(ptr %0)