1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -loop-idiom -verify -verify-each -verify-dom-info -verify-loop-info < %s -S | FileCheck %s
4 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
6 ; This only tests various forms of loop control-flow.
7 ; These tests are fully identical to bcmp()==0 otherwise.
11 ; bool pointer_iteration_const_size_no_overlap(char const* ptr) {
12 ; return std::equal(ptr, ptr + 8, ptr + 8);
14 ; bool pointer_iteration_const_size_partial_overlap(char const* ptr) {
15 ; return std::equal(ptr, ptr + 16, ptr + 8);
17 ; bool pointer_iteration_const_size_overlap_unknown(char const* ptr0, char const* ptr1) {
18 ; return std::equal(ptr0, ptr0 + 8, ptr1);
21 ; bool pointer_iteration_variable_size_no_overlap(char const* ptr, size_t count) {
22 ; return std::equal(ptr, ptr + count, ptr + count);
24 ; bool pointer_iteration_variable_size_partial_overlap(char const* ptr, size_t count) {
25 ; return std::equal(ptr, ptr + 2 * count, ptr + count);
27 ; bool pointer_iteration_variable_size_overlap_unknown(char const* ptr0, char const* ptr1, size_t count) {
28 ; return std::equal(ptr0, ptr0 + count, ptr1);
31 ; bool index_iteration_eq_const_size_no_overlap(char const* ptr) {
32 ; char const* ptr0 = ptr;
33 ; char const* ptr1 = ptr + 8;
34 ; for(size_t i = 0; i < 8; i++) {
35 ; if(ptr0[i] != ptr1[i])
40 ; bool index_iteration_eq_const_size_partial_overlap(char const* ptr) {
41 ; char const* ptr0 = ptr;
42 ; char const* ptr1 = ptr + 8;
43 ; for(size_t i = 0; i < 16; i++) {
44 ; if(ptr0[i] != ptr1[i])
49 ; bool index_iteration_eq_const_size_overlap_unknown(char const* ptr0, char const* ptr1) {
50 ; for(size_t i = 0; i < 8; i++) {
51 ; if(ptr0[i] != ptr1[i])
57 ; bool index_iteration_eq_variable_size_no_overlap(char const* ptr, size_t count) {
58 ; char const* ptr0 = ptr;
59 ; char const* ptr1 = ptr + count;
60 ; for(size_t i = 0; i < count; i++) {
61 ; if(ptr0[i] != ptr1[i])
66 ; bool index_iteration_eq_variable_size_partial_overlap(char const* ptr, size_t count) {
67 ; char const* ptr0 = ptr;
68 ; char const* ptr1 = ptr + count;
69 ; for(size_t i = 0; i < 2 * count; i++) {
70 ; if(ptr0[i] != ptr1[i])
75 ; bool index_iteration_eq_variable_size_overlap_unknown(char const* ptr0, char const* ptr1, size_t count) {
76 ; for(size_t i = 0; i < count; i++) {
77 ; if(ptr0[i] != ptr1[i])
83 ; bool index_iteration_starting_from_negative(char const* ptr0, char const* ptr1) {
84 ; for(int i = -4; i < 4; i++) {
85 ; if(ptr0[i] != ptr1[i])
91 ; bool combined_iteration_eq_const_size_no_overlap(char const* ptr) {
92 ; char const* ptr0 = ptr;
93 ; char const* ptr1 = ptr + 8;
94 ; for(size_t i = 0; i < 8; i++, ++ptr0, ++ptr1) {
100 ; bool combined_iteration_eq_const_size_partial_overlap(char const* ptr) {
101 ; char const* ptr0 = ptr;
102 ; char const* ptr1 = ptr + 8;
103 ; for(size_t i = 0; i < 16; i++, ++ptr0, ++ptr1) {
109 ; bool combined_iteration_eq_const_size_overlap_unknown(char const* ptr0, char const* ptr1) {
110 ; for(size_t i = 0; i < 8; i++, ++ptr0, ++ptr1) {
117 ; bool combined_iteration_eq_variable_size_no_overlap(char const* ptr, size_t count) {
118 ; char const* ptr0 = ptr;
119 ; char const* ptr1 = ptr + count;
120 ; for(size_t i = 0; i < count; i++, ++ptr0, ++ptr1) {
126 ; bool combined_iteration_eq_variable_size_partial_overlap(char const* ptr, size_t count) {
127 ; char const* ptr0 = ptr;
128 ; char const* ptr1 = ptr + count;
129 ; for(size_t i = 0; i < 2 * count; i++, ++ptr0, ++ptr1) {
135 ; bool combined_iteration_eq_variable_size_overlap_unknown(char const* ptr0, char const* ptr1, size_t count) {
136 ; for(size_t i = 0; i < count; i++, ++ptr0, ++ptr1) {
143 ; bool negated_pointer_iteration_variable_size_overlap_unknown(char const* ptr0, char const* ptr1, size_t count) {
144 ; return !std::equal(ptr0, ptr0 + count, ptr1);
147 ; bool integer_pointer_iteration_variable_size_overlap_unknown(int const* ptr0, int const* ptr1, size_t count) {
148 ; return std::equal(ptr0, ptr0 + count, ptr1);
151 ; bool small_index_iteration(char const* ptr0, char const* ptr1, int count) {
152 ; for(int i = 0; i < count; i++, ++ptr0, ++ptr1) {
159 ; bool three_pointer_iteration(char const* ptr0, char const* ptr0_end, char const* ptr1) {
160 ; return std::equal(ptr0, ptr0_end, ptr1);
163 ; int value_propagation(char const* ptr0, char const* ptr1, size_t count, int on_equal, int on_unequal) {
164 ; if(std::equal(ptr0, ptr0 + count, ptr1))
169 ; void callee_on_unequal();
170 ; void callee_on_success();
171 ; void multiple_exit_blocks(char const* ptr0, char const* ptr1, size_t count) {
172 ; if(!std::equal(ptr0, ptr0 + count, ptr1)) {
173 ; callee_on_unequal();
176 ; callee_on_success();
179 ; void multiple_phis(char const* ptr0, char const* ptr1, size_t count, char const* v0, char const* v1, char const* v2, char const* v3, char const** out0, char const** out1) {
180 ; char const *o0, *o1;
181 ; if(std::equal(ptr0, ptr0 + count, ptr1)) {
193 ; void loop_within_loop(size_t outer_count, char const** ptr0, char const** ptr1, size_t* count) {
194 ; for(size_t i = 0; i != outer_count; ++i)
195 ; sink(std::equal(ptr0[i], ptr0[i] + count[i], ptr1[i]));
198 ; void loop_within_loop_with_multiple_exit_blocks(size_t outer_count, char const** ptr0, char const** ptr1, size_t* count) {
199 ; for(size_t i = 0; i != outer_count; ++i) {
200 ; if(!std::equal(ptr0[i], ptr0[i] + count[i], ptr1[i])) {
201 ; callee_on_unequal();
204 ; callee_on_success();
208 ; void endless_loop_if_equal(int *a, int *b) {
210 ; for (int c = 0; c < 4; c++) {
217 ; bool load_of_bitcasts(char const* ptr0, float const* ptr1, size_t count) {
218 ; for(size_t i = 0; i < count; i++, ptr0 += sizeof(float), ptr1++) {
220 ; memcpy(&v0, ptr0, sizeof(float));
221 ; memcpy(&v1, ptr1, sizeof(float));
229 ; bool overlapping_loads(char const* ptr0, char const* ptr1, size_t count) {
230 ; for(size_t i = 0; i < count; i++, ptr0++, ptr1++) {
232 ; memcpy(&v0, ptr0, sizeof(float));
233 ; memcpy(&v1, ptr1, sizeof(float));
240 define i1 @_Z39pointer_iteration_const_size_no_overlapPKc(i8* %ptr) {
241 ; CHECK-LABEL: @_Z39pointer_iteration_const_size_no_overlapPKc(
242 ; CHECK-NEXT: for.body.i.i.bcmpdispatchbb:
243 ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i8, i8* [[PTR:%.*]], i64 8
244 ; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[PTR]], i8* [[ADD_PTR]], i64 8)
245 ; CHECK-NEXT: [[PTR_VS_ADD_PTR_EQCMP:%.*]] = icmp eq i32 [[MEMCMP]], 0
246 ; CHECK-NEXT: br i1 [[PTR_VS_ADD_PTR_EQCMP]], label [[PTR_VS_ADD_PTR_EQCMP_EQUALBB:%.*]], label [[PTR_VS_ADD_PTR_EQCMP_UNEQUALBB:%.*]]
247 ; CHECK: ptr.vs.add.ptr.eqcmp.equalbb:
248 ; CHECK-NEXT: br label [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT:%.*]]
249 ; CHECK: ptr.vs.add.ptr.eqcmp.unequalbb:
250 ; CHECK-NEXT: br label [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT]]
251 ; CHECK: _ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit:
252 ; CHECK-NEXT: [[RETVAL_0_I_I:%.*]] = phi i1 [ false, [[PTR_VS_ADD_PTR_EQCMP_UNEQUALBB]] ], [ true, [[PTR_VS_ADD_PTR_EQCMP_EQUALBB]] ]
253 ; CHECK-NEXT: ret i1 [[RETVAL_0_I_I]]
256 %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 8
257 br label %for.body.i.i
259 for.body.i.i: ; preds = %for.inc.i.i, %entry
260 %__first2.addr.07.i.i = phi i8* [ %incdec.ptr1.i.i, %for.inc.i.i ], [ %add.ptr, %entry ]
261 %__first1.addr.06.i.i.idx = phi i64 [ %__first1.addr.06.i.i.add, %for.inc.i.i ], [ 0, %entry ]
262 %__first1.addr.06.i.i.ptr = getelementptr inbounds i8, i8* %ptr, i64 %__first1.addr.06.i.i.idx
263 %v0 = load i8, i8* %__first1.addr.06.i.i.ptr
264 %v1 = load i8, i8* %__first2.addr.07.i.i
265 %cmp.i.i.i = icmp eq i8 %v0, %v1
266 br i1 %cmp.i.i.i, label %for.inc.i.i, label %_ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit
268 for.inc.i.i: ; preds = %for.body.i.i
269 %__first1.addr.06.i.i.add = add nuw nsw i64 %__first1.addr.06.i.i.idx, 1
270 %incdec.ptr1.i.i = getelementptr inbounds i8, i8* %__first2.addr.07.i.i, i64 1
271 %cmp.i.i = icmp eq i64 %__first1.addr.06.i.i.add, 8
272 br i1 %cmp.i.i, label %_ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit, label %for.body.i.i
274 _ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit: ; preds = %for.body.i.i, %for.inc.i.i
275 %retval.0.i.i = phi i1 [ false, %for.body.i.i ], [ true, %for.inc.i.i ]
279 define i1 @_Z44pointer_iteration_const_size_partial_overlapPKc(i8* %ptr) {
280 ; CHECK-LABEL: @_Z44pointer_iteration_const_size_partial_overlapPKc(
281 ; CHECK-NEXT: for.body.i.i.bcmpdispatchbb:
282 ; CHECK-NEXT: [[ADD_PTR1:%.*]] = getelementptr inbounds i8, i8* [[PTR:%.*]], i64 8
283 ; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[PTR]], i8* [[ADD_PTR1]], i64 16)
284 ; CHECK-NEXT: [[PTR_VS_ADD_PTR1_EQCMP:%.*]] = icmp eq i32 [[MEMCMP]], 0
285 ; CHECK-NEXT: br i1 [[PTR_VS_ADD_PTR1_EQCMP]], label [[PTR_VS_ADD_PTR1_EQCMP_EQUALBB:%.*]], label [[PTR_VS_ADD_PTR1_EQCMP_UNEQUALBB:%.*]]
286 ; CHECK: ptr.vs.add.ptr1.eqcmp.equalbb:
287 ; CHECK-NEXT: br label [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT:%.*]]
288 ; CHECK: ptr.vs.add.ptr1.eqcmp.unequalbb:
289 ; CHECK-NEXT: br label [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT]]
290 ; CHECK: _ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit:
291 ; CHECK-NEXT: [[RETVAL_0_I_I:%.*]] = phi i1 [ false, [[PTR_VS_ADD_PTR1_EQCMP_UNEQUALBB]] ], [ true, [[PTR_VS_ADD_PTR1_EQCMP_EQUALBB]] ]
292 ; CHECK-NEXT: ret i1 [[RETVAL_0_I_I]]
295 %add.ptr1 = getelementptr inbounds i8, i8* %ptr, i64 8
296 br label %for.body.i.i
298 for.body.i.i: ; preds = %for.inc.i.i, %entry
299 %__first2.addr.07.i.i = phi i8* [ %incdec.ptr1.i.i, %for.inc.i.i ], [ %add.ptr1, %entry ]
300 %__first1.addr.06.i.i.idx = phi i64 [ %__first1.addr.06.i.i.add, %for.inc.i.i ], [ 0, %entry ]
301 %__first1.addr.06.i.i.ptr = getelementptr inbounds i8, i8* %ptr, i64 %__first1.addr.06.i.i.idx
302 %v0 = load i8, i8* %__first1.addr.06.i.i.ptr
303 %v1 = load i8, i8* %__first2.addr.07.i.i
304 %cmp.i.i.i = icmp eq i8 %v0, %v1
305 br i1 %cmp.i.i.i, label %for.inc.i.i, label %_ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit
307 for.inc.i.i: ; preds = %for.body.i.i
308 %__first1.addr.06.i.i.add = add nuw nsw i64 %__first1.addr.06.i.i.idx, 1
309 %incdec.ptr1.i.i = getelementptr inbounds i8, i8* %__first2.addr.07.i.i, i64 1
310 %cmp.i.i = icmp eq i64 %__first1.addr.06.i.i.add, 16
311 br i1 %cmp.i.i, label %_ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit, label %for.body.i.i
313 _ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit: ; preds = %for.body.i.i, %for.inc.i.i
314 %retval.0.i.i = phi i1 [ false, %for.body.i.i ], [ true, %for.inc.i.i ]
318 define i1 @_Z44pointer_iteration_const_size_overlap_unknownPKcS0_(i8* %ptr0, i8* %ptr1) {
319 ; CHECK-LABEL: @_Z44pointer_iteration_const_size_overlap_unknownPKcS0_(
320 ; CHECK-NEXT: for.body.i.i.bcmpdispatchbb:
321 ; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[PTR0:%.*]], i8* [[PTR1:%.*]], i64 8)
322 ; CHECK-NEXT: [[PTR0_VS_PTR1_EQCMP:%.*]] = icmp eq i32 [[MEMCMP]], 0
323 ; CHECK-NEXT: br i1 [[PTR0_VS_PTR1_EQCMP]], label [[PTR0_VS_PTR1_EQCMP_EQUALBB:%.*]], label [[PTR0_VS_PTR1_EQCMP_UNEQUALBB:%.*]]
324 ; CHECK: ptr0.vs.ptr1.eqcmp.equalbb:
325 ; CHECK-NEXT: br label [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT:%.*]]
326 ; CHECK: ptr0.vs.ptr1.eqcmp.unequalbb:
327 ; CHECK-NEXT: br label [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT]]
328 ; CHECK: _ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit:
329 ; CHECK-NEXT: [[RETVAL_0_I_I:%.*]] = phi i1 [ false, [[PTR0_VS_PTR1_EQCMP_UNEQUALBB]] ], [ true, [[PTR0_VS_PTR1_EQCMP_EQUALBB]] ]
330 ; CHECK-NEXT: ret i1 [[RETVAL_0_I_I]]
333 br label %for.body.i.i
335 for.body.i.i: ; preds = %for.inc.i.i, %entry
336 %__first2.addr.07.i.i = phi i8* [ %incdec.ptr1.i.i, %for.inc.i.i ], [ %ptr1, %entry ]
337 %__first1.addr.06.i.i.idx = phi i64 [ %__first1.addr.06.i.i.add, %for.inc.i.i ], [ 0, %entry ]
338 %__first1.addr.06.i.i.ptr = getelementptr inbounds i8, i8* %ptr0, i64 %__first1.addr.06.i.i.idx
339 %v0 = load i8, i8* %__first1.addr.06.i.i.ptr
340 %v1 = load i8, i8* %__first2.addr.07.i.i
341 %cmp.i.i.i = icmp eq i8 %v0, %v1
342 br i1 %cmp.i.i.i, label %for.inc.i.i, label %_ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit
344 for.inc.i.i: ; preds = %for.body.i.i
345 %__first1.addr.06.i.i.add = add nuw nsw i64 %__first1.addr.06.i.i.idx, 1
346 %incdec.ptr1.i.i = getelementptr inbounds i8, i8* %__first2.addr.07.i.i, i64 1
347 %cmp.i.i = icmp eq i64 %__first1.addr.06.i.i.add, 8
348 br i1 %cmp.i.i, label %_ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit, label %for.body.i.i
350 _ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit: ; preds = %for.body.i.i, %for.inc.i.i
351 %retval.0.i.i = phi i1 [ false, %for.body.i.i ], [ true, %for.inc.i.i ]
355 define i1 @_Z42pointer_iteration_variable_size_no_overlapPKcm(i8* %ptr, i64 %count) {
356 ; CHECK-LABEL: @_Z42pointer_iteration_variable_size_no_overlapPKcm(
358 ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i8, i8* [[PTR:%.*]], i64 [[COUNT_BYTECOUNT:%.*]]
359 ; CHECK-NEXT: [[CMP5_I_I:%.*]] = icmp eq i64 [[COUNT_BYTECOUNT]], 0
360 ; CHECK-NEXT: br i1 [[CMP5_I_I]], label [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT:%.*]], label [[FOR_BODY_I_I_BCMPDISPATCHBB:%.*]]
361 ; CHECK: for.body.i.i.bcmpdispatchbb:
362 ; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[PTR]], i8* [[ADD_PTR]], i64 [[COUNT_BYTECOUNT]])
363 ; CHECK-NEXT: [[PTR_VS_ADD_PTR_EQCMP:%.*]] = icmp eq i32 [[MEMCMP]], 0
364 ; CHECK-NEXT: br i1 [[PTR_VS_ADD_PTR_EQCMP]], label [[PTR_VS_ADD_PTR_EQCMP_EQUALBB:%.*]], label [[PTR_VS_ADD_PTR_EQCMP_UNEQUALBB:%.*]]
365 ; CHECK: ptr.vs.add.ptr.eqcmp.equalbb:
366 ; CHECK-NEXT: br label [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT_LOOPEXIT:%.*]]
367 ; CHECK: ptr.vs.add.ptr.eqcmp.unequalbb:
368 ; CHECK-NEXT: br label [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT_LOOPEXIT]]
369 ; CHECK: _ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit.loopexit:
370 ; CHECK-NEXT: [[RETVAL_0_I_I_PH:%.*]] = phi i1 [ false, [[PTR_VS_ADD_PTR_EQCMP_UNEQUALBB]] ], [ true, [[PTR_VS_ADD_PTR_EQCMP_EQUALBB]] ]
371 ; CHECK-NEXT: br label [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT]]
372 ; CHECK: _ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit:
373 ; CHECK-NEXT: [[RETVAL_0_I_I:%.*]] = phi i1 [ true, [[ENTRY:%.*]] ], [ [[RETVAL_0_I_I_PH]], [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT_LOOPEXIT]] ]
374 ; CHECK-NEXT: ret i1 [[RETVAL_0_I_I]]
377 %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 %count
378 %cmp5.i.i = icmp eq i64 %count, 0
379 br i1 %cmp5.i.i, label %_ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit, label %for.body.i.i
381 for.body.i.i: ; preds = %entry, %for.inc.i.i
382 %__first2.addr.07.i.i = phi i8* [ %incdec.ptr1.i.i, %for.inc.i.i ], [ %add.ptr, %entry ]
383 %__first1.addr.06.i.i = phi i8* [ %incdec.ptr.i.i, %for.inc.i.i ], [ %ptr, %entry ]
384 %v0 = load i8, i8* %__first1.addr.06.i.i
385 %v1 = load i8, i8* %__first2.addr.07.i.i
386 %cmp.i.i.i = icmp eq i8 %v0, %v1
387 br i1 %cmp.i.i.i, label %for.inc.i.i, label %_ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit
389 for.inc.i.i: ; preds = %for.body.i.i
390 %incdec.ptr.i.i = getelementptr inbounds i8, i8* %__first1.addr.06.i.i, i64 1
391 %incdec.ptr1.i.i = getelementptr inbounds i8, i8* %__first2.addr.07.i.i, i64 1
392 %cmp.i.i = icmp eq i8* %incdec.ptr.i.i, %add.ptr
393 br i1 %cmp.i.i, label %_ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit, label %for.body.i.i
395 _ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit: ; preds = %for.body.i.i, %for.inc.i.i, %entry
396 %retval.0.i.i = phi i1 [ true, %entry ], [ true, %for.inc.i.i ], [ false, %for.body.i.i ]
400 define i1 @_Z47pointer_iteration_variable_size_partial_overlapPKcm(i8* %ptr, i64 %count) {
401 ; CHECK-LABEL: @_Z47pointer_iteration_variable_size_partial_overlapPKcm(
403 ; CHECK-NEXT: [[MUL_BYTECOUNT:%.*]] = shl i64 [[COUNT:%.*]], 1
404 ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i8, i8* [[PTR:%.*]], i64 [[MUL_BYTECOUNT]]
405 ; CHECK-NEXT: [[CMP5_I_I:%.*]] = icmp eq i64 [[MUL_BYTECOUNT]], 0
406 ; CHECK-NEXT: br i1 [[CMP5_I_I]], label [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT:%.*]], label [[FOR_BODY_I_I_BCMPDISPATCHBB:%.*]]
407 ; CHECK: for.body.i.i.bcmpdispatchbb:
408 ; CHECK-NEXT: [[ADD_PTR1:%.*]] = getelementptr inbounds i8, i8* [[PTR]], i64 [[COUNT]]
409 ; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[PTR]], i8* [[ADD_PTR1]], i64 [[MUL_BYTECOUNT]])
410 ; CHECK-NEXT: [[PTR_VS_ADD_PTR1_EQCMP:%.*]] = icmp eq i32 [[MEMCMP]], 0
411 ; CHECK-NEXT: br i1 [[PTR_VS_ADD_PTR1_EQCMP]], label [[PTR_VS_ADD_PTR1_EQCMP_EQUALBB:%.*]], label [[PTR_VS_ADD_PTR1_EQCMP_UNEQUALBB:%.*]]
412 ; CHECK: ptr.vs.add.ptr1.eqcmp.equalbb:
413 ; CHECK-NEXT: br label [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT_LOOPEXIT:%.*]]
414 ; CHECK: ptr.vs.add.ptr1.eqcmp.unequalbb:
415 ; CHECK-NEXT: br label [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT_LOOPEXIT]]
416 ; CHECK: _ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit.loopexit:
417 ; CHECK-NEXT: [[RETVAL_0_I_I_PH:%.*]] = phi i1 [ false, [[PTR_VS_ADD_PTR1_EQCMP_UNEQUALBB]] ], [ true, [[PTR_VS_ADD_PTR1_EQCMP_EQUALBB]] ]
418 ; CHECK-NEXT: br label [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT]]
419 ; CHECK: _ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit:
420 ; CHECK-NEXT: [[RETVAL_0_I_I:%.*]] = phi i1 [ true, [[ENTRY:%.*]] ], [ [[RETVAL_0_I_I_PH]], [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT_LOOPEXIT]] ]
421 ; CHECK-NEXT: ret i1 [[RETVAL_0_I_I]]
424 %mul = shl i64 %count, 1
425 %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 %mul
426 %cmp5.i.i = icmp eq i64 %mul, 0
427 br i1 %cmp5.i.i, label %_ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit, label %for.body.i.i.preheader
429 for.body.i.i.preheader: ; preds = %entry
430 %add.ptr1 = getelementptr inbounds i8, i8* %ptr, i64 %count
431 br label %for.body.i.i
433 for.body.i.i: ; preds = %for.body.i.i.preheader, %for.inc.i.i
434 %__first2.addr.07.i.i = phi i8* [ %incdec.ptr1.i.i, %for.inc.i.i ], [ %add.ptr1, %for.body.i.i.preheader ]
435 %__first1.addr.06.i.i = phi i8* [ %incdec.ptr.i.i, %for.inc.i.i ], [ %ptr, %for.body.i.i.preheader ]
436 %v0 = load i8, i8* %__first1.addr.06.i.i
437 %v1 = load i8, i8* %__first2.addr.07.i.i
438 %cmp.i.i.i = icmp eq i8 %v0, %v1
439 br i1 %cmp.i.i.i, label %for.inc.i.i, label %_ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit
441 for.inc.i.i: ; preds = %for.body.i.i
442 %incdec.ptr.i.i = getelementptr inbounds i8, i8* %__first1.addr.06.i.i, i64 1
443 %incdec.ptr1.i.i = getelementptr inbounds i8, i8* %__first2.addr.07.i.i, i64 1
444 %cmp.i.i = icmp eq i8* %incdec.ptr.i.i, %add.ptr
445 br i1 %cmp.i.i, label %_ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit, label %for.body.i.i
447 _ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit: ; preds = %for.body.i.i, %for.inc.i.i, %entry
448 %retval.0.i.i = phi i1 [ true, %entry ], [ true, %for.inc.i.i ], [ false, %for.body.i.i ]
452 define i1 @_Z47pointer_iteration_variable_size_overlap_unknownPKcS0_m(i8* %ptr0, i8* %ptr1, i64 %count) {
453 ; CHECK-LABEL: @_Z47pointer_iteration_variable_size_overlap_unknownPKcS0_m(
455 ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i8, i8* [[PTR0:%.*]], i64 [[COUNT_BYTECOUNT:%.*]]
456 ; CHECK-NEXT: [[CMP5_I_I:%.*]] = icmp eq i64 [[COUNT_BYTECOUNT]], 0
457 ; CHECK-NEXT: br i1 [[CMP5_I_I]], label [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT:%.*]], label [[FOR_BODY_I_I_BCMPDISPATCHBB:%.*]]
458 ; CHECK: for.body.i.i.bcmpdispatchbb:
459 ; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[PTR0]], i8* [[PTR1:%.*]], i64 [[COUNT_BYTECOUNT]])
460 ; CHECK-NEXT: [[PTR0_VS_PTR1_EQCMP:%.*]] = icmp eq i32 [[MEMCMP]], 0
461 ; CHECK-NEXT: br i1 [[PTR0_VS_PTR1_EQCMP]], label [[PTR0_VS_PTR1_EQCMP_EQUALBB:%.*]], label [[PTR0_VS_PTR1_EQCMP_UNEQUALBB:%.*]]
462 ; CHECK: ptr0.vs.ptr1.eqcmp.equalbb:
463 ; CHECK-NEXT: br label [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT_LOOPEXIT:%.*]]
464 ; CHECK: ptr0.vs.ptr1.eqcmp.unequalbb:
465 ; CHECK-NEXT: br label [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT_LOOPEXIT]]
466 ; CHECK: _ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit.loopexit:
467 ; CHECK-NEXT: [[RETVAL_0_I_I_PH:%.*]] = phi i1 [ false, [[PTR0_VS_PTR1_EQCMP_UNEQUALBB]] ], [ true, [[PTR0_VS_PTR1_EQCMP_EQUALBB]] ]
468 ; CHECK-NEXT: br label [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT]]
469 ; CHECK: _ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit:
470 ; CHECK-NEXT: [[RETVAL_0_I_I:%.*]] = phi i1 [ true, [[ENTRY:%.*]] ], [ [[RETVAL_0_I_I_PH]], [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT_LOOPEXIT]] ]
471 ; CHECK-NEXT: ret i1 [[RETVAL_0_I_I]]
474 %add.ptr = getelementptr inbounds i8, i8* %ptr0, i64 %count
475 %cmp5.i.i = icmp eq i64 %count, 0
476 br i1 %cmp5.i.i, label %_ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit, label %for.body.i.i
478 for.body.i.i: ; preds = %entry, %for.inc.i.i
479 %__first2.addr.07.i.i = phi i8* [ %incdec.ptr1.i.i, %for.inc.i.i ], [ %ptr1, %entry ]
480 %__first1.addr.06.i.i = phi i8* [ %incdec.ptr.i.i, %for.inc.i.i ], [ %ptr0, %entry ]
481 %v0 = load i8, i8* %__first1.addr.06.i.i
482 %v1 = load i8, i8* %__first2.addr.07.i.i
483 %cmp.i.i.i = icmp eq i8 %v0, %v1
484 br i1 %cmp.i.i.i, label %for.inc.i.i, label %_ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit
486 for.inc.i.i: ; preds = %for.body.i.i
487 %incdec.ptr.i.i = getelementptr inbounds i8, i8* %__first1.addr.06.i.i, i64 1
488 %incdec.ptr1.i.i = getelementptr inbounds i8, i8* %__first2.addr.07.i.i, i64 1
489 %cmp.i.i = icmp eq i8* %incdec.ptr.i.i, %add.ptr
490 br i1 %cmp.i.i, label %_ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit, label %for.body.i.i
492 _ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit: ; preds = %for.body.i.i, %for.inc.i.i, %entry
493 %retval.0.i.i = phi i1 [ true, %entry ], [ true, %for.inc.i.i ], [ false, %for.body.i.i ]
497 define i1 @_Z40index_iteration_eq_const_size_no_overlapPKc(i8* %ptr) {
498 ; CHECK-LABEL: @_Z40index_iteration_eq_const_size_no_overlapPKc(
499 ; CHECK-NEXT: for.body.bcmpdispatchbb:
500 ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i8, i8* [[PTR:%.*]], i64 8
501 ; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[PTR]], i8* [[ADD_PTR]], i64 8)
502 ; CHECK-NEXT: [[PTR_VS_ADD_PTR_EQCMP:%.*]] = icmp eq i32 [[MEMCMP]], 0
503 ; CHECK-NEXT: br i1 [[PTR_VS_ADD_PTR_EQCMP]], label [[PTR_VS_ADD_PTR_EQCMP_EQUALBB:%.*]], label [[PTR_VS_ADD_PTR_EQCMP_UNEQUALBB:%.*]]
504 ; CHECK: ptr.vs.add.ptr.eqcmp.equalbb:
505 ; CHECK-NEXT: br label [[CLEANUP:%.*]]
506 ; CHECK: ptr.vs.add.ptr.eqcmp.unequalbb:
507 ; CHECK-NEXT: br label [[CLEANUP]]
509 ; CHECK-NEXT: [[RES:%.*]] = phi i1 [ false, [[PTR_VS_ADD_PTR_EQCMP_UNEQUALBB]] ], [ true, [[PTR_VS_ADD_PTR_EQCMP_EQUALBB]] ]
510 ; CHECK-NEXT: ret i1 [[RES]]
513 %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 8
516 for.cond: ; preds = %for.body
517 %cmp = icmp ult i64 %inc, 8
518 br i1 %cmp, label %for.body, label %cleanup
520 for.body: ; preds = %entry, %for.cond
521 %i.013 = phi i64 [ 0, %entry ], [ %inc, %for.cond ]
522 %arrayidx = getelementptr inbounds i8, i8* %ptr, i64 %i.013
523 %v0 = load i8, i8* %arrayidx
524 %arrayidx1 = getelementptr inbounds i8, i8* %add.ptr, i64 %i.013
525 %v1 = load i8, i8* %arrayidx1
526 %cmp3 = icmp eq i8 %v0, %v1
527 %inc = add nuw nsw i64 %i.013, 1
528 br i1 %cmp3, label %for.cond, label %cleanup
530 cleanup: ; preds = %for.cond, %for.body
531 %res = phi i1 [ false, %for.body ], [ true, %for.cond ]
535 define i1 @_Z45index_iteration_eq_const_size_partial_overlapPKc(i8* %ptr) {
536 ; CHECK-LABEL: @_Z45index_iteration_eq_const_size_partial_overlapPKc(
537 ; CHECK-NEXT: for.body.bcmpdispatchbb:
538 ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i8, i8* [[PTR:%.*]], i64 8
539 ; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[PTR]], i8* [[ADD_PTR]], i64 16)
540 ; CHECK-NEXT: [[PTR_VS_ADD_PTR_EQCMP:%.*]] = icmp eq i32 [[MEMCMP]], 0
541 ; CHECK-NEXT: br i1 [[PTR_VS_ADD_PTR_EQCMP]], label [[PTR_VS_ADD_PTR_EQCMP_EQUALBB:%.*]], label [[PTR_VS_ADD_PTR_EQCMP_UNEQUALBB:%.*]]
542 ; CHECK: ptr.vs.add.ptr.eqcmp.equalbb:
543 ; CHECK-NEXT: br label [[CLEANUP:%.*]]
544 ; CHECK: ptr.vs.add.ptr.eqcmp.unequalbb:
545 ; CHECK-NEXT: br label [[CLEANUP]]
547 ; CHECK-NEXT: [[RES:%.*]] = phi i1 [ false, [[PTR_VS_ADD_PTR_EQCMP_UNEQUALBB]] ], [ true, [[PTR_VS_ADD_PTR_EQCMP_EQUALBB]] ]
548 ; CHECK-NEXT: ret i1 [[RES]]
551 %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 8
554 for.cond: ; preds = %for.body
555 %cmp = icmp ult i64 %inc, 16
556 br i1 %cmp, label %for.body, label %cleanup
558 for.body: ; preds = %entry, %for.cond
559 %i.013 = phi i64 [ 0, %entry ], [ %inc, %for.cond ]
560 %arrayidx = getelementptr inbounds i8, i8* %ptr, i64 %i.013
561 %v0 = load i8, i8* %arrayidx
562 %arrayidx1 = getelementptr inbounds i8, i8* %add.ptr, i64 %i.013
563 %v1 = load i8, i8* %arrayidx1
564 %cmp3 = icmp eq i8 %v0, %v1
565 %inc = add nuw nsw i64 %i.013, 1
566 br i1 %cmp3, label %for.cond, label %cleanup
568 cleanup: ; preds = %for.cond, %for.body
569 %res = phi i1 [ false, %for.body ], [ true, %for.cond ]
573 define i1 @_Z45index_iteration_eq_const_size_overlap_unknownPKcS0_(i8* %ptr0, i8* %ptr1) {
574 ; CHECK-LABEL: @_Z45index_iteration_eq_const_size_overlap_unknownPKcS0_(
575 ; CHECK-NEXT: for.body.bcmpdispatchbb:
576 ; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[PTR0:%.*]], i8* [[PTR1:%.*]], i64 8)
577 ; CHECK-NEXT: [[PTR0_VS_PTR1_EQCMP:%.*]] = icmp eq i32 [[MEMCMP]], 0
578 ; CHECK-NEXT: br i1 [[PTR0_VS_PTR1_EQCMP]], label [[PTR0_VS_PTR1_EQCMP_EQUALBB:%.*]], label [[PTR0_VS_PTR1_EQCMP_UNEQUALBB:%.*]]
579 ; CHECK: ptr0.vs.ptr1.eqcmp.equalbb:
580 ; CHECK-NEXT: br label [[CLEANUP:%.*]]
581 ; CHECK: ptr0.vs.ptr1.eqcmp.unequalbb:
582 ; CHECK-NEXT: br label [[CLEANUP]]
584 ; CHECK-NEXT: [[RES:%.*]] = phi i1 [ false, [[PTR0_VS_PTR1_EQCMP_UNEQUALBB]] ], [ true, [[PTR0_VS_PTR1_EQCMP_EQUALBB]] ]
585 ; CHECK-NEXT: ret i1 [[RES]]
590 for.cond: ; preds = %for.body
591 %cmp = icmp ult i64 %inc, 8
592 br i1 %cmp, label %for.body, label %cleanup
594 for.body: ; preds = %entry, %for.cond
595 %i.08 = phi i64 [ 0, %entry ], [ %inc, %for.cond ]
596 %arrayidx = getelementptr inbounds i8, i8* %ptr0, i64 %i.08
597 %v0 = load i8, i8* %arrayidx
598 %arrayidx1 = getelementptr inbounds i8, i8* %ptr1, i64 %i.08
599 %v1 = load i8, i8* %arrayidx1
600 %cmp3 = icmp eq i8 %v0, %v1
601 %inc = add nuw nsw i64 %i.08, 1
602 br i1 %cmp3, label %for.cond, label %cleanup
604 cleanup: ; preds = %for.cond, %for.body
605 %res = phi i1 [ false, %for.body ], [ true, %for.cond ]
609 define i1 @_Z43index_iteration_eq_variable_size_no_overlapPKcm(i8* %ptr, i64 %count) {
610 ; CHECK-LABEL: @_Z43index_iteration_eq_variable_size_no_overlapPKcm(
612 ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i8, i8* [[PTR:%.*]], i64 [[COUNT_BYTECOUNT:%.*]]
613 ; CHECK-NEXT: [[CMP14:%.*]] = icmp eq i64 [[COUNT_BYTECOUNT]], 0
614 ; CHECK-NEXT: br i1 [[CMP14]], label [[CLEANUP:%.*]], label [[FOR_BODY_BCMPDISPATCHBB:%.*]]
615 ; CHECK: for.body.bcmpdispatchbb:
616 ; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[PTR]], i8* [[ADD_PTR]], i64 [[COUNT_BYTECOUNT]])
617 ; CHECK-NEXT: [[PTR_VS_ADD_PTR_EQCMP:%.*]] = icmp eq i32 [[MEMCMP]], 0
618 ; CHECK-NEXT: br i1 [[PTR_VS_ADD_PTR_EQCMP]], label [[PTR_VS_ADD_PTR_EQCMP_EQUALBB:%.*]], label [[PTR_VS_ADD_PTR_EQCMP_UNEQUALBB:%.*]]
619 ; CHECK: ptr.vs.add.ptr.eqcmp.equalbb:
620 ; CHECK-NEXT: br label [[CLEANUP_LOOPEXIT:%.*]]
621 ; CHECK: ptr.vs.add.ptr.eqcmp.unequalbb:
622 ; CHECK-NEXT: br label [[CLEANUP_LOOPEXIT]]
623 ; CHECK: cleanup.loopexit:
624 ; CHECK-NEXT: [[RES_PH:%.*]] = phi i1 [ false, [[PTR_VS_ADD_PTR_EQCMP_UNEQUALBB]] ], [ true, [[PTR_VS_ADD_PTR_EQCMP_EQUALBB]] ]
625 ; CHECK-NEXT: br label [[CLEANUP]]
627 ; CHECK-NEXT: [[RES:%.*]] = phi i1 [ true, [[ENTRY:%.*]] ], [ [[RES_PH]], [[CLEANUP_LOOPEXIT]] ]
628 ; CHECK-NEXT: ret i1 [[RES]]
631 %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 %count
632 %cmp14 = icmp eq i64 %count, 0
633 br i1 %cmp14, label %cleanup, label %for.body
635 for.cond: ; preds = %for.body
636 %cmp = icmp ult i64 %inc, %count
637 br i1 %cmp, label %for.body, label %cleanup
639 for.body: ; preds = %entry, %for.cond
640 %i.015 = phi i64 [ %inc, %for.cond ], [ 0, %entry ]
641 %arrayidx = getelementptr inbounds i8, i8* %ptr, i64 %i.015
642 %v0 = load i8, i8* %arrayidx
643 %arrayidx1 = getelementptr inbounds i8, i8* %add.ptr, i64 %i.015
644 %v1 = load i8, i8* %arrayidx1
645 %cmp3 = icmp eq i8 %v0, %v1
646 %inc = add nuw i64 %i.015, 1
647 br i1 %cmp3, label %for.cond, label %cleanup
649 cleanup: ; preds = %for.body, %for.cond, %entry
650 %res = phi i1 [ true, %entry ], [ true, %for.cond ], [ false, %for.body ]
654 define i1 @_Z48index_iteration_eq_variable_size_partial_overlapPKcm(i8* %ptr, i64 %count) {
655 ; CHECK-LABEL: @_Z48index_iteration_eq_variable_size_partial_overlapPKcm(
657 ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i8, i8* [[PTR:%.*]], i64 [[COUNT:%.*]]
658 ; CHECK-NEXT: [[MUL_BYTECOUNT:%.*]] = shl i64 [[COUNT]], 1
659 ; CHECK-NEXT: [[CMP14:%.*]] = icmp eq i64 [[MUL_BYTECOUNT]], 0
660 ; CHECK-NEXT: br i1 [[CMP14]], label [[CLEANUP:%.*]], label [[FOR_BODY_BCMPDISPATCHBB:%.*]]
661 ; CHECK: for.body.bcmpdispatchbb:
662 ; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[PTR]], i8* [[ADD_PTR]], i64 [[MUL_BYTECOUNT]])
663 ; CHECK-NEXT: [[PTR_VS_ADD_PTR_EQCMP:%.*]] = icmp eq i32 [[MEMCMP]], 0
664 ; CHECK-NEXT: br i1 [[PTR_VS_ADD_PTR_EQCMP]], label [[PTR_VS_ADD_PTR_EQCMP_EQUALBB:%.*]], label [[PTR_VS_ADD_PTR_EQCMP_UNEQUALBB:%.*]]
665 ; CHECK: ptr.vs.add.ptr.eqcmp.equalbb:
666 ; CHECK-NEXT: br label [[CLEANUP_LOOPEXIT:%.*]]
667 ; CHECK: ptr.vs.add.ptr.eqcmp.unequalbb:
668 ; CHECK-NEXT: br label [[CLEANUP_LOOPEXIT]]
669 ; CHECK: cleanup.loopexit:
670 ; CHECK-NEXT: [[RES_PH:%.*]] = phi i1 [ false, [[PTR_VS_ADD_PTR_EQCMP_UNEQUALBB]] ], [ true, [[PTR_VS_ADD_PTR_EQCMP_EQUALBB]] ]
671 ; CHECK-NEXT: br label [[CLEANUP]]
673 ; CHECK-NEXT: [[RES:%.*]] = phi i1 [ true, [[ENTRY:%.*]] ], [ [[RES_PH]], [[CLEANUP_LOOPEXIT]] ]
674 ; CHECK-NEXT: ret i1 [[RES]]
677 %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 %count
678 %mul = shl i64 %count, 1
679 %cmp14 = icmp eq i64 %mul, 0
680 br i1 %cmp14, label %cleanup, label %for.body
682 for.cond: ; preds = %for.body
683 %cmp = icmp ult i64 %inc, %mul
684 br i1 %cmp, label %for.body, label %cleanup
686 for.body: ; preds = %entry, %for.cond
687 %i.015 = phi i64 [ %inc, %for.cond ], [ 0, %entry ]
688 %arrayidx = getelementptr inbounds i8, i8* %ptr, i64 %i.015
689 %v0 = load i8, i8* %arrayidx
690 %arrayidx1 = getelementptr inbounds i8, i8* %add.ptr, i64 %i.015
691 %v1 = load i8, i8* %arrayidx1
692 %cmp3 = icmp eq i8 %v0, %v1
693 %inc = add nuw i64 %i.015, 1
694 br i1 %cmp3, label %for.cond, label %cleanup
696 cleanup: ; preds = %for.body, %for.cond, %entry
697 %res = phi i1 [ true, %entry ], [ true, %for.cond ], [ false, %for.body ]
701 define i1 @_Z48index_iteration_eq_variable_size_overlap_unknownPKcS0_m(i8* %ptr0, i8* %ptr1, i64 %count) {
702 ; CHECK-LABEL: @_Z48index_iteration_eq_variable_size_overlap_unknownPKcS0_m(
704 ; CHECK-NEXT: [[CMP8:%.*]] = icmp eq i64 [[COUNT_BYTECOUNT:%.*]], 0
705 ; CHECK-NEXT: br i1 [[CMP8]], label [[CLEANUP:%.*]], label [[FOR_BODY_BCMPDISPATCHBB:%.*]]
706 ; CHECK: for.body.bcmpdispatchbb:
707 ; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[PTR0:%.*]], i8* [[PTR1:%.*]], i64 [[COUNT_BYTECOUNT]])
708 ; CHECK-NEXT: [[PTR0_VS_PTR1_EQCMP:%.*]] = icmp eq i32 [[MEMCMP]], 0
709 ; CHECK-NEXT: br i1 [[PTR0_VS_PTR1_EQCMP]], label [[PTR0_VS_PTR1_EQCMP_EQUALBB:%.*]], label [[PTR0_VS_PTR1_EQCMP_UNEQUALBB:%.*]]
710 ; CHECK: ptr0.vs.ptr1.eqcmp.equalbb:
711 ; CHECK-NEXT: br label [[CLEANUP_LOOPEXIT:%.*]]
712 ; CHECK: ptr0.vs.ptr1.eqcmp.unequalbb:
713 ; CHECK-NEXT: br label [[CLEANUP_LOOPEXIT]]
714 ; CHECK: cleanup.loopexit:
715 ; CHECK-NEXT: [[RES_PH:%.*]] = phi i1 [ false, [[PTR0_VS_PTR1_EQCMP_UNEQUALBB]] ], [ true, [[PTR0_VS_PTR1_EQCMP_EQUALBB]] ]
716 ; CHECK-NEXT: br label [[CLEANUP]]
718 ; CHECK-NEXT: [[RES:%.*]] = phi i1 [ true, [[ENTRY:%.*]] ], [ [[RES_PH]], [[CLEANUP_LOOPEXIT]] ]
719 ; CHECK-NEXT: ret i1 [[RES]]
722 %cmp8 = icmp eq i64 %count, 0
723 br i1 %cmp8, label %cleanup, label %for.body
725 for.cond: ; preds = %for.body
726 %cmp = icmp ult i64 %inc, %count
727 br i1 %cmp, label %for.body, label %cleanup
729 for.body: ; preds = %entry, %for.cond
730 %i.09 = phi i64 [ %inc, %for.cond ], [ 0, %entry ]
731 %arrayidx = getelementptr inbounds i8, i8* %ptr0, i64 %i.09
732 %v0 = load i8, i8* %arrayidx
733 %arrayidx1 = getelementptr inbounds i8, i8* %ptr1, i64 %i.09
734 %v1 = load i8, i8* %arrayidx1
735 %cmp3 = icmp eq i8 %v0, %v1
736 %inc = add nuw i64 %i.09, 1
737 br i1 %cmp3, label %for.cond, label %cleanup
739 cleanup: ; preds = %for.body, %for.cond, %entry
740 %res = phi i1 [ true, %entry ], [ true, %for.cond ], [ false, %for.body ]
744 define i1 @_Z38index_iteration_starting_from_negativePKcS0_(i8* %ptr0, i8* %ptr1) {
745 ; CHECK-LABEL: @_Z38index_iteration_starting_from_negativePKcS0_(
746 ; CHECK-NEXT: for.body.bcmpdispatchbb:
747 ; CHECK-NEXT: [[SCEVGEP:%.*]] = getelementptr i8, i8* [[PTR0:%.*]], i64 -4
748 ; CHECK-NEXT: [[SCEVGEP1:%.*]] = getelementptr i8, i8* [[PTR1:%.*]], i64 -4
749 ; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[SCEVGEP]], i8* [[SCEVGEP1]], i64 8)
750 ; CHECK-NEXT: [[SCEVGEP_VS_SCEVGEP1_EQCMP:%.*]] = icmp eq i32 [[MEMCMP]], 0
751 ; CHECK-NEXT: br i1 [[SCEVGEP_VS_SCEVGEP1_EQCMP]], label [[SCEVGEP_VS_SCEVGEP1_EQCMP_EQUALBB:%.*]], label [[SCEVGEP_VS_SCEVGEP1_EQCMP_UNEQUALBB:%.*]]
752 ; CHECK: scevgep.vs.scevgep1.eqcmp.equalbb:
753 ; CHECK-NEXT: br label [[CLEANUP:%.*]]
754 ; CHECK: scevgep.vs.scevgep1.eqcmp.unequalbb:
755 ; CHECK-NEXT: br label [[CLEANUP]]
757 ; CHECK-NEXT: [[RET:%.*]] = phi i1 [ false, [[SCEVGEP_VS_SCEVGEP1_EQCMP_UNEQUALBB]] ], [ true, [[SCEVGEP_VS_SCEVGEP1_EQCMP_EQUALBB]] ]
758 ; CHECK-NEXT: ret i1 [[RET]]
763 for.cond: ; preds = %for.body
764 %cmp = icmp slt i64 %indvars.iv.next, 4
765 br i1 %cmp, label %for.body, label %cleanup
767 for.body: ; preds = %entry, %for.cond
768 %indvars.iv = phi i64 [ -4, %entry ], [ %indvars.iv.next, %for.cond ]
769 %arrayidx = getelementptr inbounds i8, i8* %ptr0, i64 %indvars.iv
770 %v0 = load i8, i8* %arrayidx
771 %arrayidx2 = getelementptr inbounds i8, i8* %ptr1, i64 %indvars.iv
772 %v1 = load i8, i8* %arrayidx2
773 %cmp4 = icmp eq i8 %v0, %v1
774 %indvars.iv.next = add nsw i64 %indvars.iv, 1
775 br i1 %cmp4, label %for.cond, label %cleanup
777 cleanup: ; preds = %for.cond, %for.body
778 %ret = phi i1 [ false, %for.body ], [ true, %for.cond ]
782 define i1 @_Z43combined_iteration_eq_const_size_no_overlapPKc(i8* %ptr) {
783 ; CHECK-LABEL: @_Z43combined_iteration_eq_const_size_no_overlapPKc(
784 ; CHECK-NEXT: for.body.bcmpdispatchbb:
785 ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i8, i8* [[PTR:%.*]], i64 8
786 ; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[PTR]], i8* [[ADD_PTR]], i64 8)
787 ; CHECK-NEXT: [[PTR_VS_ADD_PTR_EQCMP:%.*]] = icmp eq i32 [[MEMCMP]], 0
788 ; CHECK-NEXT: br i1 [[PTR_VS_ADD_PTR_EQCMP]], label [[PTR_VS_ADD_PTR_EQCMP_EQUALBB:%.*]], label [[PTR_VS_ADD_PTR_EQCMP_UNEQUALBB:%.*]]
789 ; CHECK: ptr.vs.add.ptr.eqcmp.equalbb:
790 ; CHECK-NEXT: br label [[CLEANUP:%.*]]
791 ; CHECK: ptr.vs.add.ptr.eqcmp.unequalbb:
792 ; CHECK-NEXT: br label [[CLEANUP]]
794 ; CHECK-NEXT: [[RES:%.*]] = phi i1 [ false, [[PTR_VS_ADD_PTR_EQCMP_UNEQUALBB]] ], [ true, [[PTR_VS_ADD_PTR_EQCMP_EQUALBB]] ]
795 ; CHECK-NEXT: ret i1 [[RES]]
798 %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 8
801 for.body: ; preds = %entry, %for.inc
802 %i.015 = phi i64 [ 0, %entry ], [ %inc, %for.inc ]
803 %ptr1.014 = phi i8* [ %add.ptr, %entry ], [ %incdec.ptr3, %for.inc ]
804 %ptr0.013 = phi i8* [ %ptr, %entry ], [ %incdec.ptr, %for.inc ]
805 %v0 = load i8, i8* %ptr0.013
806 %v1 = load i8, i8* %ptr1.014
807 %cmp2 = icmp eq i8 %v0, %v1
808 br i1 %cmp2, label %for.inc, label %cleanup
810 for.inc: ; preds = %for.body
811 %inc = add nuw nsw i64 %i.015, 1
812 %incdec.ptr = getelementptr inbounds i8, i8* %ptr0.013, i64 1
813 %incdec.ptr3 = getelementptr inbounds i8, i8* %ptr1.014, i64 1
814 %cmp = icmp ult i64 %inc, 8
815 br i1 %cmp, label %for.body, label %cleanup
817 cleanup: ; preds = %for.inc, %for.body
818 %res = phi i1 [ false, %for.body ], [ true, %for.inc ]
822 define i1 @_Z48combined_iteration_eq_const_size_partial_overlapPKc(i8* %ptr) {
823 ; CHECK-LABEL: @_Z48combined_iteration_eq_const_size_partial_overlapPKc(
824 ; CHECK-NEXT: for.body.bcmpdispatchbb:
825 ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i8, i8* [[PTR:%.*]], i64 8
826 ; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[PTR]], i8* [[ADD_PTR]], i64 16)
827 ; CHECK-NEXT: [[PTR_VS_ADD_PTR_EQCMP:%.*]] = icmp eq i32 [[MEMCMP]], 0
828 ; CHECK-NEXT: br i1 [[PTR_VS_ADD_PTR_EQCMP]], label [[PTR_VS_ADD_PTR_EQCMP_EQUALBB:%.*]], label [[PTR_VS_ADD_PTR_EQCMP_UNEQUALBB:%.*]]
829 ; CHECK: ptr.vs.add.ptr.eqcmp.equalbb:
830 ; CHECK-NEXT: br label [[CLEANUP:%.*]]
831 ; CHECK: ptr.vs.add.ptr.eqcmp.unequalbb:
832 ; CHECK-NEXT: br label [[CLEANUP]]
834 ; CHECK-NEXT: [[RES:%.*]] = phi i1 [ false, [[PTR_VS_ADD_PTR_EQCMP_UNEQUALBB]] ], [ true, [[PTR_VS_ADD_PTR_EQCMP_EQUALBB]] ]
835 ; CHECK-NEXT: ret i1 [[RES]]
838 %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 8
841 for.body: ; preds = %entry, %for.inc
842 %i.015 = phi i64 [ 0, %entry ], [ %inc, %for.inc ]
843 %ptr1.014 = phi i8* [ %add.ptr, %entry ], [ %incdec.ptr3, %for.inc ]
844 %ptr0.013 = phi i8* [ %ptr, %entry ], [ %incdec.ptr, %for.inc ]
845 %v0 = load i8, i8* %ptr0.013
846 %v1 = load i8, i8* %ptr1.014
847 %cmp2 = icmp eq i8 %v0, %v1
848 br i1 %cmp2, label %for.inc, label %cleanup
850 for.inc: ; preds = %for.body
851 %inc = add nuw nsw i64 %i.015, 1
852 %incdec.ptr = getelementptr inbounds i8, i8* %ptr0.013, i64 1
853 %incdec.ptr3 = getelementptr inbounds i8, i8* %ptr1.014, i64 1
854 %cmp = icmp ult i64 %inc, 16
855 br i1 %cmp, label %for.body, label %cleanup
857 cleanup: ; preds = %for.inc, %for.body
858 %res = phi i1 [ false, %for.body ], [ true, %for.inc ]
862 define i1 @_Z48combined_iteration_eq_const_size_overlap_unknownPKcS0_(i8* %ptr0, i8* %ptr1) {
863 ; CHECK-LABEL: @_Z48combined_iteration_eq_const_size_overlap_unknownPKcS0_(
864 ; CHECK-NEXT: for.body.bcmpdispatchbb:
865 ; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[PTR0:%.*]], i8* [[PTR1:%.*]], i64 8)
866 ; CHECK-NEXT: [[PTR0_VS_PTR1_EQCMP:%.*]] = icmp eq i32 [[MEMCMP]], 0
867 ; CHECK-NEXT: br i1 [[PTR0_VS_PTR1_EQCMP]], label [[PTR0_VS_PTR1_EQCMP_EQUALBB:%.*]], label [[PTR0_VS_PTR1_EQCMP_UNEQUALBB:%.*]]
868 ; CHECK: ptr0.vs.ptr1.eqcmp.equalbb:
869 ; CHECK-NEXT: br label [[CLEANUP:%.*]]
870 ; CHECK: ptr0.vs.ptr1.eqcmp.unequalbb:
871 ; CHECK-NEXT: br label [[CLEANUP]]
873 ; CHECK-NEXT: [[RES:%.*]] = phi i1 [ false, [[PTR0_VS_PTR1_EQCMP_UNEQUALBB]] ], [ true, [[PTR0_VS_PTR1_EQCMP_EQUALBB]] ]
874 ; CHECK-NEXT: ret i1 [[RES]]
879 for.body: ; preds = %entry, %for.inc
880 %i.010 = phi i64 [ 0, %entry ], [ %inc, %for.inc ]
881 %ptr1.addr.09 = phi i8* [ %ptr1, %entry ], [ %incdec.ptr3, %for.inc ]
882 %ptr0.addr.08 = phi i8* [ %ptr0, %entry ], [ %incdec.ptr, %for.inc ]
883 %v0 = load i8, i8* %ptr0.addr.08
884 %v1 = load i8, i8* %ptr1.addr.09
885 %cmp2 = icmp eq i8 %v0, %v1
886 br i1 %cmp2, label %for.inc, label %cleanup
888 for.inc: ; preds = %for.body
889 %inc = add nuw nsw i64 %i.010, 1
890 %incdec.ptr = getelementptr inbounds i8, i8* %ptr0.addr.08, i64 1
891 %incdec.ptr3 = getelementptr inbounds i8, i8* %ptr1.addr.09, i64 1
892 %cmp = icmp ult i64 %inc, 8
893 br i1 %cmp, label %for.body, label %cleanup
895 cleanup: ; preds = %for.inc, %for.body
896 %res = phi i1 [ false, %for.body ], [ true, %for.inc ]
900 define i1 @_Z46combined_iteration_eq_variable_size_no_overlapPKcm(i8* %ptr, i64 %count) {
901 ; CHECK-LABEL: @_Z46combined_iteration_eq_variable_size_no_overlapPKcm(
903 ; CHECK-NEXT: [[CMP14:%.*]] = icmp eq i64 [[COUNT_BYTECOUNT:%.*]], 0
904 ; CHECK-NEXT: br i1 [[CMP14]], label [[CLEANUP:%.*]], label [[FOR_BODY_BCMPDISPATCHBB:%.*]]
905 ; CHECK: for.body.bcmpdispatchbb:
906 ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i8, i8* [[PTR:%.*]], i64 [[COUNT_BYTECOUNT]]
907 ; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[PTR]], i8* [[ADD_PTR]], i64 [[COUNT_BYTECOUNT]])
908 ; CHECK-NEXT: [[PTR_VS_ADD_PTR_EQCMP:%.*]] = icmp eq i32 [[MEMCMP]], 0
909 ; CHECK-NEXT: br i1 [[PTR_VS_ADD_PTR_EQCMP]], label [[PTR_VS_ADD_PTR_EQCMP_EQUALBB:%.*]], label [[PTR_VS_ADD_PTR_EQCMP_UNEQUALBB:%.*]]
910 ; CHECK: ptr.vs.add.ptr.eqcmp.equalbb:
911 ; CHECK-NEXT: br label [[CLEANUP_LOOPEXIT:%.*]]
912 ; CHECK: ptr.vs.add.ptr.eqcmp.unequalbb:
913 ; CHECK-NEXT: br label [[CLEANUP_LOOPEXIT]]
914 ; CHECK: cleanup.loopexit:
915 ; CHECK-NEXT: [[RES_PH:%.*]] = phi i1 [ false, [[PTR_VS_ADD_PTR_EQCMP_UNEQUALBB]] ], [ true, [[PTR_VS_ADD_PTR_EQCMP_EQUALBB]] ]
916 ; CHECK-NEXT: br label [[CLEANUP]]
918 ; CHECK-NEXT: [[RES:%.*]] = phi i1 [ true, [[ENTRY:%.*]] ], [ [[RES_PH]], [[CLEANUP_LOOPEXIT]] ]
919 ; CHECK-NEXT: ret i1 [[RES]]
922 %cmp14 = icmp eq i64 %count, 0
923 br i1 %cmp14, label %cleanup, label %for.body.preheader
925 for.body.preheader: ; preds = %entry
926 %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 %count
929 for.body: ; preds = %for.body.preheader, %for.inc
930 %i.017 = phi i64 [ %inc, %for.inc ], [ 0, %for.body.preheader ]
931 %ptr1.016 = phi i8* [ %incdec.ptr3, %for.inc ], [ %add.ptr, %for.body.preheader ]
932 %ptr0.015 = phi i8* [ %incdec.ptr, %for.inc ], [ %ptr, %for.body.preheader ]
933 %v0 = load i8, i8* %ptr0.015
934 %v1 = load i8, i8* %ptr1.016
935 %cmp2 = icmp eq i8 %v0, %v1
936 br i1 %cmp2, label %for.inc, label %cleanup
938 for.inc: ; preds = %for.body
939 %inc = add nuw i64 %i.017, 1
940 %incdec.ptr = getelementptr inbounds i8, i8* %ptr0.015, i64 1
941 %incdec.ptr3 = getelementptr inbounds i8, i8* %ptr1.016, i64 1
942 %cmp = icmp ult i64 %inc, %count
943 br i1 %cmp, label %for.body, label %cleanup
945 cleanup: ; preds = %for.body, %for.inc, %entry
946 %res = phi i1 [ true, %entry ], [ true, %for.inc ], [ false, %for.body ]
950 define i1 @_Z51combined_iteration_eq_variable_size_partial_overlapPKcm(i8* %ptr, i64 %count) {
951 ; CHECK-LABEL: @_Z51combined_iteration_eq_variable_size_partial_overlapPKcm(
953 ; CHECK-NEXT: [[MUL_BYTECOUNT:%.*]] = shl i64 [[COUNT:%.*]], 1
954 ; CHECK-NEXT: [[CMP14:%.*]] = icmp eq i64 [[MUL_BYTECOUNT]], 0
955 ; CHECK-NEXT: br i1 [[CMP14]], label [[CLEANUP:%.*]], label [[FOR_BODY_BCMPDISPATCHBB:%.*]]
956 ; CHECK: for.body.bcmpdispatchbb:
957 ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i8, i8* [[PTR:%.*]], i64 [[COUNT]]
958 ; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[PTR]], i8* [[ADD_PTR]], i64 [[MUL_BYTECOUNT]])
959 ; CHECK-NEXT: [[PTR_VS_ADD_PTR_EQCMP:%.*]] = icmp eq i32 [[MEMCMP]], 0
960 ; CHECK-NEXT: br i1 [[PTR_VS_ADD_PTR_EQCMP]], label [[PTR_VS_ADD_PTR_EQCMP_EQUALBB:%.*]], label [[PTR_VS_ADD_PTR_EQCMP_UNEQUALBB:%.*]]
961 ; CHECK: ptr.vs.add.ptr.eqcmp.equalbb:
962 ; CHECK-NEXT: br label [[CLEANUP_LOOPEXIT:%.*]]
963 ; CHECK: ptr.vs.add.ptr.eqcmp.unequalbb:
964 ; CHECK-NEXT: br label [[CLEANUP_LOOPEXIT]]
965 ; CHECK: cleanup.loopexit:
966 ; CHECK-NEXT: [[RES_PH:%.*]] = phi i1 [ false, [[PTR_VS_ADD_PTR_EQCMP_UNEQUALBB]] ], [ true, [[PTR_VS_ADD_PTR_EQCMP_EQUALBB]] ]
967 ; CHECK-NEXT: br label [[CLEANUP]]
969 ; CHECK-NEXT: [[RES:%.*]] = phi i1 [ true, [[ENTRY:%.*]] ], [ [[RES_PH]], [[CLEANUP_LOOPEXIT]] ]
970 ; CHECK-NEXT: ret i1 [[RES]]
973 %mul = shl i64 %count, 1
974 %cmp14 = icmp eq i64 %mul, 0
975 br i1 %cmp14, label %cleanup, label %for.body.preheader
977 for.body.preheader: ; preds = %entry
978 %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 %count
981 for.body: ; preds = %for.body.preheader, %for.inc
982 %i.017 = phi i64 [ %inc, %for.inc ], [ 0, %for.body.preheader ]
983 %ptr1.016 = phi i8* [ %incdec.ptr3, %for.inc ], [ %add.ptr, %for.body.preheader ]
984 %ptr0.015 = phi i8* [ %incdec.ptr, %for.inc ], [ %ptr, %for.body.preheader ]
985 %v0 = load i8, i8* %ptr0.015
986 %v1 = load i8, i8* %ptr1.016
987 %cmp2 = icmp eq i8 %v0, %v1
988 br i1 %cmp2, label %for.inc, label %cleanup
990 for.inc: ; preds = %for.body
991 %inc = add nuw i64 %i.017, 1
992 %incdec.ptr = getelementptr inbounds i8, i8* %ptr0.015, i64 1
993 %incdec.ptr3 = getelementptr inbounds i8, i8* %ptr1.016, i64 1
994 %cmp = icmp ult i64 %inc, %mul
995 br i1 %cmp, label %for.body, label %cleanup
997 cleanup: ; preds = %for.body, %for.inc, %entry
998 %res = phi i1 [ true, %entry ], [ true, %for.inc ], [ false, %for.body ]
1002 define i1 @_Z51combined_iteration_eq_variable_size_overlap_unknownPKcS0_m(i8* %ptr0, i8* %ptr1, i64 %count) {
1003 ; CHECK-LABEL: @_Z51combined_iteration_eq_variable_size_overlap_unknownPKcS0_m(
1004 ; CHECK-NEXT: entry:
1005 ; CHECK-NEXT: [[CMP8:%.*]] = icmp eq i64 [[COUNT_BYTECOUNT:%.*]], 0
1006 ; CHECK-NEXT: br i1 [[CMP8]], label [[CLEANUP:%.*]], label [[FOR_BODY_BCMPDISPATCHBB:%.*]]
1007 ; CHECK: for.body.bcmpdispatchbb:
1008 ; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[PTR0:%.*]], i8* [[PTR1:%.*]], i64 [[COUNT_BYTECOUNT]])
1009 ; CHECK-NEXT: [[PTR0_VS_PTR1_EQCMP:%.*]] = icmp eq i32 [[MEMCMP]], 0
1010 ; CHECK-NEXT: br i1 [[PTR0_VS_PTR1_EQCMP]], label [[PTR0_VS_PTR1_EQCMP_EQUALBB:%.*]], label [[PTR0_VS_PTR1_EQCMP_UNEQUALBB:%.*]]
1011 ; CHECK: ptr0.vs.ptr1.eqcmp.equalbb:
1012 ; CHECK-NEXT: br label [[CLEANUP_LOOPEXIT:%.*]]
1013 ; CHECK: ptr0.vs.ptr1.eqcmp.unequalbb:
1014 ; CHECK-NEXT: br label [[CLEANUP_LOOPEXIT]]
1015 ; CHECK: cleanup.loopexit:
1016 ; CHECK-NEXT: [[RES_PH:%.*]] = phi i1 [ false, [[PTR0_VS_PTR1_EQCMP_UNEQUALBB]] ], [ true, [[PTR0_VS_PTR1_EQCMP_EQUALBB]] ]
1017 ; CHECK-NEXT: br label [[CLEANUP]]
1019 ; CHECK-NEXT: [[RES:%.*]] = phi i1 [ true, [[ENTRY:%.*]] ], [ [[RES_PH]], [[CLEANUP_LOOPEXIT]] ]
1020 ; CHECK-NEXT: ret i1 [[RES]]
1023 %cmp8 = icmp eq i64 %count, 0
1024 br i1 %cmp8, label %cleanup, label %for.body
1026 for.body: ; preds = %entry, %for.inc
1027 %i.011 = phi i64 [ %inc, %for.inc ], [ 0, %entry ]
1028 %ptr1.addr.010 = phi i8* [ %incdec.ptr3, %for.inc ], [ %ptr1, %entry ]
1029 %ptr0.addr.09 = phi i8* [ %incdec.ptr, %for.inc ], [ %ptr0, %entry ]
1030 %v0 = load i8, i8* %ptr0.addr.09
1031 %v1 = load i8, i8* %ptr1.addr.010
1032 %cmp2 = icmp eq i8 %v0, %v1
1033 br i1 %cmp2, label %for.inc, label %cleanup
1035 for.inc: ; preds = %for.body
1036 %inc = add nuw i64 %i.011, 1
1037 %incdec.ptr = getelementptr inbounds i8, i8* %ptr0.addr.09, i64 1
1038 %incdec.ptr3 = getelementptr inbounds i8, i8* %ptr1.addr.010, i64 1
1039 %cmp = icmp ult i64 %inc, %count
1040 br i1 %cmp, label %for.body, label %cleanup
1042 cleanup: ; preds = %for.body, %for.inc, %entry
1043 %res = phi i1 [ true, %entry ], [ true, %for.inc ], [ false, %for.body ]
1047 define i1 @_Z55negated_pointer_iteration_variable_size_overlap_unknownPKcS0_m(i8* %ptr0, i8* %ptr1, i64 %count) {
1048 ; CHECK-LABEL: @_Z55negated_pointer_iteration_variable_size_overlap_unknownPKcS0_m(
1049 ; CHECK-NEXT: entry:
1050 ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i8, i8* [[PTR0:%.*]], i64 [[COUNT_BYTECOUNT:%.*]]
1051 ; CHECK-NEXT: [[CMP5_I_I:%.*]] = icmp eq i64 [[COUNT_BYTECOUNT]], 0
1052 ; CHECK-NEXT: br i1 [[CMP5_I_I]], label [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT:%.*]], label [[FOR_BODY_I_I_BCMPDISPATCHBB:%.*]]
1053 ; CHECK: for.body.i.i.bcmpdispatchbb:
1054 ; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[PTR0]], i8* [[PTR1:%.*]], i64 [[COUNT_BYTECOUNT]])
1055 ; CHECK-NEXT: [[PTR0_VS_PTR1_EQCMP:%.*]] = icmp eq i32 [[MEMCMP]], 0
1056 ; CHECK-NEXT: br i1 [[PTR0_VS_PTR1_EQCMP]], label [[PTR0_VS_PTR1_EQCMP_EQUALBB:%.*]], label [[PTR0_VS_PTR1_EQCMP_UNEQUALBB:%.*]]
1057 ; CHECK: ptr0.vs.ptr1.eqcmp.equalbb:
1058 ; CHECK-NEXT: br label [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT_LOOPEXIT:%.*]]
1059 ; CHECK: ptr0.vs.ptr1.eqcmp.unequalbb:
1060 ; CHECK-NEXT: br label [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT_LOOPEXIT]]
1061 ; CHECK: _ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit.loopexit:
1062 ; CHECK-NEXT: [[RETVAL_0_I_I_PH:%.*]] = phi i1 [ true, [[PTR0_VS_PTR1_EQCMP_UNEQUALBB]] ], [ false, [[PTR0_VS_PTR1_EQCMP_EQUALBB]] ]
1063 ; CHECK-NEXT: br label [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT]]
1064 ; CHECK: _ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit:
1065 ; CHECK-NEXT: [[RETVAL_0_I_I:%.*]] = phi i1 [ false, [[ENTRY:%.*]] ], [ [[RETVAL_0_I_I_PH]], [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT_LOOPEXIT]] ]
1066 ; CHECK-NEXT: ret i1 [[RETVAL_0_I_I]]
1069 %add.ptr = getelementptr inbounds i8, i8* %ptr0, i64 %count
1070 %cmp5.i.i = icmp eq i64 %count, 0
1071 br i1 %cmp5.i.i, label %_ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit, label %for.body.i.i
1073 for.body.i.i: ; preds = %entry, %for.inc.i.i
1074 %__first2.addr.07.i.i = phi i8* [ %incdec.ptr1.i.i, %for.inc.i.i ], [ %ptr1, %entry ]
1075 %__first1.addr.06.i.i = phi i8* [ %incdec.ptr.i.i, %for.inc.i.i ], [ %ptr0, %entry ]
1076 %t0 = load i8, i8* %__first1.addr.06.i.i
1077 %t1 = load i8, i8* %__first2.addr.07.i.i
1078 %cmp.i.i.i = icmp eq i8 %t0, %t1
1079 br i1 %cmp.i.i.i, label %for.inc.i.i, label %_ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit
1081 for.inc.i.i: ; preds = %for.body.i.i
1082 %incdec.ptr.i.i = getelementptr inbounds i8, i8* %__first1.addr.06.i.i, i64 1
1083 %incdec.ptr1.i.i = getelementptr inbounds i8, i8* %__first2.addr.07.i.i, i64 1
1084 %cmp.i.i = icmp eq i8* %incdec.ptr.i.i, %add.ptr
1085 br i1 %cmp.i.i, label %_ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit, label %for.body.i.i
1087 _ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit: ; preds = %for.body.i.i, %for.inc.i.i, %entry
1088 %retval.0.i.i = phi i1 [ false, %entry ], [ false, %for.inc.i.i ], [ true, %for.body.i.i ]
1089 ret i1 %retval.0.i.i
1092 define i1 @_Z55integer_pointer_iteration_variable_size_overlap_unknownPKiS0_m(i32* %ptr0, i32* %ptr1, i64 %count) {
1093 ; CHECK-LABEL: @_Z55integer_pointer_iteration_variable_size_overlap_unknownPKiS0_m(
1094 ; CHECK-NEXT: entry:
1095 ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i32, i32* [[PTR0:%.*]], i64 [[COUNT:%.*]]
1096 ; CHECK-NEXT: [[CMP5_I_I:%.*]] = icmp eq i64 [[COUNT]], 0
1097 ; CHECK-NEXT: br i1 [[CMP5_I_I]], label [[_ZNST3__15EQUALIPKIS2_EEBT_S3_T0__EXIT:%.*]], label [[FOR_BODY_I_I_BCMPDISPATCHBB:%.*]]
1098 ; CHECK: for.body.i.i.bcmpdispatchbb:
1099 ; CHECK-NEXT: [[TMP0:%.*]] = shl nsw i64 [[COUNT]], 2
1100 ; CHECK-NEXT: [[TMP1:%.*]] = add i64 [[TMP0]], -4
1101 ; CHECK-NEXT: [[TMP2:%.*]] = lshr i64 [[TMP1]], 2
1102 ; CHECK-NEXT: [[TMP3:%.*]] = shl nuw i64 [[TMP2]], 2
1103 ; CHECK-NEXT: [[DOTBYTECOUNT:%.*]] = add i64 [[TMP3]], 4
1104 ; CHECK-NEXT: [[CSTR:%.*]] = bitcast i32* [[PTR0]] to i8*
1105 ; CHECK-NEXT: [[CSTR1:%.*]] = bitcast i32* [[PTR1:%.*]] to i8*
1106 ; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[CSTR]], i8* [[CSTR1]], i64 [[DOTBYTECOUNT]])
1107 ; CHECK-NEXT: [[PTR0_VS_PTR1_EQCMP:%.*]] = icmp eq i32 [[MEMCMP]], 0
1108 ; CHECK-NEXT: br i1 [[PTR0_VS_PTR1_EQCMP]], label [[PTR0_VS_PTR1_EQCMP_EQUALBB:%.*]], label [[PTR0_VS_PTR1_EQCMP_UNEQUALBB:%.*]]
1109 ; CHECK: ptr0.vs.ptr1.eqcmp.equalbb:
1110 ; CHECK-NEXT: br label [[_ZNST3__15EQUALIPKIS2_EEBT_S3_T0__EXIT_LOOPEXIT:%.*]]
1111 ; CHECK: ptr0.vs.ptr1.eqcmp.unequalbb:
1112 ; CHECK-NEXT: br label [[_ZNST3__15EQUALIPKIS2_EEBT_S3_T0__EXIT_LOOPEXIT]]
1113 ; CHECK: _ZNSt3__15equalIPKiS2_EEbT_S3_T0_.exit.loopexit:
1114 ; CHECK-NEXT: [[RETVAL_0_I_I_PH:%.*]] = phi i1 [ false, [[PTR0_VS_PTR1_EQCMP_UNEQUALBB]] ], [ true, [[PTR0_VS_PTR1_EQCMP_EQUALBB]] ]
1115 ; CHECK-NEXT: br label [[_ZNST3__15EQUALIPKIS2_EEBT_S3_T0__EXIT]]
1116 ; CHECK: _ZNSt3__15equalIPKiS2_EEbT_S3_T0_.exit:
1117 ; CHECK-NEXT: [[RETVAL_0_I_I:%.*]] = phi i1 [ true, [[ENTRY:%.*]] ], [ [[RETVAL_0_I_I_PH]], [[_ZNST3__15EQUALIPKIS2_EEBT_S3_T0__EXIT_LOOPEXIT]] ]
1118 ; CHECK-NEXT: ret i1 [[RETVAL_0_I_I]]
1121 %add.ptr = getelementptr inbounds i32, i32* %ptr0, i64 %count
1122 %cmp5.i.i = icmp eq i64 %count, 0
1123 br i1 %cmp5.i.i, label %_ZNSt3__15equalIPKiS2_EEbT_S3_T0_.exit, label %for.body.i.i
1125 for.body.i.i: ; preds = %entry, %for.inc.i.i
1126 %__first2.addr.07.i.i = phi i32* [ %incdec.ptr1.i.i, %for.inc.i.i ], [ %ptr1, %entry ]
1127 %__first1.addr.06.i.i = phi i32* [ %incdec.ptr.i.i, %for.inc.i.i ], [ %ptr0, %entry ]
1128 %t0 = load i32, i32* %__first1.addr.06.i.i
1129 %t1 = load i32, i32* %__first2.addr.07.i.i
1130 %cmp.i.i.i = icmp eq i32 %t0, %t1
1131 br i1 %cmp.i.i.i, label %for.inc.i.i, label %_ZNSt3__15equalIPKiS2_EEbT_S3_T0_.exit
1133 for.inc.i.i: ; preds = %for.body.i.i
1134 %incdec.ptr.i.i = getelementptr inbounds i32, i32* %__first1.addr.06.i.i, i64 1
1135 %incdec.ptr1.i.i = getelementptr inbounds i32, i32* %__first2.addr.07.i.i, i64 1
1136 %cmp.i.i = icmp eq i32* %incdec.ptr.i.i, %add.ptr
1137 br i1 %cmp.i.i, label %_ZNSt3__15equalIPKiS2_EEbT_S3_T0_.exit, label %for.body.i.i
1139 _ZNSt3__15equalIPKiS2_EEbT_S3_T0_.exit: ; preds = %for.body.i.i, %for.inc.i.i, %entry
1140 %retval.0.i.i = phi i1 [ true, %entry ], [ true, %for.inc.i.i ], [ false, %for.body.i.i ]
1141 ret i1 %retval.0.i.i
1144 define i1 @_Z21small_index_iterationPKcS0_i(i8* %ptr0, i8* %ptr1, i32 %count) {
1145 ; CHECK-LABEL: @_Z21small_index_iterationPKcS0_i(
1146 ; CHECK-NEXT: entry:
1147 ; CHECK-NEXT: [[CMP8:%.*]] = icmp sgt i32 [[COUNT:%.*]], 0
1148 ; CHECK-NEXT: br i1 [[CMP8]], label [[FOR_BODY_BCMPDISPATCHBB:%.*]], label [[CLEANUP:%.*]]
1149 ; CHECK: for.body.bcmpdispatchbb:
1150 ; CHECK-NEXT: [[DOTBYTECOUNT:%.*]] = zext i32 [[COUNT]] to i64
1151 ; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[PTR0:%.*]], i8* [[PTR1:%.*]], i64 [[DOTBYTECOUNT]])
1152 ; CHECK-NEXT: [[PTR0_VS_PTR1_EQCMP:%.*]] = icmp eq i32 [[MEMCMP]], 0
1153 ; CHECK-NEXT: br i1 [[PTR0_VS_PTR1_EQCMP]], label [[PTR0_VS_PTR1_EQCMP_EQUALBB:%.*]], label [[PTR0_VS_PTR1_EQCMP_UNEQUALBB:%.*]]
1154 ; CHECK: ptr0.vs.ptr1.eqcmp.equalbb:
1155 ; CHECK-NEXT: br label [[CLEANUP_LOOPEXIT:%.*]]
1156 ; CHECK: ptr0.vs.ptr1.eqcmp.unequalbb:
1157 ; CHECK-NEXT: br label [[CLEANUP_LOOPEXIT]]
1158 ; CHECK: cleanup.loopexit:
1159 ; CHECK-NEXT: [[T2_PH:%.*]] = phi i1 [ false, [[PTR0_VS_PTR1_EQCMP_UNEQUALBB]] ], [ true, [[PTR0_VS_PTR1_EQCMP_EQUALBB]] ]
1160 ; CHECK-NEXT: br label [[CLEANUP]]
1162 ; CHECK-NEXT: [[T2:%.*]] = phi i1 [ true, [[ENTRY:%.*]] ], [ [[T2_PH]], [[CLEANUP_LOOPEXIT]] ]
1163 ; CHECK-NEXT: ret i1 [[T2]]
1166 %cmp8 = icmp sgt i32 %count, 0
1167 br i1 %cmp8, label %for.body, label %cleanup
1169 for.body: ; preds = %entry, %for.inc
1170 %i.011 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
1171 %ptr1.addr.010 = phi i8* [ %incdec.ptr3, %for.inc ], [ %ptr1, %entry ]
1172 %ptr0.addr.09 = phi i8* [ %incdec.ptr, %for.inc ], [ %ptr0, %entry ]
1173 %t0 = load i8, i8* %ptr0.addr.09
1174 %t1 = load i8, i8* %ptr1.addr.010
1175 %cmp2 = icmp eq i8 %t0, %t1
1176 br i1 %cmp2, label %for.inc, label %cleanup
1178 for.inc: ; preds = %for.body
1179 %inc = add nuw nsw i32 %i.011, 1
1180 %incdec.ptr = getelementptr inbounds i8, i8* %ptr0.addr.09, i64 1
1181 %incdec.ptr3 = getelementptr inbounds i8, i8* %ptr1.addr.010, i64 1
1182 %cmp = icmp slt i32 %inc, %count
1183 br i1 %cmp, label %for.body, label %cleanup
1185 cleanup: ; preds = %for.body, %for.inc, %entry
1186 %t2 = phi i1 [ true, %entry ], [ true, %for.inc ], [ false, %for.body ]
1190 define i1 @_Z23three_pointer_iterationPKcS0_S0_(i8* %ptr0, i8* %ptr0_end, i8* %ptr1) {
1191 ; CHECK-LABEL: @_Z23three_pointer_iterationPKcS0_S0_(
1192 ; CHECK-NEXT: entry:
1193 ; CHECK-NEXT: [[PTR01:%.*]] = ptrtoint i8* [[PTR0:%.*]] to i64
1194 ; CHECK-NEXT: [[CMP5_I_I:%.*]] = icmp eq i8* [[PTR0]], [[PTR0_END:%.*]]
1195 ; CHECK-NEXT: br i1 [[CMP5_I_I]], label [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT:%.*]], label [[FOR_BODY_I_I_BCMPDISPATCHBB:%.*]]
1196 ; CHECK: for.body.i.i.bcmpdispatchbb:
1197 ; CHECK-NEXT: [[TMP0:%.*]] = sub i64 0, [[PTR01]]
1198 ; CHECK-NEXT: [[SCEVGEP:%.*]] = getelementptr i8, i8* [[PTR0_END]], i64 [[TMP0]]
1199 ; CHECK-NEXT: [[DOTBYTECOUNT:%.*]] = ptrtoint i8* [[SCEVGEP]] to i64
1200 ; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[PTR0]], i8* [[PTR1:%.*]], i64 [[DOTBYTECOUNT]])
1201 ; CHECK-NEXT: [[PTR0_VS_PTR1_EQCMP:%.*]] = icmp eq i32 [[MEMCMP]], 0
1202 ; CHECK-NEXT: br i1 [[PTR0_VS_PTR1_EQCMP]], label [[PTR0_VS_PTR1_EQCMP_EQUALBB:%.*]], label [[PTR0_VS_PTR1_EQCMP_UNEQUALBB:%.*]]
1203 ; CHECK: ptr0.vs.ptr1.eqcmp.equalbb:
1204 ; CHECK-NEXT: br label [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT_LOOPEXIT:%.*]]
1205 ; CHECK: ptr0.vs.ptr1.eqcmp.unequalbb:
1206 ; CHECK-NEXT: br label [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT_LOOPEXIT]]
1207 ; CHECK: _ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit.loopexit:
1208 ; CHECK-NEXT: [[RETVAL_0_I_I_PH:%.*]] = phi i1 [ false, [[PTR0_VS_PTR1_EQCMP_UNEQUALBB]] ], [ true, [[PTR0_VS_PTR1_EQCMP_EQUALBB]] ]
1209 ; CHECK-NEXT: br label [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT]]
1210 ; CHECK: _ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit:
1211 ; CHECK-NEXT: [[RETVAL_0_I_I:%.*]] = phi i1 [ true, [[ENTRY:%.*]] ], [ [[RETVAL_0_I_I_PH]], [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT_LOOPEXIT]] ]
1212 ; CHECK-NEXT: ret i1 [[RETVAL_0_I_I]]
1215 %cmp5.i.i = icmp eq i8* %ptr0, %ptr0_end
1216 br i1 %cmp5.i.i, label %_ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit, label %for.body.i.i
1218 for.body.i.i: ; preds = %entry, %for.inc.i.i
1219 %__first2.addr.07.i.i = phi i8* [ %incdec.ptr1.i.i, %for.inc.i.i ], [ %ptr1, %entry ]
1220 %__first1.addr.06.i.i = phi i8* [ %incdec.ptr.i.i, %for.inc.i.i ], [ %ptr0, %entry ]
1221 %t0 = load i8, i8* %__first1.addr.06.i.i
1222 %t1 = load i8, i8* %__first2.addr.07.i.i
1223 %cmp.i.i.i = icmp eq i8 %t0, %t1
1224 br i1 %cmp.i.i.i, label %for.inc.i.i, label %_ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit
1226 for.inc.i.i: ; preds = %for.body.i.i
1227 %incdec.ptr.i.i = getelementptr inbounds i8, i8* %__first1.addr.06.i.i, i64 1
1228 %incdec.ptr1.i.i = getelementptr inbounds i8, i8* %__first2.addr.07.i.i, i64 1
1229 %cmp.i.i = icmp eq i8* %incdec.ptr.i.i, %ptr0_end
1230 br i1 %cmp.i.i, label %_ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit, label %for.body.i.i
1232 _ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit: ; preds = %for.body.i.i, %for.inc.i.i, %entry
1233 %retval.0.i.i = phi i1 [ true, %entry ], [ true, %for.inc.i.i ], [ false, %for.body.i.i ]
1234 ret i1 %retval.0.i.i
1237 define i32 @_Z17value_propagationPKcS0_mii(i8* %ptr0, i8* %ptr1, i64 %count, i32 %on_equal, i32 %on_unequal) {
1238 ; CHECK-LABEL: @_Z17value_propagationPKcS0_mii(
1239 ; CHECK-NEXT: entry:
1240 ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i8, i8* [[PTR0:%.*]], i64 [[COUNT_BYTECOUNT:%.*]]
1241 ; CHECK-NEXT: [[CMP5_I_I:%.*]] = icmp eq i64 [[COUNT_BYTECOUNT]], 0
1242 ; CHECK-NEXT: br i1 [[CMP5_I_I]], label [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT:%.*]], label [[FOR_BODY_I_I_BCMPDISPATCHBB:%.*]]
1243 ; CHECK: for.body.i.i.bcmpdispatchbb:
1244 ; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[PTR0]], i8* [[PTR1:%.*]], i64 [[COUNT_BYTECOUNT]])
1245 ; CHECK-NEXT: [[PTR0_VS_PTR1_EQCMP:%.*]] = icmp eq i32 [[MEMCMP]], 0
1246 ; CHECK-NEXT: br i1 [[PTR0_VS_PTR1_EQCMP]], label [[PTR0_VS_PTR1_EQCMP_EQUALBB:%.*]], label [[PTR0_VS_PTR1_EQCMP_UNEQUALBB:%.*]]
1247 ; CHECK: ptr0.vs.ptr1.eqcmp.equalbb:
1248 ; CHECK-NEXT: br label [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT_LOOPEXIT:%.*]]
1249 ; CHECK: ptr0.vs.ptr1.eqcmp.unequalbb:
1250 ; CHECK-NEXT: br label [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT_LOOPEXIT]]
1251 ; CHECK: _ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit.loopexit:
1252 ; CHECK-NEXT: [[T2_PH:%.*]] = phi i32 [ [[ON_UNEQUAL:%.*]], [[PTR0_VS_PTR1_EQCMP_UNEQUALBB]] ], [ [[ON_EQUAL:%.*]], [[PTR0_VS_PTR1_EQCMP_EQUALBB]] ]
1253 ; CHECK-NEXT: br label [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT]]
1254 ; CHECK: _ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit:
1255 ; CHECK-NEXT: [[T2:%.*]] = phi i32 [ [[ON_EQUAL]], [[ENTRY:%.*]] ], [ [[T2_PH]], [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT_LOOPEXIT]] ]
1256 ; CHECK-NEXT: ret i32 [[T2]]
1259 %add.ptr = getelementptr inbounds i8, i8* %ptr0, i64 %count
1260 %cmp5.i.i = icmp eq i64 %count, 0
1261 br i1 %cmp5.i.i, label %_ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit, label %for.body.i.i
1263 for.body.i.i: ; preds = %entry, %for.inc.i.i
1264 %__first2.addr.07.i.i = phi i8* [ %incdec.ptr1.i.i, %for.inc.i.i ], [ %ptr1, %entry ]
1265 %__first1.addr.06.i.i = phi i8* [ %incdec.ptr.i.i, %for.inc.i.i ], [ %ptr0, %entry ]
1266 %t0 = load i8, i8* %__first1.addr.06.i.i
1267 %t1 = load i8, i8* %__first2.addr.07.i.i
1268 %cmp.i.i.i = icmp eq i8 %t0, %t1
1269 br i1 %cmp.i.i.i, label %for.inc.i.i, label %_ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit
1271 for.inc.i.i: ; preds = %for.body.i.i
1272 %incdec.ptr.i.i = getelementptr inbounds i8, i8* %__first1.addr.06.i.i, i64 1
1273 %incdec.ptr1.i.i = getelementptr inbounds i8, i8* %__first2.addr.07.i.i, i64 1
1274 %cmp.i.i = icmp eq i8* %incdec.ptr.i.i, %add.ptr
1275 br i1 %cmp.i.i, label %_ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit, label %for.body.i.i
1277 _ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit: ; preds = %for.inc.i.i, %for.body.i.i, %entry
1278 %t2 = phi i32 [ %on_equal, %entry ], [ %on_equal, %for.inc.i.i ], [ %on_unequal, %for.body.i.i ]
1282 define void @_Z20multiple_exit_blocksPKcS0_m(i8* %ptr0, i8* %ptr1, i64 %count) {
1283 ; CHECK-LABEL: @_Z20multiple_exit_blocksPKcS0_m(
1284 ; CHECK-NEXT: entry:
1285 ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i8, i8* [[PTR0:%.*]], i64 [[COUNT_BYTECOUNT:%.*]]
1286 ; CHECK-NEXT: [[CMP5_I_I:%.*]] = icmp eq i64 [[COUNT_BYTECOUNT]], 0
1287 ; CHECK-NEXT: br i1 [[CMP5_I_I]], label [[IF_END:%.*]], label [[FOR_BODY_I_I_BCMPDISPATCHBB:%.*]]
1288 ; CHECK: for.body.i.i.bcmpdispatchbb:
1289 ; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[PTR0]], i8* [[PTR1:%.*]], i64 [[COUNT_BYTECOUNT]])
1290 ; CHECK-NEXT: [[PTR0_VS_PTR1_EQCMP:%.*]] = icmp eq i32 [[MEMCMP]], 0
1291 ; CHECK-NEXT: br i1 [[PTR0_VS_PTR1_EQCMP]], label [[PTR0_VS_PTR1_EQCMP_EQUALBB:%.*]], label [[PTR0_VS_PTR1_EQCMP_UNEQUALBB:%.*]]
1292 ; CHECK: ptr0.vs.ptr1.eqcmp.equalbb:
1293 ; CHECK-NEXT: br label [[IF_END_LOOPEXIT:%.*]]
1294 ; CHECK: ptr0.vs.ptr1.eqcmp.unequalbb:
1295 ; CHECK-NEXT: br label [[IF_THEN:%.*]]
1297 ; CHECK-NEXT: tail call void @_Z17callee_on_unequalv()
1298 ; CHECK-NEXT: br label [[RETURN:%.*]]
1299 ; CHECK: if.end.loopexit:
1300 ; CHECK-NEXT: br label [[IF_END]]
1302 ; CHECK-NEXT: tail call void @_Z17callee_on_successv()
1303 ; CHECK-NEXT: br label [[RETURN]]
1305 ; CHECK-NEXT: ret void
1308 %add.ptr = getelementptr inbounds i8, i8* %ptr0, i64 %count
1309 %cmp5.i.i = icmp eq i64 %count, 0
1310 br i1 %cmp5.i.i, label %if.end, label %for.body.i.i
1312 for.body.i.i: ; preds = %entry, %for.inc.i.i
1313 %__first2.addr.07.i.i = phi i8* [ %incdec.ptr1.i.i, %for.inc.i.i ], [ %ptr1, %entry ]
1314 %__first1.addr.06.i.i = phi i8* [ %incdec.ptr.i.i, %for.inc.i.i ], [ %ptr0, %entry ]
1315 %t0 = load i8, i8* %__first1.addr.06.i.i
1316 %t1 = load i8, i8* %__first2.addr.07.i.i
1317 %cmp.i.i.i = icmp eq i8 %t0, %t1
1318 br i1 %cmp.i.i.i, label %for.inc.i.i, label %if.then
1320 for.inc.i.i: ; preds = %for.body.i.i
1321 %incdec.ptr.i.i = getelementptr inbounds i8, i8* %__first1.addr.06.i.i, i64 1
1322 %incdec.ptr1.i.i = getelementptr inbounds i8, i8* %__first2.addr.07.i.i, i64 1
1323 %cmp.i.i = icmp eq i8* %incdec.ptr.i.i, %add.ptr
1324 br i1 %cmp.i.i, label %if.end, label %for.body.i.i
1326 if.then: ; preds = %for.body.i.i
1327 tail call void @_Z17callee_on_unequalv()
1330 if.end: ; preds = %for.inc.i.i, %entry
1331 tail call void @_Z17callee_on_successv()
1334 return: ; preds = %if.end, %if.then
1337 declare void @_Z17callee_on_unequalv()
1338 declare void @_Z17callee_on_successv()
1340 define void @_Z13multiple_phisPKcS0_mS0_S0_S0_S0_PS0_S1_(i8* %ptr0, i8* %ptr1, i64 %count, i8* %v0, i8* %v1, i8* %v2, i8* %v3, i8** %out0, i8** %out1) {
1341 ; CHECK-LABEL: @_Z13multiple_phisPKcS0_mS0_S0_S0_S0_PS0_S1_(
1342 ; CHECK-NEXT: entry:
1343 ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i8, i8* [[PTR0:%.*]], i64 [[COUNT_BYTECOUNT:%.*]]
1344 ; CHECK-NEXT: [[CMP5_I_I:%.*]] = icmp eq i64 [[COUNT_BYTECOUNT]], 0
1345 ; CHECK-NEXT: br i1 [[CMP5_I_I]], label [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT:%.*]], label [[FOR_BODY_I_I_BCMPDISPATCHBB:%.*]]
1346 ; CHECK: for.body.i.i.bcmpdispatchbb:
1347 ; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[PTR0]], i8* [[PTR1:%.*]], i64 [[COUNT_BYTECOUNT]])
1348 ; CHECK-NEXT: [[PTR0_VS_PTR1_EQCMP:%.*]] = icmp eq i32 [[MEMCMP]], 0
1349 ; CHECK-NEXT: br i1 [[PTR0_VS_PTR1_EQCMP]], label [[PTR0_VS_PTR1_EQCMP_EQUALBB:%.*]], label [[PTR0_VS_PTR1_EQCMP_UNEQUALBB:%.*]]
1350 ; CHECK: ptr0.vs.ptr1.eqcmp.equalbb:
1351 ; CHECK-NEXT: br label [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT_LOOPEXIT:%.*]]
1352 ; CHECK: ptr0.vs.ptr1.eqcmp.unequalbb:
1353 ; CHECK-NEXT: br label [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT_LOOPEXIT]]
1354 ; CHECK: _ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit.loopexit:
1355 ; CHECK-NEXT: [[T2_PH:%.*]] = phi i8* [ [[V2:%.*]], [[PTR0_VS_PTR1_EQCMP_UNEQUALBB]] ], [ [[V0:%.*]], [[PTR0_VS_PTR1_EQCMP_EQUALBB]] ]
1356 ; CHECK-NEXT: [[T3_PH:%.*]] = phi i8* [ [[V3:%.*]], [[PTR0_VS_PTR1_EQCMP_UNEQUALBB]] ], [ [[V1:%.*]], [[PTR0_VS_PTR1_EQCMP_EQUALBB]] ]
1357 ; CHECK-NEXT: br label [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT]]
1358 ; CHECK: _ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit:
1359 ; CHECK-NEXT: [[T2:%.*]] = phi i8* [ [[V0]], [[ENTRY:%.*]] ], [ [[T2_PH]], [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT_LOOPEXIT]] ]
1360 ; CHECK-NEXT: [[T3:%.*]] = phi i8* [ [[V1]], [[ENTRY]] ], [ [[T3_PH]], [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT_LOOPEXIT]] ]
1361 ; CHECK-NEXT: store i8* [[T2]], i8** [[OUT0:%.*]]
1362 ; CHECK-NEXT: store i8* [[T3]], i8** [[OUT1:%.*]]
1363 ; CHECK-NEXT: ret void
1366 %add.ptr = getelementptr inbounds i8, i8* %ptr0, i64 %count
1367 %cmp5.i.i = icmp eq i64 %count, 0
1368 br i1 %cmp5.i.i, label %_ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit, label %for.body.i.i
1370 for.body.i.i: ; preds = %entry, %for.inc.i.i
1371 %__first2.addr.07.i.i = phi i8* [ %incdec.ptr1.i.i, %for.inc.i.i ], [ %ptr1, %entry ]
1372 %__first1.addr.06.i.i = phi i8* [ %incdec.ptr.i.i, %for.inc.i.i ], [ %ptr0, %entry ]
1373 %t0 = load i8, i8* %__first1.addr.06.i.i
1374 %t1 = load i8, i8* %__first2.addr.07.i.i
1375 %cmp.i.i.i = icmp eq i8 %t0, %t1
1376 br i1 %cmp.i.i.i, label %for.inc.i.i, label %_ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit
1378 for.inc.i.i: ; preds = %for.body.i.i
1379 %incdec.ptr.i.i = getelementptr inbounds i8, i8* %__first1.addr.06.i.i, i64 1
1380 %incdec.ptr1.i.i = getelementptr inbounds i8, i8* %__first2.addr.07.i.i, i64 1
1381 %cmp.i.i = icmp eq i8* %incdec.ptr.i.i, %add.ptr
1382 br i1 %cmp.i.i, label %_ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit, label %for.body.i.i
1384 _ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit: ; preds = %for.inc.i.i, %for.body.i.i, %entry
1385 %t2 = phi i8* [ %v0, %entry ], [ %v0, %for.inc.i.i ], [ %v2, %for.body.i.i ]
1386 %t3 = phi i8* [ %v1, %entry ], [ %v1, %for.inc.i.i ], [ %v3, %for.body.i.i ]
1387 store i8* %t2, i8** %out0
1388 store i8* %t3, i8** %out1
1392 define void @_Z16loop_within_loopmPPKcS1_Pm(i64 %outer_count, i8** %ptr0, i8** %ptr1, i64* %count) {
1393 ; CHECK-LABEL: @_Z16loop_within_loopmPPKcS1_Pm(
1394 ; CHECK-NEXT: entry:
1395 ; CHECK-NEXT: [[CMP11:%.*]] = icmp eq i64 [[OUTER_COUNT:%.*]], 0
1396 ; CHECK-NEXT: br i1 [[CMP11]], label [[FOR_COND_CLEANUP:%.*]], label [[FOR_BODY_PREHEADER:%.*]]
1397 ; CHECK: for.body.preheader:
1398 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
1399 ; CHECK: for.cond.cleanup.loopexit:
1400 ; CHECK-NEXT: br label [[FOR_COND_CLEANUP]]
1401 ; CHECK: for.cond.cleanup:
1402 ; CHECK-NEXT: ret void
1404 ; CHECK-NEXT: [[I_012:%.*]] = phi i64 [ [[INC:%.*]], [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT:%.*]] ], [ 0, [[FOR_BODY_PREHEADER]] ]
1405 ; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i8*, i8** [[PTR0:%.*]], i64 [[I_012]]
1406 ; CHECK-NEXT: [[T0:%.*]] = load i8*, i8** [[ARRAYIDX]]
1407 ; CHECK-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds i64, i64* [[COUNT:%.*]], i64 [[I_012]]
1408 ; CHECK-NEXT: [[T1_BYTECOUNT:%.*]] = load i64, i64* [[ARRAYIDX2]]
1409 ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i8, i8* [[T0]], i64 [[T1_BYTECOUNT]]
1410 ; CHECK-NEXT: [[CMP5_I_I:%.*]] = icmp eq i64 [[T1_BYTECOUNT]], 0
1411 ; CHECK-NEXT: br i1 [[CMP5_I_I]], label [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT]], label [[FOR_BODY_I_I_PREHEADER:%.*]]
1412 ; CHECK: for.body.i.i.preheader:
1413 ; CHECK-NEXT: [[ARRAYIDX3:%.*]] = getelementptr inbounds i8*, i8** [[PTR1:%.*]], i64 [[I_012]]
1414 ; CHECK-NEXT: [[T2:%.*]] = load i8*, i8** [[ARRAYIDX3]]
1415 ; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[T0]], i8* [[T2]], i64 [[T1_BYTECOUNT]])
1416 ; CHECK-NEXT: [[T0_VS_T2_EQCMP:%.*]] = icmp eq i32 [[MEMCMP]], 0
1417 ; CHECK-NEXT: br label [[FOR_BODY_I_I_BCMPDISPATCHBB:%.*]]
1418 ; CHECK: for.body.i.i.bcmpdispatchbb:
1419 ; CHECK-NEXT: br i1 [[T0_VS_T2_EQCMP]], label [[T0_VS_T2_EQCMP_EQUALBB:%.*]], label [[T0_VS_T2_EQCMP_UNEQUALBB:%.*]]
1420 ; CHECK: t0.vs.t2.eqcmp.equalbb:
1421 ; CHECK-NEXT: br i1 true, label [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT_LOOPEXIT:%.*]], label [[FOR_BODY_I_I_BCMPDISPATCHBB]]
1422 ; CHECK: t0.vs.t2.eqcmp.unequalbb:
1423 ; CHECK-NEXT: br i1 true, label [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT_LOOPEXIT]], label [[FOR_BODY_I_I_BCMPDISPATCHBB]]
1424 ; CHECK: _ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit.loopexit:
1425 ; CHECK-NEXT: [[RETVAL_0_I_I_PH:%.*]] = phi i1 [ false, [[T0_VS_T2_EQCMP_UNEQUALBB]] ], [ true, [[T0_VS_T2_EQCMP_EQUALBB]] ]
1426 ; CHECK-NEXT: br label [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT]]
1427 ; CHECK: _ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit:
1428 ; CHECK-NEXT: [[RETVAL_0_I_I:%.*]] = phi i1 [ true, [[FOR_BODY]] ], [ [[RETVAL_0_I_I_PH]], [[_ZNST3__15EQUALIPKCS2_EEBT_S3_T0__EXIT_LOOPEXIT]] ]
1429 ; CHECK-NEXT: tail call void @_Z4sinkb(i1 [[RETVAL_0_I_I]])
1430 ; CHECK-NEXT: [[INC]] = add nuw i64 [[I_012]], 1
1431 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i64 [[INC]], [[OUTER_COUNT]]
1432 ; CHECK-NEXT: br i1 [[CMP]], label [[FOR_COND_CLEANUP_LOOPEXIT:%.*]], label [[FOR_BODY]]
1435 %cmp11 = icmp eq i64 %outer_count, 0
1436 br i1 %cmp11, label %for.cond.cleanup, label %for.body
1438 for.cond.cleanup: ; preds = %_ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit, %entry
1441 for.body: ; preds = %entry, %_ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit
1442 %i.012 = phi i64 [ %inc, %_ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit ], [ 0, %entry ]
1443 %arrayidx = getelementptr inbounds i8*, i8** %ptr0, i64 %i.012
1444 %t0 = load i8*, i8** %arrayidx
1445 %arrayidx2 = getelementptr inbounds i64, i64* %count, i64 %i.012
1446 %t1 = load i64, i64* %arrayidx2
1447 %add.ptr = getelementptr inbounds i8, i8* %t0, i64 %t1
1448 %cmp5.i.i = icmp eq i64 %t1, 0
1449 br i1 %cmp5.i.i, label %_ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit, label %for.body.i.i.preheader
1451 for.body.i.i.preheader: ; preds = %for.body
1452 %arrayidx3 = getelementptr inbounds i8*, i8** %ptr1, i64 %i.012
1453 %t2 = load i8*, i8** %arrayidx3
1454 br label %for.body.i.i
1456 for.body.i.i: ; preds = %for.body.i.i.preheader, %for.inc.i.i
1457 %__first2.addr.07.i.i = phi i8* [ %incdec.ptr1.i.i, %for.inc.i.i ], [ %t2, %for.body.i.i.preheader ]
1458 %__first1.addr.06.i.i = phi i8* [ %incdec.ptr.i.i, %for.inc.i.i ], [ %t0, %for.body.i.i.preheader ]
1459 %t3 = load i8, i8* %__first1.addr.06.i.i
1460 %t4 = load i8, i8* %__first2.addr.07.i.i
1461 %cmp.i.i.i = icmp eq i8 %t3, %t4
1462 br i1 %cmp.i.i.i, label %for.inc.i.i, label %_ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit
1464 for.inc.i.i: ; preds = %for.body.i.i
1465 %incdec.ptr.i.i = getelementptr inbounds i8, i8* %__first1.addr.06.i.i, i64 1
1466 %incdec.ptr1.i.i = getelementptr inbounds i8, i8* %__first2.addr.07.i.i, i64 1
1467 %cmp.i.i = icmp eq i8* %incdec.ptr.i.i, %add.ptr
1468 br i1 %cmp.i.i, label %_ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit, label %for.body.i.i
1470 _ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit: ; preds = %for.body.i.i, %for.inc.i.i, %for.body
1471 %retval.0.i.i = phi i1 [ true, %for.body ], [ true, %for.inc.i.i ], [ false, %for.body.i.i ]
1472 tail call void @_Z4sinkb(i1 %retval.0.i.i)
1473 %inc = add nuw i64 %i.012, 1
1474 %cmp = icmp eq i64 %inc, %outer_count
1475 br i1 %cmp, label %for.cond.cleanup, label %for.body
1477 declare void @_Z4sinkb(i1)
1479 define void @_Z42loop_within_loop_with_multiple_exit_blocksmPPKcS1_Pm(i64 %outer_count, i8** %ptr0, i8** %ptr1, i64* %count) {
1480 ; CHECK-LABEL: @_Z42loop_within_loop_with_multiple_exit_blocksmPPKcS1_Pm(
1481 ; CHECK-NEXT: entry:
1482 ; CHECK-NEXT: [[CMP11:%.*]] = icmp eq i64 [[OUTER_COUNT:%.*]], 0
1483 ; CHECK-NEXT: br i1 [[CMP11]], label [[CLEANUP:%.*]], label [[FOR_BODY_PREHEADER:%.*]]
1484 ; CHECK: for.body.preheader:
1485 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
1487 ; CHECK-NEXT: [[I_012:%.*]] = phi i64 [ [[INC:%.*]], [[IF_END:%.*]] ], [ 0, [[FOR_BODY_PREHEADER]] ]
1488 ; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i8*, i8** [[PTR0:%.*]], i64 [[I_012]]
1489 ; CHECK-NEXT: [[T0:%.*]] = load i8*, i8** [[ARRAYIDX]]
1490 ; CHECK-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds i64, i64* [[COUNT:%.*]], i64 [[I_012]]
1491 ; CHECK-NEXT: [[T1_BYTECOUNT:%.*]] = load i64, i64* [[ARRAYIDX2]]
1492 ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i8, i8* [[T0]], i64 [[T1_BYTECOUNT]]
1493 ; CHECK-NEXT: [[CMP5_I_I:%.*]] = icmp eq i64 [[T1_BYTECOUNT]], 0
1494 ; CHECK-NEXT: br i1 [[CMP5_I_I]], label [[IF_END]], label [[FOR_BODY_I_I_PREHEADER:%.*]]
1495 ; CHECK: for.body.i.i.preheader:
1496 ; CHECK-NEXT: [[ARRAYIDX3:%.*]] = getelementptr inbounds i8*, i8** [[PTR1:%.*]], i64 [[I_012]]
1497 ; CHECK-NEXT: [[T2:%.*]] = load i8*, i8** [[ARRAYIDX3]]
1498 ; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[T0]], i8* [[T2]], i64 [[T1_BYTECOUNT]])
1499 ; CHECK-NEXT: [[T0_VS_T2_EQCMP:%.*]] = icmp eq i32 [[MEMCMP]], 0
1500 ; CHECK-NEXT: br label [[FOR_BODY_I_I_BCMPDISPATCHBB:%.*]]
1501 ; CHECK: for.body.i.i.bcmpdispatchbb:
1502 ; CHECK-NEXT: br i1 [[T0_VS_T2_EQCMP]], label [[T0_VS_T2_EQCMP_EQUALBB:%.*]], label [[T0_VS_T2_EQCMP_UNEQUALBB:%.*]]
1503 ; CHECK: t0.vs.t2.eqcmp.equalbb:
1504 ; CHECK-NEXT: br i1 true, label [[IF_END_LOOPEXIT:%.*]], label [[FOR_BODY_I_I_BCMPDISPATCHBB]]
1505 ; CHECK: t0.vs.t2.eqcmp.unequalbb:
1506 ; CHECK-NEXT: br i1 true, label [[IF_THEN:%.*]], label [[FOR_BODY_I_I_BCMPDISPATCHBB]]
1508 ; CHECK-NEXT: tail call void @_Z17callee_on_unequalv()
1509 ; CHECK-NEXT: br label [[CLEANUP]]
1510 ; CHECK: if.end.loopexit:
1511 ; CHECK-NEXT: br label [[IF_END]]
1513 ; CHECK-NEXT: tail call void @_Z17callee_on_successv()
1514 ; CHECK-NEXT: [[INC]] = add nuw i64 [[I_012]], 1
1515 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i64 [[INC]], [[OUTER_COUNT]]
1516 ; CHECK-NEXT: br i1 [[CMP]], label [[CLEANUP_LOOPEXIT:%.*]], label [[FOR_BODY]]
1517 ; CHECK: cleanup.loopexit:
1518 ; CHECK-NEXT: br label [[CLEANUP]]
1520 ; CHECK-NEXT: ret void
1523 %cmp11 = icmp eq i64 %outer_count, 0
1524 br i1 %cmp11, label %cleanup, label %for.body
1526 for.body: ; preds = %entry, %if.end
1527 %i.012 = phi i64 [ %inc, %if.end ], [ 0, %entry ]
1528 %arrayidx = getelementptr inbounds i8*, i8** %ptr0, i64 %i.012
1529 %t0 = load i8*, i8** %arrayidx
1530 %arrayidx2 = getelementptr inbounds i64, i64* %count, i64 %i.012
1531 %t1 = load i64, i64* %arrayidx2
1532 %add.ptr = getelementptr inbounds i8, i8* %t0, i64 %t1
1533 %cmp5.i.i = icmp eq i64 %t1, 0
1534 br i1 %cmp5.i.i, label %if.end, label %for.body.i.i.preheader
1536 for.body.i.i.preheader: ; preds = %for.body
1537 %arrayidx3 = getelementptr inbounds i8*, i8** %ptr1, i64 %i.012
1538 %t2 = load i8*, i8** %arrayidx3
1539 br label %for.body.i.i
1541 for.body.i.i: ; preds = %for.body.i.i.preheader, %for.inc.i.i
1542 %__first2.addr.07.i.i = phi i8* [ %incdec.ptr1.i.i, %for.inc.i.i ], [ %t2, %for.body.i.i.preheader ]
1543 %__first1.addr.06.i.i = phi i8* [ %incdec.ptr.i.i, %for.inc.i.i ], [ %t0, %for.body.i.i.preheader ]
1544 %t3 = load i8, i8* %__first1.addr.06.i.i
1545 %t4 = load i8, i8* %__first2.addr.07.i.i
1546 %cmp.i.i.i = icmp eq i8 %t3, %t4
1547 br i1 %cmp.i.i.i, label %for.inc.i.i, label %if.then
1549 for.inc.i.i: ; preds = %for.body.i.i
1550 %incdec.ptr.i.i = getelementptr inbounds i8, i8* %__first1.addr.06.i.i, i64 1
1551 %incdec.ptr1.i.i = getelementptr inbounds i8, i8* %__first2.addr.07.i.i, i64 1
1552 %cmp.i.i = icmp eq i8* %incdec.ptr.i.i, %add.ptr
1553 br i1 %cmp.i.i, label %if.end, label %for.body.i.i
1555 if.then: ; preds = %for.body.i.i
1556 tail call void @_Z17callee_on_unequalv()
1559 if.end: ; preds = %for.inc.i.i, %for.body
1560 tail call void @_Z17callee_on_successv()
1561 %inc = add nuw i64 %i.012, 1
1562 %cmp = icmp eq i64 %inc, %outer_count
1563 br i1 %cmp, label %cleanup, label %for.body
1565 cleanup: ; preds = %if.end, %entry, %if.then
1569 define void @_Z21endless_loop_if_equalPiS_(i32* %a, i32* %b) {
1570 ; CHECK-LABEL: @_Z21endless_loop_if_equalPiS_(
1571 ; CHECK-NEXT: entry:
1572 ; CHECK-NEXT: br label [[FOR_COND:%.*]]
1573 ; CHECK: for.cond.loopexit:
1574 ; CHECK-NEXT: br label [[FOR_COND]]
1576 ; CHECK-NEXT: [[CSTR:%.*]] = bitcast i32* [[A:%.*]] to i8*
1577 ; CHECK-NEXT: [[CSTR1:%.*]] = bitcast i32* [[B:%.*]] to i8*
1578 ; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[CSTR]], i8* [[CSTR1]], i64 16)
1579 ; CHECK-NEXT: [[A_VS_B_EQCMP:%.*]] = icmp eq i32 [[MEMCMP]], 0
1580 ; CHECK-NEXT: br label [[FOR_BODY_BCMPDISPATCHBB:%.*]]
1581 ; CHECK: for.body.bcmpdispatchbb:
1582 ; CHECK-NEXT: br i1 [[A_VS_B_EQCMP]], label [[A_VS_B_EQCMP_EQUALBB:%.*]], label [[A_VS_B_EQCMP_UNEQUALBB:%.*]]
1583 ; CHECK: a.vs.b.eqcmp.equalbb:
1584 ; CHECK-NEXT: br i1 true, label [[FOR_COND_LOOPEXIT:%.*]], label [[FOR_BODY_BCMPDISPATCHBB]]
1585 ; CHECK: a.vs.b.eqcmp.unequalbb:
1586 ; CHECK-NEXT: br i1 true, label [[RETURN:%.*]], label [[FOR_BODY_BCMPDISPATCHBB]]
1588 ; CHECK-NEXT: ret void
1593 for.cond: ; preds = %for.cond1, %entry
1596 for.cond1: ; preds = %for.body
1597 %cmp = icmp ult i64 %indvars.iv.next, 4
1598 br i1 %cmp, label %for.body, label %for.cond
1600 for.body: ; preds = %for.cond, %for.cond1
1601 %indvars.iv = phi i64 [ 0, %for.cond ], [ %indvars.iv.next, %for.cond1 ]
1602 %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
1603 %0 = load i32, i32* %arrayidx
1604 %arrayidx3 = getelementptr inbounds i32, i32* %b, i64 %indvars.iv
1605 %1 = load i32, i32* %arrayidx3
1606 %cmp4 = icmp eq i32 %0, %1
1607 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
1608 br i1 %cmp4, label %for.cond1, label %return
1610 return: ; preds = %for.body
1614 define i1 @_Z21load_of_bitcastsPKcPKfm(i8* %ptr0, float* %ptr1, i64 %count) {
1615 ; CHECK-LABEL: @_Z21load_of_bitcastsPKcPKfm(
1616 ; CHECK-NEXT: entry:
1617 ; CHECK-NEXT: [[CMP13:%.*]] = icmp eq i64 [[COUNT:%.*]], 0
1618 ; CHECK-NEXT: br i1 [[CMP13]], label [[CLEANUP3:%.*]], label [[FOR_BODY_BCMPDISPATCHBB:%.*]]
1619 ; CHECK: for.body.bcmpdispatchbb:
1620 ; CHECK-NEXT: [[DOTBYTECOUNT:%.*]] = shl nuw i64 [[COUNT]], 2
1621 ; CHECK-NEXT: [[CSTR:%.*]] = bitcast float* [[PTR1:%.*]] to i8*
1622 ; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[PTR0:%.*]], i8* [[CSTR]], i64 [[DOTBYTECOUNT]])
1623 ; CHECK-NEXT: [[PTR0_VS_PTR1_EQCMP:%.*]] = icmp eq i32 [[MEMCMP]], 0
1624 ; CHECK-NEXT: br i1 [[PTR0_VS_PTR1_EQCMP]], label [[PTR0_VS_PTR1_EQCMP_EQUALBB:%.*]], label [[PTR0_VS_PTR1_EQCMP_UNEQUALBB:%.*]]
1625 ; CHECK: ptr0.vs.ptr1.eqcmp.equalbb:
1626 ; CHECK-NEXT: br label [[CLEANUP3_LOOPEXIT:%.*]]
1627 ; CHECK: ptr0.vs.ptr1.eqcmp.unequalbb:
1628 ; CHECK-NEXT: br label [[CLEANUP3_LOOPEXIT]]
1629 ; CHECK: cleanup3.loopexit:
1630 ; CHECK-NEXT: [[RES_PH:%.*]] = phi i1 [ false, [[PTR0_VS_PTR1_EQCMP_UNEQUALBB]] ], [ true, [[PTR0_VS_PTR1_EQCMP_EQUALBB]] ]
1631 ; CHECK-NEXT: br label [[CLEANUP3]]
1633 ; CHECK-NEXT: [[RES:%.*]] = phi i1 [ true, [[ENTRY:%.*]] ], [ [[RES_PH]], [[CLEANUP3_LOOPEXIT]] ]
1634 ; CHECK-NEXT: ret i1 [[RES]]
1637 %cmp13 = icmp eq i64 %count, 0
1638 br i1 %cmp13, label %cleanup3, label %for.body
1640 for.body: ; preds = %entry, %for.inc
1641 %ptr0.addr.016 = phi i8* [ %add.ptr, %for.inc ], [ %ptr0, %entry ]
1642 %i.015 = phi i64 [ %inc, %for.inc ], [ 0, %entry ]
1643 %ptr1.addr.014 = phi float* [ %incdec.ptr, %for.inc ], [ %ptr1, %entry ]
1644 %v0.0..sroa_cast = bitcast i8* %ptr0.addr.016 to i32*
1645 %v0.0.copyload = load i32, i32* %v0.0..sroa_cast
1646 %v1.0..sroa_cast = bitcast float* %ptr1.addr.014 to i32*
1647 %v1.0.copyload = load i32, i32* %v1.0..sroa_cast
1648 %cmp1 = icmp eq i32 %v0.0.copyload, %v1.0.copyload
1649 br i1 %cmp1, label %for.inc, label %cleanup3
1651 for.inc: ; preds = %for.body
1652 %inc = add nuw i64 %i.015, 1
1653 %add.ptr = getelementptr inbounds i8, i8* %ptr0.addr.016, i64 4
1654 %incdec.ptr = getelementptr inbounds float, float* %ptr1.addr.014, i64 1
1655 %cmp = icmp ult i64 %inc, %count
1656 br i1 %cmp, label %for.body, label %cleanup3
1658 cleanup3: ; preds = %for.body, %for.inc, %entry
1659 %res = phi i1 [ true, %entry ], [ true, %for.inc ], [ false, %for.body ]
1664 define i1 @_Z17overlapping_loadsPKcS0_m(i8* %ptr0, i8* %ptr1, i64 %count) {
1665 ; CHECK-LABEL: @_Z17overlapping_loadsPKcS0_m(
1666 ; CHECK-NEXT: entry:
1667 ; CHECK-NEXT: [[CMP14:%.*]] = icmp eq i64 [[COUNT:%.*]], 0
1668 ; CHECK-NEXT: br i1 [[CMP14]], label [[CLEANUP4:%.*]], label [[FOR_BODY_PREHEADER:%.*]]
1669 ; CHECK: for.body.preheader:
1670 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
1672 ; CHECK-NEXT: [[PTR0_ADDR_017:%.*]] = phi i8* [ [[INCDEC_PTR:%.*]], [[FOR_INC:%.*]] ], [ [[PTR0:%.*]], [[FOR_BODY_PREHEADER]] ]
1673 ; CHECK-NEXT: [[I_016:%.*]] = phi i64 [ [[INC:%.*]], [[FOR_INC]] ], [ 0, [[FOR_BODY_PREHEADER]] ]
1674 ; CHECK-NEXT: [[PTR1_ADDR_015:%.*]] = phi i8* [ [[INCDEC_PTR3:%.*]], [[FOR_INC]] ], [ [[PTR1:%.*]], [[FOR_BODY_PREHEADER]] ]
1675 ; CHECK-NEXT: [[V0_0__SROA_CAST:%.*]] = bitcast i8* [[PTR0_ADDR_017]] to i32*
1676 ; CHECK-NEXT: [[V0_0_COPYLOAD:%.*]] = load i32, i32* [[V0_0__SROA_CAST]]
1677 ; CHECK-NEXT: [[V1_0__SROA_CAST:%.*]] = bitcast i8* [[PTR1_ADDR_015]] to i32*
1678 ; CHECK-NEXT: [[V1_0_COPYLOAD:%.*]] = load i32, i32* [[V1_0__SROA_CAST]]
1679 ; CHECK-NEXT: [[CMP1:%.*]] = icmp eq i32 [[V0_0_COPYLOAD]], [[V1_0_COPYLOAD]]
1680 ; CHECK-NEXT: br i1 [[CMP1]], label [[FOR_INC]], label [[CLEANUP4_LOOPEXIT:%.*]]
1682 ; CHECK-NEXT: [[INC]] = add nuw i64 [[I_016]], 1
1683 ; CHECK-NEXT: [[INCDEC_PTR]] = getelementptr inbounds i8, i8* [[PTR0_ADDR_017]], i64 1
1684 ; CHECK-NEXT: [[INCDEC_PTR3]] = getelementptr inbounds i8, i8* [[PTR1_ADDR_015]], i64 1
1685 ; CHECK-NEXT: [[CMP:%.*]] = icmp ult i64 [[INC]], [[COUNT]]
1686 ; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[CLEANUP4_LOOPEXIT]]
1687 ; CHECK: cleanup4.loopexit:
1688 ; CHECK-NEXT: [[RES_PH:%.*]] = phi i1 [ false, [[FOR_BODY]] ], [ true, [[FOR_INC]] ]
1689 ; CHECK-NEXT: br label [[CLEANUP4]]
1691 ; CHECK-NEXT: [[RES:%.*]] = phi i1 [ true, [[ENTRY:%.*]] ], [ [[RES_PH]], [[CLEANUP4_LOOPEXIT]] ]
1692 ; CHECK-NEXT: ret i1 [[RES]]
1695 %cmp14 = icmp eq i64 %count, 0
1696 br i1 %cmp14, label %cleanup4, label %for.body
1698 for.body: ; preds = %entry, %for.inc
1699 %ptr0.addr.017 = phi i8* [ %incdec.ptr, %for.inc ], [ %ptr0, %entry ]
1700 %i.016 = phi i64 [ %inc, %for.inc ], [ 0, %entry ]
1701 %ptr1.addr.015 = phi i8* [ %incdec.ptr3, %for.inc ], [ %ptr1, %entry ]
1702 %v0.0..sroa_cast = bitcast i8* %ptr0.addr.017 to i32*
1703 %v0.0.copyload = load i32, i32* %v0.0..sroa_cast
1704 %v1.0..sroa_cast = bitcast i8* %ptr1.addr.015 to i32*
1705 %v1.0.copyload = load i32, i32* %v1.0..sroa_cast
1706 %cmp1 = icmp eq i32 %v0.0.copyload, %v1.0.copyload
1707 br i1 %cmp1, label %for.inc, label %cleanup4
1709 for.inc: ; preds = %for.body
1710 %inc = add nuw i64 %i.016, 1
1711 %incdec.ptr = getelementptr inbounds i8, i8* %ptr0.addr.017, i64 1
1712 %incdec.ptr3 = getelementptr inbounds i8, i8* %ptr1.addr.015, i64 1
1713 %cmp = icmp ult i64 %inc, %count
1714 br i1 %cmp, label %for.body, label %cleanup4
1716 cleanup4: ; preds = %for.body, %for.inc, %entry
1717 %res = phi i1 [ true, %entry ], [ true, %for.inc ], [ false, %for.body ]
1721 define i1 @exit_block_is_not_dedicated(i8* %ptr0, i8* %ptr1) {
1722 ; CHECK-LABEL: @exit_block_is_not_dedicated(
1723 ; CHECK-NEXT: entry:
1724 ; CHECK-NEXT: br i1 true, label [[FOR_BODY_BCMPDISPATCHBB:%.*]], label [[CLEANUP:%.*]]
1725 ; CHECK: for.body.bcmpdispatchbb:
1726 ; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(i8* [[PTR0:%.*]], i8* [[PTR1:%.*]], i64 8)
1727 ; CHECK-NEXT: [[PTR0_VS_PTR1_EQCMP:%.*]] = icmp eq i32 [[MEMCMP]], 0
1728 ; CHECK-NEXT: br i1 [[PTR0_VS_PTR1_EQCMP]], label [[PTR0_VS_PTR1_EQCMP_EQUALBB:%.*]], label [[PTR0_VS_PTR1_EQCMP_UNEQUALBB:%.*]]
1729 ; CHECK: ptr0.vs.ptr1.eqcmp.equalbb:
1730 ; CHECK-NEXT: br label [[CLEANUP_LOOPEXIT:%.*]]
1731 ; CHECK: ptr0.vs.ptr1.eqcmp.unequalbb:
1732 ; CHECK-NEXT: br label [[CLEANUP_LOOPEXIT]]
1733 ; CHECK: cleanup.loopexit:
1734 ; CHECK-NEXT: [[RES_PH:%.*]] = phi i1 [ true, [[PTR0_VS_PTR1_EQCMP_EQUALBB]] ], [ false, [[PTR0_VS_PTR1_EQCMP_UNEQUALBB]] ]
1735 ; CHECK-NEXT: br label [[CLEANUP]]
1737 ; CHECK-NEXT: [[RES:%.*]] = phi i1 [ false, [[ENTRY:%.*]] ], [ [[RES_PH]], [[CLEANUP_LOOPEXIT]] ]
1738 ; CHECK-NEXT: ret i1 [[RES]]
1741 br i1 true, label %for.body, label %cleanup
1744 %i.08 = phi i64 [ 0, %entry ], [ %inc, %for.cond ]
1745 %arrayidx = getelementptr inbounds i8, i8* %ptr0, i64 %i.08
1746 %v0 = load i8, i8* %arrayidx
1747 %arrayidx1 = getelementptr inbounds i8, i8* %ptr1, i64 %i.08
1748 %v1 = load i8, i8* %arrayidx1
1749 %cmp3 = icmp eq i8 %v0, %v1
1750 %inc = add nuw nsw i64 %i.08, 1
1751 br i1 %cmp3, label %for.cond, label %cleanup
1754 %cmp = icmp ult i64 %inc, 8
1755 br i1 %cmp, label %for.body, label %cleanup
1758 %res = phi i1 [ false, %for.body ], [ true, %for.cond ], [ false, %entry ]
1763 ; int index_wider_than_pointer(int* a, int* b, long long num) {
1764 ; for(long long i = 0; i < num; ++i) {
1770 define dso_local i64 @test(i64* %a, i64* %b, i128 %num) {
1771 ; CHECK-LABEL: @test(
1772 ; CHECK-NEXT: entry:
1773 ; CHECK-NEXT: [[CMP9:%.*]] = icmp sgt i128 [[NUM:%.*]], 0
1774 ; CHECK-NEXT: br i1 [[CMP9]], label [[FOR_BODY_PREHEADER:%.*]], label [[CLEANUP:%.*]]
1775 ; CHECK: for.body.preheader:
1776 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
1778 ; CHECK-NEXT: [[CMP:%.*]] = icmp slt i128 [[INC:%.*]], [[NUM]]
1779 ; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[CLEANUP_LOOPEXIT:%.*]]
1781 ; CHECK-NEXT: [[I_010:%.*]] = phi i128 [ [[INC]], [[FOR_COND:%.*]] ], [ 0, [[FOR_BODY_PREHEADER]] ]
1782 ; CHECK-NEXT: [[IDXPROM:%.*]] = trunc i128 [[I_010]] to i64
1783 ; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i64, i64* [[A:%.*]], i64 [[IDXPROM]]
1784 ; CHECK-NEXT: [[TMP0:%.*]] = load i64, i64* [[ARRAYIDX]]
1785 ; CHECK-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds i64, i64* [[B:%.*]], i64 [[IDXPROM]]
1786 ; CHECK-NEXT: [[TMP1:%.*]] = load i64, i64* [[ARRAYIDX2]]
1787 ; CHECK-NEXT: [[CMP3:%.*]] = icmp eq i64 [[TMP0]], [[TMP1]]
1788 ; CHECK-NEXT: [[INC]] = add nuw nsw i128 [[I_010]], 1
1789 ; CHECK-NEXT: br i1 [[CMP3]], label [[FOR_COND]], label [[CLEANUP_LOOPEXIT]]
1790 ; CHECK: cleanup.loopexit:
1791 ; CHECK-NEXT: [[DOTPH:%.*]] = phi i64 [ 1, [[FOR_BODY]] ], [ 0, [[FOR_COND]] ]
1792 ; CHECK-NEXT: br label [[CLEANUP]]
1794 ; CHECK-NEXT: [[TMP2:%.*]] = phi i64 [ 0, [[ENTRY:%.*]] ], [ [[DOTPH]], [[CLEANUP_LOOPEXIT]] ]
1795 ; CHECK-NEXT: ret i64 [[TMP2]]
1798 %cmp9 = icmp sgt i128 %num, 0
1799 br i1 %cmp9, label %for.body, label %cleanup
1801 for.cond: ; preds = %for.body
1802 %cmp = icmp slt i128 %inc, %num
1803 br i1 %cmp, label %for.body, label %cleanup
1805 for.body: ; preds = %entry, %for.cond
1806 %i.010 = phi i128 [ %inc, %for.cond ], [ 0, %entry ]
1807 %idxprom = trunc i128 %i.010 to i64
1808 %arrayidx = getelementptr inbounds i64, i64* %a, i64 %idxprom
1809 %0 = load i64, i64* %arrayidx
1810 %arrayidx2 = getelementptr inbounds i64, i64* %b, i64 %idxprom
1811 %1 = load i64, i64* %arrayidx2
1812 %cmp3 = icmp eq i64 %0, %1
1813 %inc = add nuw nsw i128 %i.010, 1
1814 br i1 %cmp3, label %for.cond, label %cleanup
1816 cleanup: ; preds = %for.body, %for.cond, %entry
1817 %2 = phi i64 [ 0, %entry ], [ 0, %for.cond ], [ 1, %for.body ]