1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -constraint-elimination -S %s | FileCheck %s
4 define i1 @wrapping_add_unknown_1(i8 %a) {
5 ; CHECK-LABEL: @wrapping_add_unknown_1(
7 ; CHECK-NEXT: [[SUB:%.*]] = add i8 [[A:%.*]], -1
8 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i8 [[SUB]], 0
9 ; CHECK-NEXT: ret i1 [[CMP]]
13 %cmp = icmp eq i8 %sub, 0
17 define i1 @wrapping_add_known_1(i8 %a) {
18 ; CHECK-LABEL: @wrapping_add_known_1(
20 ; CHECK-NEXT: [[PRE:%.*]] = icmp eq i8 [[A:%.*]], 1
21 ; CHECK-NEXT: br i1 [[PRE]], label [[THEN:%.*]], label [[ELSE:%.*]]
23 ; CHECK-NEXT: [[SUB_1:%.*]] = add i8 [[A]], -1
24 ; CHECK-NEXT: [[C_1:%.*]] = icmp eq i8 [[SUB_1]], 0
25 ; CHECK-NEXT: ret i1 [[C_1]]
27 ; CHECK-NEXT: [[SUB_2:%.*]] = add i8 [[A]], -1
28 ; CHECK-NEXT: [[C_2:%.*]] = icmp eq i8 [[SUB_2]], 0
29 ; CHECK-NEXT: ret i1 [[C_2]]
32 %pre = icmp eq i8 %a, 1
33 br i1 %pre, label %then, label %else
36 %sub.1 = add i8 %a, -1
37 %c.1 = icmp eq i8 %sub.1, 0
41 %sub.2 = add i8 %a, -1
42 %c.2 = icmp eq i8 %sub.2, 0
46 define i1 @wrapping_add_unknown_2(i8 %a) {
47 ; CHECK-LABEL: @wrapping_add_unknown_2(
49 ; CHECK-NEXT: [[PRE:%.*]] = icmp eq i8 [[A:%.*]], 0
50 ; CHECK-NEXT: br i1 [[PRE]], label [[THEN:%.*]], label [[ELSE:%.*]]
52 ; CHECK-NEXT: [[SUB_1:%.*]] = add i8 [[A]], -1
53 ; CHECK-NEXT: [[C_1:%.*]] = icmp eq i8 [[SUB_1]], 0
54 ; CHECK-NEXT: ret i1 [[C_1]]
56 ; CHECK-NEXT: [[SUB_2:%.*]] = add i8 [[A]], -1
57 ; CHECK-NEXT: [[C_2:%.*]] = icmp eq i8 [[SUB_2]], 0
58 ; CHECK-NEXT: ret i1 [[C_2]]
61 %pre = icmp eq i8 %a, 0
62 br i1 %pre, label %then, label %else
65 %sub.1 = add i8 %a, -1
66 %c.1 = icmp eq i8 %sub.1, 0
70 %sub.2 = add i8 %a, -1
71 %c.2 = icmp eq i8 %sub.2, 0