1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
2 ; RUN: opt -passes=constraint-elimination -S %s | FileCheck %s
4 define i32 @f(i64 %a3, i64 %numElements) {
5 ; CHECK-LABEL: define i32 @f(
6 ; CHECK-SAME: i64 [[A3:%.*]], i64 [[NUMELEMENTS:%.*]]) {
8 ; CHECK-NEXT: [[COND:%.*]] = icmp ule i64 [[NUMELEMENTS]], 1152921504606846975
9 ; CHECK-NEXT: call void @llvm.assume(i1 [[COND]])
10 ; CHECK-NEXT: [[A1:%.*]] = shl nuw i64 [[NUMELEMENTS]], 4
11 ; CHECK-NEXT: br label [[IF_END:%.*]]
13 ; CHECK-NEXT: [[CMP:%.*]] = icmp ugt i64 [[A1]], [[A3]]
14 ; CHECK-NEXT: br i1 [[CMP]], label [[IF_END_I:%.*]], label [[ABORT:%.*]]
16 ; CHECK-NEXT: [[CMP2_NOT_I:%.*]] = icmp ult i64 [[A1]], [[A3]]
17 ; CHECK-NEXT: br i1 [[CMP2_NOT_I]], label [[ABORT]], label [[EXIT:%.*]]
19 ; CHECK-NEXT: ret i32 -1
21 ; CHECK-NEXT: ret i32 0
24 %cond = icmp ule i64 %numElements, 1152921504606846975
25 call void @llvm.assume(i1 %cond)
26 %a1 = shl nuw i64 %numElements, 4
29 %cmp = icmp ugt i64 %a1, %a3
30 br i1 %cmp, label %if.end.i, label %abort
32 %cmp2.not.i = icmp ult i64 %a1, %a3
33 br i1 %cmp2.not.i, label %abort, label %exit
40 declare void @llvm.assume(i1)