1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=correlated-propagation -S | FileCheck %s
4 define i32 @test(i32 %a) {
7 ; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 [[A:%.*]], 128
8 ; CHECK-NEXT: br i1 [[CMP]], label [[CONTINUE:%.*]], label [[EXIT:%.*]]
10 ; CHECK-NEXT: ret i32 [[A]]
12 ; CHECK-NEXT: ret i32 -1
15 %cmp = icmp ult i32 %a, 128
16 br i1 %cmp, label %continue, label %exit
18 %and = and i32 %a, 255
24 define i32 @test2(i32 %a) {
25 ; CHECK-LABEL: @test2(
27 ; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 [[A:%.*]], 256
28 ; CHECK-NEXT: br i1 [[CMP]], label [[CONTINUE:%.*]], label [[EXIT:%.*]]
30 ; CHECK-NEXT: ret i32 [[A]]
32 ; CHECK-NEXT: ret i32 -1
35 %cmp = icmp ult i32 %a, 256
36 br i1 %cmp, label %continue, label %exit
38 %and = and i32 %a, 255
44 define i32 @test3(i32 %a) {
45 ; CHECK-LABEL: @test3(
47 ; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 [[A:%.*]], 256
48 ; CHECK-NEXT: br i1 [[CMP]], label [[CONTINUE:%.*]], label [[EXIT:%.*]]
50 ; CHECK-NEXT: ret i32 [[A]]
52 ; CHECK-NEXT: ret i32 -1
55 %cmp = icmp ult i32 %a, 256
56 br i1 %cmp, label %continue, label %exit
58 %and = and i32 %a, 1023
65 define i32 @neg1(i32 %a) {
68 ; CHECK-NEXT: [[CMP:%.*]] = icmp ule i32 [[A:%.*]], 256
69 ; CHECK-NEXT: br i1 [[CMP]], label [[CONTINUE:%.*]], label [[EXIT:%.*]]
71 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[A]], 255
72 ; CHECK-NEXT: ret i32 [[AND]]
74 ; CHECK-NEXT: ret i32 -1
77 %cmp = icmp ule i32 %a, 256
78 br i1 %cmp, label %continue, label %exit
80 %and = and i32 %a, 255
86 define i32 @neg2(i32 %a) {
89 ; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 [[A:%.*]], 513
90 ; CHECK-NEXT: br i1 [[CMP]], label [[CONTINUE:%.*]], label [[EXIT:%.*]]
92 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[A]], 255
93 ; CHECK-NEXT: ret i32 [[AND]]
95 ; CHECK-NEXT: ret i32 -1
98 %cmp = icmp ult i32 %a, 513
99 br i1 %cmp, label %continue, label %exit
101 %and = and i32 %a, 255
107 define i32 @neg3(i32 %a) {
108 ; CHECK-LABEL: @neg3(
110 ; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 [[A:%.*]], 256
111 ; CHECK-NEXT: br i1 [[CMP]], label [[CONTINUE:%.*]], label [[EXIT:%.*]]
113 ; CHECK-NEXT: [[AND:%.*]] = and i32 [[A]], 254
114 ; CHECK-NEXT: ret i32 [[AND]]
116 ; CHECK-NEXT: ret i32 -1
119 %cmp = icmp ult i32 %a, 256
120 br i1 %cmp, label %continue, label %exit
122 %and = and i32 %a, 254