Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 1 | ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 2 | ; RUN: opt -loop-idiom -verify -verify-each -verify-dom-info -verify-loop-info < %s -S | FileCheck %s |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 3 | |
| 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" |
| 5 | |
| 6 | ; This only tests various forms of loop control-flow. |
| 7 | ; These tests are fully identical to bcmp()==0 otherwise. |
| 8 | |
| 9 | ; #include <algorithm> |
| 10 | ; |
| 11 | ; bool pointer_iteration_const_size_no_overlap(char const* ptr) { |
| 12 | ; return std::equal(ptr, ptr + 8, ptr + 8); |
| 13 | ; } |
| 14 | ; bool pointer_iteration_const_size_partial_overlap(char const* ptr) { |
| 15 | ; return std::equal(ptr, ptr + 16, ptr + 8); |
| 16 | ; } |
| 17 | ; bool pointer_iteration_const_size_overlap_unknown(char const* ptr0, char const* ptr1) { |
| 18 | ; return std::equal(ptr0, ptr0 + 8, ptr1); |
| 19 | ; } |
| 20 | ; |
| 21 | ; bool pointer_iteration_variable_size_no_overlap(char const* ptr, size_t count) { |
| 22 | ; return std::equal(ptr, ptr + count, ptr + count); |
| 23 | ; } |
| 24 | ; bool pointer_iteration_variable_size_partial_overlap(char const* ptr, size_t count) { |
| 25 | ; return std::equal(ptr, ptr + 2 * count, ptr + count); |
| 26 | ; } |
| 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); |
| 29 | ; } |
| 30 | ; |
| 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]) |
| 36 | ; return false; |
| 37 | ; } |
| 38 | ; return true; |
| 39 | ; } |
| 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]) |
| 45 | ; return false; |
| 46 | ; } |
| 47 | ; return true; |
| 48 | ; } |
| 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]) |
| 52 | ; return false; |
| 53 | ; } |
| 54 | ; return true; |
| 55 | ; } |
| 56 | ; |
| 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]) |
| 62 | ; return false; |
| 63 | ; } |
| 64 | ; return true; |
| 65 | ; } |
| 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]) |
| 71 | ; return false; |
| 72 | ; } |
| 73 | ; return true; |
| 74 | ; } |
| 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]) |
| 78 | ; return false; |
| 79 | ; } |
| 80 | ; return true; |
| 81 | ; } |
| 82 | ; |
| 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]) |
| 86 | ; return false; |
| 87 | ; } |
| 88 | ; return true; |
| 89 | ; } |
| 90 | ; |
| 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) { |
| 95 | ; if(*ptr0 != *ptr1) |
| 96 | ; return false; |
| 97 | ; } |
| 98 | ; return true; |
| 99 | ; } |
| 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) { |
| 104 | ; if(*ptr0 != *ptr1) |
| 105 | ; return false; |
| 106 | ; } |
| 107 | ; return true; |
| 108 | ; } |
| 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) { |
| 111 | ; if(*ptr0 != *ptr1) |
| 112 | ; return false; |
| 113 | ; } |
| 114 | ; return true; |
| 115 | ; } |
| 116 | ; |
| 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) { |
| 121 | ; if(*ptr0 != *ptr1) |
| 122 | ; return false; |
| 123 | ; } |
| 124 | ; return true; |
| 125 | ; } |
| 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) { |
| 130 | ; if(*ptr0 != *ptr1) |
| 131 | ; return false; |
| 132 | ; } |
| 133 | ; return true; |
| 134 | ; } |
| 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) { |
| 137 | ; if(*ptr0 != *ptr1) |
| 138 | ; return false; |
| 139 | ; } |
| 140 | ; return true; |
| 141 | ; } |
| 142 | ; |
| 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); |
| 145 | ; } |
| 146 | ; |
| 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); |
| 149 | ; } |
| 150 | ; |
| 151 | ; bool small_index_iteration(char const* ptr0, char const* ptr1, int count) { |
| 152 | ; for(int i = 0; i < count; i++, ++ptr0, ++ptr1) { |
| 153 | ; if(*ptr0 != *ptr1) |
| 154 | ; return false; |
| 155 | ; } |
| 156 | ; return true; |
| 157 | ; } |
| 158 | ; |
| 159 | ; bool three_pointer_iteration(char const* ptr0, char const* ptr0_end, char const* ptr1) { |
| 160 | ; return std::equal(ptr0, ptr0_end, ptr1); |
| 161 | ; } |
| 162 | ; |
| 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)) |
| 165 | ; return on_equal; |
| 166 | ; return on_unequal; |
| 167 | ; } |
| 168 | ; |
| 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(); |
| 174 | ; return; |
| 175 | ; } |
| 176 | ; callee_on_success(); |
| 177 | ; } |
| 178 | ; |
| 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)) { |
| 182 | ; o0 = v0; |
| 183 | ; o1 = v1; |
| 184 | ; } else { |
| 185 | ; o0 = v2; |
| 186 | ; o1 = v3; |
| 187 | ; } |
| 188 | ; *out0 = o0; |
| 189 | ; *out1 = o1; |
| 190 | ; } |
| 191 | ; |
| 192 | ; void sink(bool); |
| 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])); |
| 196 | ; } |
| 197 | ; |
| 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(); |
| 202 | ; return; |
| 203 | ; } |
| 204 | ; callee_on_success(); |
| 205 | ; } |
| 206 | ; } |
| 207 | ; |
| 208 | ; void endless_loop_if_equal(int *a, int *b) { |
| 209 | ; for (;;) { |
| 210 | ; for (int c = 0; c < 4; c++) { |
| 211 | ; if (a[c] != b[c]) |
| 212 | ; return; |
| 213 | ; } |
| 214 | ; } |
| 215 | ; } |
| 216 | ; |
| 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++) { |
| 219 | ; int v0, v1; |
| 220 | ; memcpy(&v0, ptr0, sizeof(float)); |
| 221 | ; memcpy(&v1, ptr1, sizeof(float)); |
| 222 | ; if(v0 != v1) |
| 223 | ; return false; |
| 224 | ; } |
| 225 | ; return true; |
| 226 | ; } |
| 227 | ; |
| 228 | ; // FIXME |
| 229 | ; bool overlapping_loads(char const* ptr0, char const* ptr1, size_t count) { |
| 230 | ; for(size_t i = 0; i < count; i++, ptr0++, ptr1++) { |
| 231 | ; int v0, v1; |
| 232 | ; memcpy(&v0, ptr0, sizeof(float)); |
| 233 | ; memcpy(&v1, ptr1, sizeof(float)); |
| 234 | ; if(v0 != v1) |
| 235 | ; return false; |
| 236 | ; } |
| 237 | ; return true; |
| 238 | ; } |
| 239 | |
| 240 | define i1 @_Z39pointer_iteration_const_size_no_overlapPKc(i8* %ptr) { |
| 241 | ; CHECK-LABEL: @_Z39pointer_iteration_const_size_no_overlapPKc( |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 242 | ; CHECK-NEXT: for.body.i.i.bcmpdispatchbb: |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 243 | ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i8, i8* [[PTR:%.*]], i64 8 |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 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]] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 251 | ; CHECK: _ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit: |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 252 | ; CHECK-NEXT: [[RETVAL_0_I_I:%.*]] = phi i1 [ false, [[PTR_VS_ADD_PTR_EQCMP_UNEQUALBB]] ], [ true, [[PTR_VS_ADD_PTR_EQCMP_EQUALBB]] ] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 253 | ; CHECK-NEXT: ret i1 [[RETVAL_0_I_I]] |
| 254 | ; |
| 255 | entry: |
| 256 | %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 8 |
| 257 | br label %for.body.i.i |
| 258 | |
| 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 |
| 267 | |
| 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 |
| 273 | |
| 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 ] |
| 276 | ret i1 %retval.0.i.i |
| 277 | } |
| 278 | |
| 279 | define i1 @_Z44pointer_iteration_const_size_partial_overlapPKc(i8* %ptr) { |
| 280 | ; CHECK-LABEL: @_Z44pointer_iteration_const_size_partial_overlapPKc( |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 281 | ; CHECK-NEXT: for.body.i.i.bcmpdispatchbb: |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 282 | ; CHECK-NEXT: [[ADD_PTR1:%.*]] = getelementptr inbounds i8, i8* [[PTR:%.*]], i64 8 |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 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]] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 290 | ; CHECK: _ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit: |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 291 | ; CHECK-NEXT: [[RETVAL_0_I_I:%.*]] = phi i1 [ false, [[PTR_VS_ADD_PTR1_EQCMP_UNEQUALBB]] ], [ true, [[PTR_VS_ADD_PTR1_EQCMP_EQUALBB]] ] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 292 | ; CHECK-NEXT: ret i1 [[RETVAL_0_I_I]] |
| 293 | ; |
| 294 | entry: |
| 295 | %add.ptr1 = getelementptr inbounds i8, i8* %ptr, i64 8 |
| 296 | br label %for.body.i.i |
| 297 | |
| 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 |
| 306 | |
| 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 |
| 312 | |
| 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 ] |
| 315 | ret i1 %retval.0.i.i |
| 316 | } |
| 317 | |
| 318 | define i1 @_Z44pointer_iteration_const_size_overlap_unknownPKcS0_(i8* %ptr0, i8* %ptr1) { |
| 319 | ; CHECK-LABEL: @_Z44pointer_iteration_const_size_overlap_unknownPKcS0_( |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 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]] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 328 | ; CHECK: _ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit: |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 329 | ; CHECK-NEXT: [[RETVAL_0_I_I:%.*]] = phi i1 [ false, [[PTR0_VS_PTR1_EQCMP_UNEQUALBB]] ], [ true, [[PTR0_VS_PTR1_EQCMP_EQUALBB]] ] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 330 | ; CHECK-NEXT: ret i1 [[RETVAL_0_I_I]] |
| 331 | ; |
| 332 | entry: |
| 333 | br label %for.body.i.i |
| 334 | |
| 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 |
| 343 | |
| 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 |
| 349 | |
| 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 ] |
| 352 | ret i1 %retval.0.i.i |
| 353 | } |
| 354 | |
| 355 | define i1 @_Z42pointer_iteration_variable_size_no_overlapPKcm(i8* %ptr, i64 %count) { |
| 356 | ; CHECK-LABEL: @_Z42pointer_iteration_variable_size_no_overlapPKcm( |
| 357 | ; CHECK-NEXT: entry: |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 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]] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 369 | ; CHECK: _ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit.loopexit: |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 370 | ; CHECK-NEXT: [[RETVAL_0_I_I_PH:%.*]] = phi i1 [ false, [[PTR_VS_ADD_PTR_EQCMP_UNEQUALBB]] ], [ true, [[PTR_VS_ADD_PTR_EQCMP_EQUALBB]] ] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 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]] |
| 375 | ; |
| 376 | entry: |
| 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 |
| 380 | |
| 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 |
| 388 | |
| 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 |
| 394 | |
| 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 ] |
| 397 | ret i1 %retval.0.i.i |
| 398 | } |
| 399 | |
| 400 | define i1 @_Z47pointer_iteration_variable_size_partial_overlapPKcm(i8* %ptr, i64 %count) { |
| 401 | ; CHECK-LABEL: @_Z47pointer_iteration_variable_size_partial_overlapPKcm( |
| 402 | ; CHECK-NEXT: entry: |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 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: |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 408 | ; CHECK-NEXT: [[ADD_PTR1:%.*]] = getelementptr inbounds i8, i8* [[PTR]], i64 [[COUNT]] |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 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]] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 416 | ; CHECK: _ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit.loopexit: |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 417 | ; CHECK-NEXT: [[RETVAL_0_I_I_PH:%.*]] = phi i1 [ false, [[PTR_VS_ADD_PTR1_EQCMP_UNEQUALBB]] ], [ true, [[PTR_VS_ADD_PTR1_EQCMP_EQUALBB]] ] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 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]] |
| 422 | ; |
| 423 | entry: |
| 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 |
| 428 | |
| 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 |
| 432 | |
| 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 |
| 440 | |
| 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 |
| 446 | |
| 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 ] |
| 449 | ret i1 %retval.0.i.i |
| 450 | } |
| 451 | |
| 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( |
| 454 | ; CHECK-NEXT: entry: |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 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]] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 466 | ; CHECK: _ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit.loopexit: |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 467 | ; CHECK-NEXT: [[RETVAL_0_I_I_PH:%.*]] = phi i1 [ false, [[PTR0_VS_PTR1_EQCMP_UNEQUALBB]] ], [ true, [[PTR0_VS_PTR1_EQCMP_EQUALBB]] ] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 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]] |
| 472 | ; |
| 473 | entry: |
| 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 |
| 477 | |
| 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 |
| 485 | |
| 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 |
| 491 | |
| 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 ] |
| 494 | ret i1 %retval.0.i.i |
| 495 | } |
| 496 | |
| 497 | define i1 @_Z40index_iteration_eq_const_size_no_overlapPKc(i8* %ptr) { |
| 498 | ; CHECK-LABEL: @_Z40index_iteration_eq_const_size_no_overlapPKc( |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 499 | ; CHECK-NEXT: for.body.bcmpdispatchbb: |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 500 | ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i8, i8* [[PTR:%.*]], i64 8 |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 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]] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 508 | ; CHECK: cleanup: |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 509 | ; CHECK-NEXT: [[RES:%.*]] = phi i1 [ false, [[PTR_VS_ADD_PTR_EQCMP_UNEQUALBB]] ], [ true, [[PTR_VS_ADD_PTR_EQCMP_EQUALBB]] ] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 510 | ; CHECK-NEXT: ret i1 [[RES]] |
| 511 | ; |
| 512 | entry: |
| 513 | %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 8 |
| 514 | br label %for.body |
| 515 | |
| 516 | for.cond: ; preds = %for.body |
| 517 | %cmp = icmp ult i64 %inc, 8 |
| 518 | br i1 %cmp, label %for.body, label %cleanup |
| 519 | |
| 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 |
| 529 | |
| 530 | cleanup: ; preds = %for.cond, %for.body |
| 531 | %res = phi i1 [ false, %for.body ], [ true, %for.cond ] |
| 532 | ret i1 %res |
| 533 | } |
| 534 | |
| 535 | define i1 @_Z45index_iteration_eq_const_size_partial_overlapPKc(i8* %ptr) { |
| 536 | ; CHECK-LABEL: @_Z45index_iteration_eq_const_size_partial_overlapPKc( |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 537 | ; CHECK-NEXT: for.body.bcmpdispatchbb: |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 538 | ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i8, i8* [[PTR:%.*]], i64 8 |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 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]] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 546 | ; CHECK: cleanup: |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 547 | ; CHECK-NEXT: [[RES:%.*]] = phi i1 [ false, [[PTR_VS_ADD_PTR_EQCMP_UNEQUALBB]] ], [ true, [[PTR_VS_ADD_PTR_EQCMP_EQUALBB]] ] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 548 | ; CHECK-NEXT: ret i1 [[RES]] |
| 549 | ; |
| 550 | entry: |
| 551 | %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 8 |
| 552 | br label %for.body |
| 553 | |
| 554 | for.cond: ; preds = %for.body |
| 555 | %cmp = icmp ult i64 %inc, 16 |
| 556 | br i1 %cmp, label %for.body, label %cleanup |
| 557 | |
| 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 |
| 567 | |
| 568 | cleanup: ; preds = %for.cond, %for.body |
| 569 | %res = phi i1 [ false, %for.body ], [ true, %for.cond ] |
| 570 | ret i1 %res |
| 571 | } |
| 572 | |
| 573 | define i1 @_Z45index_iteration_eq_const_size_overlap_unknownPKcS0_(i8* %ptr0, i8* %ptr1) { |
| 574 | ; CHECK-LABEL: @_Z45index_iteration_eq_const_size_overlap_unknownPKcS0_( |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 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]] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 583 | ; CHECK: cleanup: |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 584 | ; CHECK-NEXT: [[RES:%.*]] = phi i1 [ false, [[PTR0_VS_PTR1_EQCMP_UNEQUALBB]] ], [ true, [[PTR0_VS_PTR1_EQCMP_EQUALBB]] ] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 585 | ; CHECK-NEXT: ret i1 [[RES]] |
| 586 | ; |
| 587 | entry: |
| 588 | br label %for.body |
| 589 | |
| 590 | for.cond: ; preds = %for.body |
| 591 | %cmp = icmp ult i64 %inc, 8 |
| 592 | br i1 %cmp, label %for.body, label %cleanup |
| 593 | |
| 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 |
| 603 | |
| 604 | cleanup: ; preds = %for.cond, %for.body |
| 605 | %res = phi i1 [ false, %for.body ], [ true, %for.cond ] |
| 606 | ret i1 %res |
| 607 | } |
| 608 | |
| 609 | define i1 @_Z43index_iteration_eq_variable_size_no_overlapPKcm(i8* %ptr, i64 %count) { |
| 610 | ; CHECK-LABEL: @_Z43index_iteration_eq_variable_size_no_overlapPKcm( |
| 611 | ; CHECK-NEXT: entry: |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 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]] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 623 | ; CHECK: cleanup.loopexit: |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 624 | ; CHECK-NEXT: [[RES_PH:%.*]] = phi i1 [ false, [[PTR_VS_ADD_PTR_EQCMP_UNEQUALBB]] ], [ true, [[PTR_VS_ADD_PTR_EQCMP_EQUALBB]] ] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 625 | ; CHECK-NEXT: br label [[CLEANUP]] |
| 626 | ; CHECK: cleanup: |
| 627 | ; CHECK-NEXT: [[RES:%.*]] = phi i1 [ true, [[ENTRY:%.*]] ], [ [[RES_PH]], [[CLEANUP_LOOPEXIT]] ] |
| 628 | ; CHECK-NEXT: ret i1 [[RES]] |
| 629 | ; |
| 630 | entry: |
| 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 |
| 634 | |
| 635 | for.cond: ; preds = %for.body |
| 636 | %cmp = icmp ult i64 %inc, %count |
| 637 | br i1 %cmp, label %for.body, label %cleanup |
| 638 | |
| 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 |
| 648 | |
| 649 | cleanup: ; preds = %for.body, %for.cond, %entry |
| 650 | %res = phi i1 [ true, %entry ], [ true, %for.cond ], [ false, %for.body ] |
| 651 | ret i1 %res |
| 652 | } |
| 653 | |
| 654 | define i1 @_Z48index_iteration_eq_variable_size_partial_overlapPKcm(i8* %ptr, i64 %count) { |
| 655 | ; CHECK-LABEL: @_Z48index_iteration_eq_variable_size_partial_overlapPKcm( |
| 656 | ; CHECK-NEXT: entry: |
| 657 | ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i8, i8* [[PTR:%.*]], i64 [[COUNT:%.*]] |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 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]] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 669 | ; CHECK: cleanup.loopexit: |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 670 | ; CHECK-NEXT: [[RES_PH:%.*]] = phi i1 [ false, [[PTR_VS_ADD_PTR_EQCMP_UNEQUALBB]] ], [ true, [[PTR_VS_ADD_PTR_EQCMP_EQUALBB]] ] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 671 | ; CHECK-NEXT: br label [[CLEANUP]] |
| 672 | ; CHECK: cleanup: |
| 673 | ; CHECK-NEXT: [[RES:%.*]] = phi i1 [ true, [[ENTRY:%.*]] ], [ [[RES_PH]], [[CLEANUP_LOOPEXIT]] ] |
| 674 | ; CHECK-NEXT: ret i1 [[RES]] |
| 675 | ; |
| 676 | entry: |
| 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 |
| 681 | |
| 682 | for.cond: ; preds = %for.body |
| 683 | %cmp = icmp ult i64 %inc, %mul |
| 684 | br i1 %cmp, label %for.body, label %cleanup |
| 685 | |
| 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 |
| 695 | |
| 696 | cleanup: ; preds = %for.body, %for.cond, %entry |
| 697 | %res = phi i1 [ true, %entry ], [ true, %for.cond ], [ false, %for.body ] |
| 698 | ret i1 %res |
| 699 | } |
| 700 | |
| 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( |
| 703 | ; CHECK-NEXT: entry: |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 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]] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 714 | ; CHECK: cleanup.loopexit: |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 715 | ; CHECK-NEXT: [[RES_PH:%.*]] = phi i1 [ false, [[PTR0_VS_PTR1_EQCMP_UNEQUALBB]] ], [ true, [[PTR0_VS_PTR1_EQCMP_EQUALBB]] ] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 716 | ; CHECK-NEXT: br label [[CLEANUP]] |
| 717 | ; CHECK: cleanup: |
| 718 | ; CHECK-NEXT: [[RES:%.*]] = phi i1 [ true, [[ENTRY:%.*]] ], [ [[RES_PH]], [[CLEANUP_LOOPEXIT]] ] |
| 719 | ; CHECK-NEXT: ret i1 [[RES]] |
| 720 | ; |
| 721 | entry: |
| 722 | %cmp8 = icmp eq i64 %count, 0 |
| 723 | br i1 %cmp8, label %cleanup, label %for.body |
| 724 | |
| 725 | for.cond: ; preds = %for.body |
| 726 | %cmp = icmp ult i64 %inc, %count |
| 727 | br i1 %cmp, label %for.body, label %cleanup |
| 728 | |
| 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 |
| 738 | |
| 739 | cleanup: ; preds = %for.body, %for.cond, %entry |
| 740 | %res = phi i1 [ true, %entry ], [ true, %for.cond ], [ false, %for.body ] |
| 741 | ret i1 %res |
| 742 | } |
| 743 | |
| 744 | define i1 @_Z38index_iteration_starting_from_negativePKcS0_(i8* %ptr0, i8* %ptr1) { |
| 745 | ; CHECK-LABEL: @_Z38index_iteration_starting_from_negativePKcS0_( |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 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]] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 756 | ; CHECK: cleanup: |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 757 | ; CHECK-NEXT: [[RET:%.*]] = phi i1 [ false, [[SCEVGEP_VS_SCEVGEP1_EQCMP_UNEQUALBB]] ], [ true, [[SCEVGEP_VS_SCEVGEP1_EQCMP_EQUALBB]] ] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 758 | ; CHECK-NEXT: ret i1 [[RET]] |
| 759 | ; |
| 760 | entry: |
| 761 | br label %for.body |
| 762 | |
| 763 | for.cond: ; preds = %for.body |
| 764 | %cmp = icmp slt i64 %indvars.iv.next, 4 |
| 765 | br i1 %cmp, label %for.body, label %cleanup |
| 766 | |
| 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 |
| 776 | |
| 777 | cleanup: ; preds = %for.cond, %for.body |
| 778 | %ret = phi i1 [ false, %for.body ], [ true, %for.cond ] |
| 779 | ret i1 %ret |
| 780 | } |
| 781 | |
| 782 | define i1 @_Z43combined_iteration_eq_const_size_no_overlapPKc(i8* %ptr) { |
| 783 | ; CHECK-LABEL: @_Z43combined_iteration_eq_const_size_no_overlapPKc( |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 784 | ; CHECK-NEXT: for.body.bcmpdispatchbb: |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 785 | ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i8, i8* [[PTR:%.*]], i64 8 |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 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]] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 793 | ; CHECK: cleanup: |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 794 | ; CHECK-NEXT: [[RES:%.*]] = phi i1 [ false, [[PTR_VS_ADD_PTR_EQCMP_UNEQUALBB]] ], [ true, [[PTR_VS_ADD_PTR_EQCMP_EQUALBB]] ] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 795 | ; CHECK-NEXT: ret i1 [[RES]] |
| 796 | ; |
| 797 | entry: |
| 798 | %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 8 |
| 799 | br label %for.body |
| 800 | |
| 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 |
| 809 | |
| 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 |
| 816 | |
| 817 | cleanup: ; preds = %for.inc, %for.body |
| 818 | %res = phi i1 [ false, %for.body ], [ true, %for.inc ] |
| 819 | ret i1 %res |
| 820 | } |
| 821 | |
| 822 | define i1 @_Z48combined_iteration_eq_const_size_partial_overlapPKc(i8* %ptr) { |
| 823 | ; CHECK-LABEL: @_Z48combined_iteration_eq_const_size_partial_overlapPKc( |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 824 | ; CHECK-NEXT: for.body.bcmpdispatchbb: |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 825 | ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i8, i8* [[PTR:%.*]], i64 8 |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 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]] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 833 | ; CHECK: cleanup: |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 834 | ; CHECK-NEXT: [[RES:%.*]] = phi i1 [ false, [[PTR_VS_ADD_PTR_EQCMP_UNEQUALBB]] ], [ true, [[PTR_VS_ADD_PTR_EQCMP_EQUALBB]] ] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 835 | ; CHECK-NEXT: ret i1 [[RES]] |
| 836 | ; |
| 837 | entry: |
| 838 | %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 8 |
| 839 | br label %for.body |
| 840 | |
| 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 |
| 849 | |
| 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 |
| 856 | |
| 857 | cleanup: ; preds = %for.inc, %for.body |
| 858 | %res = phi i1 [ false, %for.body ], [ true, %for.inc ] |
| 859 | ret i1 %res |
| 860 | } |
| 861 | |
| 862 | define i1 @_Z48combined_iteration_eq_const_size_overlap_unknownPKcS0_(i8* %ptr0, i8* %ptr1) { |
| 863 | ; CHECK-LABEL: @_Z48combined_iteration_eq_const_size_overlap_unknownPKcS0_( |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 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]] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 872 | ; CHECK: cleanup: |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 873 | ; CHECK-NEXT: [[RES:%.*]] = phi i1 [ false, [[PTR0_VS_PTR1_EQCMP_UNEQUALBB]] ], [ true, [[PTR0_VS_PTR1_EQCMP_EQUALBB]] ] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 874 | ; CHECK-NEXT: ret i1 [[RES]] |
| 875 | ; |
| 876 | entry: |
| 877 | br label %for.body |
| 878 | |
| 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 |
| 887 | |
| 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 |
| 894 | |
| 895 | cleanup: ; preds = %for.inc, %for.body |
| 896 | %res = phi i1 [ false, %for.body ], [ true, %for.inc ] |
| 897 | ret i1 %res |
| 898 | } |
| 899 | |
| 900 | define i1 @_Z46combined_iteration_eq_variable_size_no_overlapPKcm(i8* %ptr, i64 %count) { |
| 901 | ; CHECK-LABEL: @_Z46combined_iteration_eq_variable_size_no_overlapPKcm( |
| 902 | ; CHECK-NEXT: entry: |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 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]] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 914 | ; CHECK: cleanup.loopexit: |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 915 | ; CHECK-NEXT: [[RES_PH:%.*]] = phi i1 [ false, [[PTR_VS_ADD_PTR_EQCMP_UNEQUALBB]] ], [ true, [[PTR_VS_ADD_PTR_EQCMP_EQUALBB]] ] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 916 | ; CHECK-NEXT: br label [[CLEANUP]] |
| 917 | ; CHECK: cleanup: |
| 918 | ; CHECK-NEXT: [[RES:%.*]] = phi i1 [ true, [[ENTRY:%.*]] ], [ [[RES_PH]], [[CLEANUP_LOOPEXIT]] ] |
| 919 | ; CHECK-NEXT: ret i1 [[RES]] |
| 920 | ; |
| 921 | entry: |
| 922 | %cmp14 = icmp eq i64 %count, 0 |
| 923 | br i1 %cmp14, label %cleanup, label %for.body.preheader |
| 924 | |
| 925 | for.body.preheader: ; preds = %entry |
| 926 | %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 %count |
| 927 | br label %for.body |
| 928 | |
| 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 |
| 937 | |
| 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 |
| 944 | |
| 945 | cleanup: ; preds = %for.body, %for.inc, %entry |
| 946 | %res = phi i1 [ true, %entry ], [ true, %for.inc ], [ false, %for.body ] |
| 947 | ret i1 %res |
| 948 | } |
| 949 | |
| 950 | define i1 @_Z51combined_iteration_eq_variable_size_partial_overlapPKcm(i8* %ptr, i64 %count) { |
| 951 | ; CHECK-LABEL: @_Z51combined_iteration_eq_variable_size_partial_overlapPKcm( |
| 952 | ; CHECK-NEXT: entry: |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 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: |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 957 | ; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i8, i8* [[PTR:%.*]], i64 [[COUNT]] |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 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]] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 965 | ; CHECK: cleanup.loopexit: |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 966 | ; CHECK-NEXT: [[RES_PH:%.*]] = phi i1 [ false, [[PTR_VS_ADD_PTR_EQCMP_UNEQUALBB]] ], [ true, [[PTR_VS_ADD_PTR_EQCMP_EQUALBB]] ] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 967 | ; CHECK-NEXT: br label [[CLEANUP]] |
| 968 | ; CHECK: cleanup: |
| 969 | ; CHECK-NEXT: [[RES:%.*]] = phi i1 [ true, [[ENTRY:%.*]] ], [ [[RES_PH]], [[CLEANUP_LOOPEXIT]] ] |
| 970 | ; CHECK-NEXT: ret i1 [[RES]] |
| 971 | ; |
| 972 | entry: |
| 973 | %mul = shl i64 %count, 1 |
| 974 | %cmp14 = icmp eq i64 %mul, 0 |
| 975 | br i1 %cmp14, label %cleanup, label %for.body.preheader |
| 976 | |
| 977 | for.body.preheader: ; preds = %entry |
| 978 | %add.ptr = getelementptr inbounds i8, i8* %ptr, i64 %count |
| 979 | br label %for.body |
| 980 | |
| 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 |
| 989 | |
| 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 |
| 996 | |
| 997 | cleanup: ; preds = %for.body, %for.inc, %entry |
| 998 | %res = phi i1 [ true, %entry ], [ true, %for.inc ], [ false, %for.body ] |
| 999 | ret i1 %res |
| 1000 | } |
| 1001 | |
| 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: |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 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]] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 1015 | ; CHECK: cleanup.loopexit: |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 1016 | ; CHECK-NEXT: [[RES_PH:%.*]] = phi i1 [ false, [[PTR0_VS_PTR1_EQCMP_UNEQUALBB]] ], [ true, [[PTR0_VS_PTR1_EQCMP_EQUALBB]] ] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 1017 | ; CHECK-NEXT: br label [[CLEANUP]] |
| 1018 | ; CHECK: cleanup: |
| 1019 | ; CHECK-NEXT: [[RES:%.*]] = phi i1 [ true, [[ENTRY:%.*]] ], [ [[RES_PH]], [[CLEANUP_LOOPEXIT]] ] |
| 1020 | ; CHECK-NEXT: ret i1 [[RES]] |
| 1021 | ; |
| 1022 | entry: |
| 1023 | %cmp8 = icmp eq i64 %count, 0 |
| 1024 | br i1 %cmp8, label %cleanup, label %for.body |
| 1025 | |
| 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 |
| 1034 | |
| 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 |
| 1041 | |
| 1042 | cleanup: ; preds = %for.body, %for.inc, %entry |
| 1043 | %res = phi i1 [ true, %entry ], [ true, %for.inc ], [ false, %for.body ] |
| 1044 | ret i1 %res |
| 1045 | } |
| 1046 | |
| 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: |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 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]] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 1061 | ; CHECK: _ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit.loopexit: |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 1062 | ; CHECK-NEXT: [[RETVAL_0_I_I_PH:%.*]] = phi i1 [ true, [[PTR0_VS_PTR1_EQCMP_UNEQUALBB]] ], [ false, [[PTR0_VS_PTR1_EQCMP_EQUALBB]] ] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 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]] |
| 1067 | ; |
| 1068 | entry: |
| 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 |
| 1072 | |
| 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 |
| 1080 | |
| 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 |
| 1086 | |
| 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 |
| 1090 | } |
| 1091 | |
| 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 |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 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]] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 1113 | ; CHECK: _ZNSt3__15equalIPKiS2_EEbT_S3_T0_.exit.loopexit: |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 1114 | ; CHECK-NEXT: [[RETVAL_0_I_I_PH:%.*]] = phi i1 [ false, [[PTR0_VS_PTR1_EQCMP_UNEQUALBB]] ], [ true, [[PTR0_VS_PTR1_EQCMP_EQUALBB]] ] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 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]] |
| 1119 | ; |
| 1120 | entry: |
| 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 |
| 1124 | |
| 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 |
| 1132 | |
| 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 |
| 1138 | |
| 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 |
| 1142 | } |
| 1143 | |
| 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 |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 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]] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 1158 | ; CHECK: cleanup.loopexit: |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 1159 | ; CHECK-NEXT: [[T2_PH:%.*]] = phi i1 [ false, [[PTR0_VS_PTR1_EQCMP_UNEQUALBB]] ], [ true, [[PTR0_VS_PTR1_EQCMP_EQUALBB]] ] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 1160 | ; CHECK-NEXT: br label [[CLEANUP]] |
| 1161 | ; CHECK: cleanup: |
| 1162 | ; CHECK-NEXT: [[T2:%.*]] = phi i1 [ true, [[ENTRY:%.*]] ], [ [[T2_PH]], [[CLEANUP_LOOPEXIT]] ] |
| 1163 | ; CHECK-NEXT: ret i1 [[T2]] |
| 1164 | ; |
| 1165 | entry: |
| 1166 | %cmp8 = icmp sgt i32 %count, 0 |
| 1167 | br i1 %cmp8, label %for.body, label %cleanup |
| 1168 | |
| 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 |
| 1177 | |
| 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 |
| 1184 | |
| 1185 | cleanup: ; preds = %for.body, %for.inc, %entry |
| 1186 | %t2 = phi i1 [ true, %entry ], [ true, %for.inc ], [ false, %for.body ] |
| 1187 | ret i1 %t2 |
| 1188 | } |
| 1189 | |
| 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: |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 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]] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 1207 | ; CHECK: _ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit.loopexit: |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 1208 | ; CHECK-NEXT: [[RETVAL_0_I_I_PH:%.*]] = phi i1 [ false, [[PTR0_VS_PTR1_EQCMP_UNEQUALBB]] ], [ true, [[PTR0_VS_PTR1_EQCMP_EQUALBB]] ] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 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]] |
| 1213 | ; |
| 1214 | entry: |
| 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 |
| 1217 | |
| 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 |
| 1225 | |
| 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 |
| 1231 | |
| 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 |
| 1235 | } |
| 1236 | |
| 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: |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 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]] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 1251 | ; CHECK: _ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit.loopexit: |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 1252 | ; CHECK-NEXT: [[T2_PH:%.*]] = phi i32 [ [[ON_UNEQUAL:%.*]], [[PTR0_VS_PTR1_EQCMP_UNEQUALBB]] ], [ [[ON_EQUAL:%.*]], [[PTR0_VS_PTR1_EQCMP_EQUALBB]] ] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 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]] |
| 1257 | ; |
| 1258 | entry: |
| 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 |
| 1262 | |
| 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 |
| 1270 | |
| 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 |
| 1276 | |
| 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 ] |
| 1279 | ret i32 %t2 |
| 1280 | } |
| 1281 | |
| 1282 | define void @_Z20multiple_exit_blocksPKcS0_m(i8* %ptr0, i8* %ptr1, i64 %count) { |
| 1283 | ; CHECK-LABEL: @_Z20multiple_exit_blocksPKcS0_m( |
| 1284 | ; CHECK-NEXT: entry: |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 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:%.*]] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 1296 | ; CHECK: 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]] |
| 1301 | ; CHECK: if.end: |
| 1302 | ; CHECK-NEXT: tail call void @_Z17callee_on_successv() |
| 1303 | ; CHECK-NEXT: br label [[RETURN]] |
| 1304 | ; CHECK: return: |
| 1305 | ; CHECK-NEXT: ret void |
| 1306 | ; |
| 1307 | entry: |
| 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 |
| 1311 | |
| 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 |
| 1319 | |
| 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 |
| 1325 | |
| 1326 | if.then: ; preds = %for.body.i.i |
| 1327 | tail call void @_Z17callee_on_unequalv() |
| 1328 | br label %return |
| 1329 | |
| 1330 | if.end: ; preds = %for.inc.i.i, %entry |
| 1331 | tail call void @_Z17callee_on_successv() |
| 1332 | br label %return |
| 1333 | |
| 1334 | return: ; preds = %if.end, %if.then |
| 1335 | ret void |
| 1336 | } |
| 1337 | declare void @_Z17callee_on_unequalv() |
| 1338 | declare void @_Z17callee_on_successv() |
| 1339 | |
| 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: |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 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]] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 1354 | ; CHECK: _ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit.loopexit: |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 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]] ] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 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 |
| 1364 | ; |
| 1365 | entry: |
| 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 |
| 1369 | |
| 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 |
| 1377 | |
| 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 |
| 1383 | |
| 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 |
| 1389 | ret void |
| 1390 | } |
| 1391 | |
| 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 |
| 1403 | ; CHECK: for.body: |
| 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]] |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 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 |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 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]] |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 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]] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 1424 | ; CHECK: _ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit.loopexit: |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 1425 | ; CHECK-NEXT: [[RETVAL_0_I_I_PH:%.*]] = phi i1 [ false, [[T0_VS_T2_EQCMP_UNEQUALBB]] ], [ true, [[T0_VS_T2_EQCMP_EQUALBB]] ] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 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]] |
| 1433 | ; |
| 1434 | entry: |
| 1435 | %cmp11 = icmp eq i64 %outer_count, 0 |
| 1436 | br i1 %cmp11, label %for.cond.cleanup, label %for.body |
| 1437 | |
| 1438 | for.cond.cleanup: ; preds = %_ZNSt3__15equalIPKcS2_EEbT_S3_T0_.exit, %entry |
| 1439 | ret void |
| 1440 | |
| 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 |
| 1450 | |
| 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 |
| 1455 | |
| 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 |
| 1463 | |
| 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 |
| 1469 | |
| 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 |
| 1476 | } |
| 1477 | declare void @_Z4sinkb(i1) |
| 1478 | |
| 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:%.*]] |
| 1486 | ; CHECK: 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]] |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 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 |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 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]] |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 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]] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 1507 | ; CHECK: if.then: |
| 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]] |
| 1512 | ; CHECK: 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]] |
| 1519 | ; CHECK: cleanup: |
| 1520 | ; CHECK-NEXT: ret void |
| 1521 | ; |
| 1522 | entry: |
| 1523 | %cmp11 = icmp eq i64 %outer_count, 0 |
| 1524 | br i1 %cmp11, label %cleanup, label %for.body |
| 1525 | |
| 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 |
| 1535 | |
| 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 |
| 1540 | |
| 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 |
| 1548 | |
| 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 |
| 1554 | |
| 1555 | if.then: ; preds = %for.body.i.i |
| 1556 | tail call void @_Z17callee_on_unequalv() |
| 1557 | br label %cleanup |
| 1558 | |
| 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 |
| 1564 | |
| 1565 | cleanup: ; preds = %if.end, %entry, %if.then |
| 1566 | ret void |
| 1567 | } |
| 1568 | |
| 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]] |
| 1575 | ; CHECK: for.cond: |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 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]] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 1587 | ; CHECK: return: |
| 1588 | ; CHECK-NEXT: ret void |
| 1589 | ; |
| 1590 | entry: |
| 1591 | br label %for.cond |
| 1592 | |
| 1593 | for.cond: ; preds = %for.cond1, %entry |
| 1594 | br label %for.body |
| 1595 | |
| 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 |
| 1599 | |
| 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 |
| 1609 | |
| 1610 | return: ; preds = %for.body |
| 1611 | ret void |
| 1612 | } |
| 1613 | |
| 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 |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 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]] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 1629 | ; CHECK: cleanup3.loopexit: |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 1630 | ; CHECK-NEXT: [[RES_PH:%.*]] = phi i1 [ false, [[PTR0_VS_PTR1_EQCMP_UNEQUALBB]] ], [ true, [[PTR0_VS_PTR1_EQCMP_EQUALBB]] ] |
Roman Lebedev | 445c22b | 2019-04-25 08:33:47 +0000 | [diff] [blame] | 1631 | ; CHECK-NEXT: br label [[CLEANUP3]] |
| 1632 | ; CHECK: cleanup3: |
| 1633 | ; CHECK-NEXT: [[RES:%.*]] = phi i1 [ true, [[ENTRY:%.*]] ], [ [[RES_PH]], [[CLEANUP3_LOOPEXIT]] ] |
| 1634 | ; CHECK-NEXT: ret i1 [[RES]] |
| 1635 | ; |
| 1636 | entry: |
| 1637 | %cmp13 = icmp eq i64 %count, 0 |
| 1638 | br i1 %cmp13, label %cleanup3, label %for.body |
| 1639 | |
| 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 |
| 1650 | |
| 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 |
| 1657 | |
| 1658 | cleanup3: ; preds = %for.body, %for.inc, %entry |
| 1659 | %res = phi i1 [ true, %entry ], [ true, %for.inc ], [ false, %for.body ] |
| 1660 | ret i1 %res |
| 1661 | } |
| 1662 | |
| 1663 | ; FIXME |
| 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:%.*]] |
| 1671 | ; CHECK: 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:%.*]] |
| 1681 | ; CHECK: for.inc: |
| 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]] |
| 1690 | ; CHECK: cleanup4: |
| 1691 | ; CHECK-NEXT: [[RES:%.*]] = phi i1 [ true, [[ENTRY:%.*]] ], [ [[RES_PH]], [[CLEANUP4_LOOPEXIT]] ] |
| 1692 | ; CHECK-NEXT: ret i1 [[RES]] |
| 1693 | ; |
| 1694 | entry: |
| 1695 | %cmp14 = icmp eq i64 %count, 0 |
| 1696 | br i1 %cmp14, label %cleanup4, label %for.body |
| 1697 | |
| 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 |
| 1708 | |
| 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 |
| 1715 | |
| 1716 | cleanup4: ; preds = %for.body, %for.inc, %entry |
| 1717 | %res = phi i1 [ true, %entry ], [ true, %for.inc ], [ false, %for.body ] |
| 1718 | ret i1 %res |
| 1719 | } |
Roman Lebedev | c41e9f6 | 2019-10-12 15:35:09 +0000 | [diff] [blame] | 1720 | |
| 1721 | define i1 @exit_block_is_not_dedicated(i8* %ptr0, i8* %ptr1) { |
| 1722 | ; CHECK-LABEL: @exit_block_is_not_dedicated( |
| 1723 | ; CHECK-NEXT: entry: |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 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]] |
Roman Lebedev | c41e9f6 | 2019-10-12 15:35:09 +0000 | [diff] [blame] | 1733 | ; CHECK: cleanup.loopexit: |
Roman Lebedev | 76cdcf2 | 2019-10-12 15:35:32 +0000 | [diff] [blame] | 1734 | ; CHECK-NEXT: [[RES_PH:%.*]] = phi i1 [ true, [[PTR0_VS_PTR1_EQCMP_EQUALBB]] ], [ false, [[PTR0_VS_PTR1_EQCMP_UNEQUALBB]] ] |
Roman Lebedev | c41e9f6 | 2019-10-12 15:35:09 +0000 | [diff] [blame] | 1735 | ; CHECK-NEXT: br label [[CLEANUP]] |
| 1736 | ; CHECK: cleanup: |
| 1737 | ; CHECK-NEXT: [[RES:%.*]] = phi i1 [ false, [[ENTRY:%.*]] ], [ [[RES_PH]], [[CLEANUP_LOOPEXIT]] ] |
| 1738 | ; CHECK-NEXT: ret i1 [[RES]] |
| 1739 | ; |
| 1740 | entry: |
| 1741 | br i1 true, label %for.body, label %cleanup |
| 1742 | |
| 1743 | for.body: |
| 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 |
| 1752 | |
| 1753 | for.cond: |
| 1754 | %cmp = icmp ult i64 %inc, 8 |
| 1755 | br i1 %cmp, label %for.body, label %cleanup |
| 1756 | |
| 1757 | cleanup: |
| 1758 | %res = phi i1 [ false, %for.body ], [ true, %for.cond ], [ false, %entry ] |
| 1759 | ret i1 %res |
| 1760 | } |
Roman Lebedev | 76e02af | 2019-10-14 19:46:34 +0000 | [diff] [blame] | 1761 | |
| 1762 | ; With -m32: |
| 1763 | ; int index_wider_than_pointer(int* a, int* b, long long num) { |
| 1764 | ; for(long long i = 0; i < num; ++i) { |
| 1765 | ; if(a[i] != b[i]) |
| 1766 | ; return 1; |
| 1767 | ; } |
| 1768 | ; return 0; |
| 1769 | ; } |
| 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:%.*]] |
| 1777 | ; CHECK: for.cond: |
| 1778 | ; CHECK-NEXT: [[CMP:%.*]] = icmp slt i128 [[INC:%.*]], [[NUM]] |
| 1779 | ; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[CLEANUP_LOOPEXIT:%.*]] |
| 1780 | ; CHECK: for.body: |
| 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]] |
| 1793 | ; CHECK: cleanup: |
| 1794 | ; CHECK-NEXT: [[TMP2:%.*]] = phi i64 [ 0, [[ENTRY:%.*]] ], [ [[DOTPH]], [[CLEANUP_LOOPEXIT]] ] |
| 1795 | ; CHECK-NEXT: ret i64 [[TMP2]] |
| 1796 | ; |
| 1797 | entry: |
| 1798 | %cmp9 = icmp sgt i128 %num, 0 |
| 1799 | br i1 %cmp9, label %for.body, label %cleanup |
| 1800 | |
| 1801 | for.cond: ; preds = %for.body |
| 1802 | %cmp = icmp slt i128 %inc, %num |
| 1803 | br i1 %cmp, label %for.body, label %cleanup |
| 1804 | |
| 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 |
| 1815 | |
| 1816 | cleanup: ; preds = %for.body, %for.cond, %entry |
| 1817 | %2 = phi i64 [ 0, %entry ], [ 0, %for.cond ], [ 1, %for.body ] |
| 1818 | ret i64 %2 |
| 1819 | } |