| ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py |
| ; RUN: opt < %s -newgvn -S | FileCheck %s |
| |
| define void @sort(i64 %.16) { |
| ; CHECK-LABEL: @sort( |
| ; CHECK-NEXT: Entry: |
| ; CHECK-NEXT: [[TMP0:%.*]] = extractvalue { i64, i1 } undef, 0 |
| ; CHECK-NEXT: [[TMP1:%.*]] = lshr i64 [[TMP0]], 2 |
| ; CHECK-NEXT: br i1 undef, label [[DIVZEROFAIL2_I:%.*]], label [[WHILEBODY_LR_PH:%.*]] |
| ; CHECK: DivZeroFail2.i: |
| ; CHECK-NEXT: unreachable |
| ; CHECK: WhileBody.lr.ph: |
| ; CHECK-NEXT: [[TMP2:%.*]] = udiv i64 [[DOT16:%.*]], [[TMP1]] |
| ; CHECK-NEXT: br label [[WHILEBODY:%.*]] |
| ; CHECK: WhileBody: |
| ; CHECK-NEXT: [[ITERATOR:%.*]] = phi i64 [ 0, [[WHILEBODY_LR_PH]] ], [ [[TMP6:%.*]], [[BOUNDSCHECKOK276:%.*]] ] |
| ; CHECK-NEXT: [[TMP3:%.*]] = tail call { i64, i1 } @llvm.uadd.with.overflow.i64(i64 [[ITERATOR]], i64 [[TMP2]]) |
| ; CHECK-NEXT: [[TMP4:%.*]] = extractvalue { i64, i1 } [[TMP3]], 0 |
| ; CHECK-NEXT: [[TMP5:%.*]] = tail call { i64, i1 } @llvm.uadd.with.overflow.i64(i64 [[TMP4]], i64 1) |
| ; CHECK-NEXT: [[TMP6]] = extractvalue { i64, i1 } [[TMP5]], 0 |
| ; CHECK-NEXT: br i1 false, label [[BOUNDSCHECKFAIL275:%.*]], label [[BOUNDSCHECKOK276]] |
| ; CHECK: WhileEnd: |
| ; CHECK-NEXT: ret void |
| ; CHECK: BoundsCheckFail275: |
| ; CHECK-NEXT: unreachable |
| ; CHECK: BoundsCheckOk276: |
| ; CHECK-NEXT: [[TMP7:%.*]] = icmp ult i64 [[TMP6]], [[DOT16]] |
| ; CHECK-NEXT: br i1 [[TMP7]], label [[WHILEBODY]], label [[WHILEEND:%.*]] |
| ; |
| Entry: |
| %0 = extractvalue { i64, i1 } undef, 0 |
| %1 = lshr i64 %0, 2 |
| br i1 undef, label %DivZeroFail2.i, label %WhileBody.lr.ph |
| |
| DivZeroFail2.i: ; preds = %Entry |
| unreachable |
| |
| WhileBody.lr.ph: ; preds = %Entry |
| %2 = udiv i64 %.16, %1 |
| br label %WhileBody |
| |
| WhileBody: ; preds = %BoundsCheckOk276, %WhileBody.lr.ph |
| %iterator = phi i64 [ 0, %WhileBody.lr.ph ], [ %6, %BoundsCheckOk276 ] |
| %3 = tail call { i64, i1 } @llvm.uadd.with.overflow.i64(i64 %iterator, i64 %2) |
| %4 = extractvalue { i64, i1 } %3, 0 |
| %5 = tail call { i64, i1 } @llvm.uadd.with.overflow.i64(i64 %4, i64 1) |
| %6 = extractvalue { i64, i1 } %5, 0 |
| %7 = icmp ugt i64 %iterator, %.16 |
| br i1 %7, label %BoundsCheckFail275, label %BoundsCheckOk276 |
| |
| WhileEnd: ; preds = %BoundsCheckOk276 |
| ret void |
| |
| BoundsCheckFail275: ; preds = %WhileBody |
| unreachable |
| |
| BoundsCheckOk276: ; preds = %WhileBody |
| %8 = icmp ult i64 %6, %.16 |
| br i1 %8, label %WhileBody, label %WhileEnd |
| } |
| |
| declare { i64, i1 } @llvm.uadd.with.overflow.i64(i64, i64) |