• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -correlated-propagation -S | FileCheck %s
3
4define i32 @test(i32 %a) {
5; CHECK-LABEL: @test(
6; CHECK-NEXT:  entry:
7; CHECK-NEXT:    [[CMP:%.*]] = icmp ult i32 [[A:%.*]], 128
8; CHECK-NEXT:    br i1 [[CMP]], label [[CONTINUE:%.*]], label [[EXIT:%.*]]
9; CHECK:       continue:
10; CHECK-NEXT:    ret i32 [[A]]
11; CHECK:       exit:
12; CHECK-NEXT:    ret i32 -1
13;
14entry:
15  %cmp = icmp ult i32 %a, 128
16  br i1 %cmp, label %continue, label %exit
17continue:
18  %and = and i32 %a, 255
19  ret i32 %and
20exit:
21  ret i32 -1
22}
23
24define i32 @test2(i32 %a) {
25; CHECK-LABEL: @test2(
26; CHECK-NEXT:  entry:
27; CHECK-NEXT:    [[CMP:%.*]] = icmp ult i32 [[A:%.*]], 256
28; CHECK-NEXT:    br i1 [[CMP]], label [[CONTINUE:%.*]], label [[EXIT:%.*]]
29; CHECK:       continue:
30; CHECK-NEXT:    ret i32 [[A]]
31; CHECK:       exit:
32; CHECK-NEXT:    ret i32 -1
33;
34entry:
35  %cmp = icmp ult i32 %a, 256
36  br i1 %cmp, label %continue, label %exit
37continue:
38  %and = and i32 %a, 255
39  ret i32 %and
40exit:
41  ret i32 -1
42}
43
44define i32 @test3(i32 %a) {
45; CHECK-LABEL: @test3(
46; CHECK-NEXT:  entry:
47; CHECK-NEXT:    [[CMP:%.*]] = icmp ult i32 [[A:%.*]], 256
48; CHECK-NEXT:    br i1 [[CMP]], label [[CONTINUE:%.*]], label [[EXIT:%.*]]
49; CHECK:       continue:
50; CHECK-NEXT:    ret i32 [[A]]
51; CHECK:       exit:
52; CHECK-NEXT:    ret i32 -1
53;
54entry:
55  %cmp = icmp ult i32 %a, 256
56  br i1 %cmp, label %continue, label %exit
57continue:
58  %and = and i32 %a, 1023
59  ret i32 %and
60exit:
61  ret i32 -1
62}
63
64
65define i32 @neg1(i32 %a) {
66; CHECK-LABEL: @neg1(
67; CHECK-NEXT:  entry:
68; CHECK-NEXT:    [[CMP:%.*]] = icmp ule i32 [[A:%.*]], 256
69; CHECK-NEXT:    br i1 [[CMP]], label [[CONTINUE:%.*]], label [[EXIT:%.*]]
70; CHECK:       continue:
71; CHECK-NEXT:    [[AND:%.*]] = and i32 [[A]], 255
72; CHECK-NEXT:    ret i32 [[AND]]
73; CHECK:       exit:
74; CHECK-NEXT:    ret i32 -1
75;
76entry:
77  %cmp = icmp ule i32 %a, 256
78  br i1 %cmp, label %continue, label %exit
79continue:
80  %and = and i32 %a, 255
81  ret i32 %and
82exit:
83  ret i32 -1
84}
85
86define i32 @neg2(i32 %a) {
87; CHECK-LABEL: @neg2(
88; CHECK-NEXT:  entry:
89; CHECK-NEXT:    [[CMP:%.*]] = icmp ult i32 [[A:%.*]], 513
90; CHECK-NEXT:    br i1 [[CMP]], label [[CONTINUE:%.*]], label [[EXIT:%.*]]
91; CHECK:       continue:
92; CHECK-NEXT:    [[AND:%.*]] = and i32 [[A]], 255
93; CHECK-NEXT:    ret i32 [[AND]]
94; CHECK:       exit:
95; CHECK-NEXT:    ret i32 -1
96;
97entry:
98  %cmp = icmp ult i32 %a, 513
99  br i1 %cmp, label %continue, label %exit
100continue:
101  %and = and i32 %a, 255
102  ret i32 %and
103exit:
104  ret i32 -1
105}
106
107define i32 @neg3(i32 %a) {
108; CHECK-LABEL: @neg3(
109; CHECK-NEXT:  entry:
110; CHECK-NEXT:    [[CMP:%.*]] = icmp ult i32 [[A:%.*]], 256
111; CHECK-NEXT:    br i1 [[CMP]], label [[CONTINUE:%.*]], label [[EXIT:%.*]]
112; CHECK:       continue:
113; CHECK-NEXT:    [[AND:%.*]] = and i32 [[A]], 254
114; CHECK-NEXT:    ret i32 [[AND]]
115; CHECK:       exit:
116; CHECK-NEXT:    ret i32 -1
117;
118entry:
119  %cmp = icmp ult i32 %a, 256
120  br i1 %cmp, label %continue, label %exit
121continue:
122  %and = and i32 %a, 254
123  ret i32 %and
124exit:
125  ret i32 -1
126}
127
128