1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -correlated-propagation -cvp-dont-add-nowrap-flags=false -S | FileCheck %s
4 define i8 @test0(i8 %a) {
7 ; CHECK-NEXT: [[CMP:%.*]] = icmp ult i8 [[A:%.*]], 3
8 ; CHECK-NEXT: br i1 [[CMP]], label [[BB:%.*]], label [[EXIT:%.*]]
10 ; CHECK-NEXT: [[MUL:%.*]] = mul nuw nsw i8 [[A]], 50
11 ; CHECK-NEXT: ret i8 [[MUL]]
13 ; CHECK-NEXT: ret i8 0
16 %cmp = icmp ult i8 %a, 3
17 br i1 %cmp, label %bb, label %exit
27 define i8 @test1(i8 %a) {
28 ; CHECK-LABEL: @test1(
30 ; CHECK-NEXT: [[CMP:%.*]] = icmp ult i8 [[A:%.*]], 4
31 ; CHECK-NEXT: br i1 [[CMP]], label [[BB:%.*]], label [[EXIT:%.*]]
33 ; CHECK-NEXT: [[MUL:%.*]] = mul nuw i8 [[A]], 50
34 ; CHECK-NEXT: ret i8 [[MUL]]
36 ; CHECK-NEXT: ret i8 0
39 %cmp = icmp ult i8 %a, 4
40 br i1 %cmp, label %bb, label %exit
50 define i8 @test2(i8 %a) {
51 ; CHECK-LABEL: @test2(
53 ; CHECK-NEXT: [[CMP:%.*]] = icmp ult i8 [[A:%.*]], 6
54 ; CHECK-NEXT: br i1 [[CMP]], label [[BB:%.*]], label [[EXIT:%.*]]
56 ; CHECK-NEXT: [[MUL:%.*]] = mul nuw i8 [[A]], 50
57 ; CHECK-NEXT: ret i8 [[MUL]]
59 ; CHECK-NEXT: ret i8 0
62 %cmp = icmp ult i8 %a, 6
63 br i1 %cmp, label %bb, label %exit
73 define i8 @test3(i8 %a) {
74 ; CHECK-LABEL: @test3(
76 ; CHECK-NEXT: [[CMP:%.*]] = icmp ult i8 [[A:%.*]], 7
77 ; CHECK-NEXT: br i1 [[CMP]], label [[BB:%.*]], label [[EXIT:%.*]]
79 ; CHECK-NEXT: [[MUL:%.*]] = mul i8 [[A]], 50
80 ; CHECK-NEXT: ret i8 [[MUL]]
82 ; CHECK-NEXT: ret i8 0
85 %cmp = icmp ult i8 %a, 7
86 br i1 %cmp, label %bb, label %exit
96 define i8 @test4(i8 %a) {
97 ; CHECK-LABEL: @test4(
99 ; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i8 [[A:%.*]], 3
100 ; CHECK-NEXT: [[CMP2:%.*]] = icmp sgt i8 [[A]], -3
101 ; CHECK-NEXT: [[COND:%.*]] = and i1 [[CMP1]], [[CMP2]]
102 ; CHECK-NEXT: br i1 [[COND]], label [[BB:%.*]], label [[EXIT:%.*]]
104 ; CHECK-NEXT: [[MUL:%.*]] = mul nsw i8 [[A]], 50
105 ; CHECK-NEXT: ret i8 [[MUL]]
107 ; CHECK-NEXT: ret i8 0
110 %cmp1 = icmp slt i8 %a, 3
111 %cmp2 = icmp sgt i8 %a, -3
112 %cond = and i1 %cmp1, %cmp2
113 br i1 %cond, label %bb, label %exit
123 define i8 @test5(i8 %a) {
124 ; CHECK-LABEL: @test5(
126 ; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i8 [[A:%.*]], 3
127 ; CHECK-NEXT: [[CMP2:%.*]] = icmp sgt i8 [[A]], -4
128 ; CHECK-NEXT: [[COND:%.*]] = and i1 [[CMP1]], [[CMP2]]
129 ; CHECK-NEXT: br i1 [[COND]], label [[BB:%.*]], label [[EXIT:%.*]]
131 ; CHECK-NEXT: [[MUL:%.*]] = mul i8 [[A]], 50
132 ; CHECK-NEXT: ret i8 [[MUL]]
134 ; CHECK-NEXT: ret i8 0
137 %cmp1 = icmp slt i8 %a, 3
138 %cmp2 = icmp sgt i8 %a, -4
139 %cond = and i1 %cmp1, %cmp2
140 br i1 %cond, label %bb, label %exit
150 define i8 @test6(i8 %a) {
151 ; CHECK-LABEL: @test6(
153 ; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i8 [[A:%.*]], 4
154 ; CHECK-NEXT: [[CMP2:%.*]] = icmp sgt i8 [[A]], -3
155 ; CHECK-NEXT: [[COND:%.*]] = and i1 [[CMP1]], [[CMP2]]
156 ; CHECK-NEXT: br i1 [[COND]], label [[BB:%.*]], label [[EXIT:%.*]]
158 ; CHECK-NEXT: [[MUL:%.*]] = mul i8 [[A]], 50
159 ; CHECK-NEXT: ret i8 [[MUL]]
161 ; CHECK-NEXT: ret i8 0
164 %cmp1 = icmp slt i8 %a, 4
165 %cmp2 = icmp sgt i8 %a, -3
166 %cond = and i1 %cmp1, %cmp2
167 br i1 %cond, label %bb, label %exit