Sanjay Patel | bcaf6f3 | 2016-08-04 17:48:04 +0000 | [diff] [blame^] | 1 | ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py |
Duncan Sands | 8fb2c38 | 2011-01-20 13:21:55 +0000 | [diff] [blame] | 2 | ; RUN: opt < %s -instsimplify -S | FileCheck %s |
| 3 | target datalayout = "p:32:32" |
| 4 | |
| 5 | define i1 @ptrtoint() { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 6 | ; CHECK-LABEL: @ptrtoint( |
Duncan Sands | 8fb2c38 | 2011-01-20 13:21:55 +0000 | [diff] [blame] | 7 | %a = alloca i8 |
| 8 | %tmp = ptrtoint i8* %a to i32 |
| 9 | %r = icmp eq i32 %tmp, 0 |
| 10 | ret i1 %r |
| 11 | ; CHECK: ret i1 false |
| 12 | } |
| 13 | |
Benjamin Kramer | ea51f62 | 2012-02-16 13:49:39 +0000 | [diff] [blame] | 14 | define i1 @bitcast() { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 15 | ; CHECK-LABEL: @bitcast( |
Benjamin Kramer | ea51f62 | 2012-02-16 13:49:39 +0000 | [diff] [blame] | 16 | %a = alloca i32 |
| 17 | %b = alloca i64 |
| 18 | %x = bitcast i32* %a to i8* |
| 19 | %y = bitcast i64* %b to i8* |
| 20 | %cmp = icmp eq i8* %x, %y |
| 21 | ret i1 %cmp |
| 22 | ; CHECK-NEXT: ret i1 false |
| 23 | } |
| 24 | |
| 25 | define i1 @gep() { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 26 | ; CHECK-LABEL: @gep( |
Benjamin Kramer | ea51f62 | 2012-02-16 13:49:39 +0000 | [diff] [blame] | 27 | %a = alloca [3 x i8], align 8 |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 28 | %x = getelementptr inbounds [3 x i8], [3 x i8]* %a, i32 0, i32 0 |
Benjamin Kramer | ea51f62 | 2012-02-16 13:49:39 +0000 | [diff] [blame] | 29 | %cmp = icmp eq i8* %x, null |
| 30 | ret i1 %cmp |
| 31 | ; CHECK-NEXT: ret i1 false |
| 32 | } |
| 33 | |
Eli Friedman | 952d1f9 | 2012-02-18 03:29:25 +0000 | [diff] [blame] | 34 | define i1 @gep2() { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 35 | ; CHECK-LABEL: @gep2( |
Eli Friedman | 952d1f9 | 2012-02-18 03:29:25 +0000 | [diff] [blame] | 36 | %a = alloca [3 x i8], align 8 |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 37 | %x = getelementptr inbounds [3 x i8], [3 x i8]* %a, i32 0, i32 0 |
| 38 | %y = getelementptr inbounds [3 x i8], [3 x i8]* %a, i32 0, i32 0 |
Eli Friedman | 952d1f9 | 2012-02-18 03:29:25 +0000 | [diff] [blame] | 39 | %cmp = icmp eq i8* %x, %y |
| 40 | ret i1 %cmp |
| 41 | ; CHECK-NEXT: ret i1 true |
| 42 | } |
| 43 | |
Nick Lewycky | 3db143e | 2012-02-26 02:09:49 +0000 | [diff] [blame] | 44 | ; PR11238 |
| 45 | %gept = type { i32, i32 } |
| 46 | @gepy = global %gept zeroinitializer, align 8 |
| 47 | @gepz = extern_weak global %gept |
| 48 | |
| 49 | define i1 @gep3() { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 50 | ; CHECK-LABEL: @gep3( |
Nick Lewycky | 3db143e | 2012-02-26 02:09:49 +0000 | [diff] [blame] | 51 | %x = alloca %gept, align 8 |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 52 | %a = getelementptr %gept, %gept* %x, i64 0, i32 0 |
| 53 | %b = getelementptr %gept, %gept* %x, i64 0, i32 1 |
Nick Lewycky | 3db143e | 2012-02-26 02:09:49 +0000 | [diff] [blame] | 54 | %equal = icmp eq i32* %a, %b |
| 55 | ret i1 %equal |
| 56 | ; CHECK-NEXT: ret i1 false |
| 57 | } |
| 58 | |
| 59 | define i1 @gep4() { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 60 | ; CHECK-LABEL: @gep4( |
Nick Lewycky | 3db143e | 2012-02-26 02:09:49 +0000 | [diff] [blame] | 61 | %x = alloca %gept, align 8 |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 62 | %a = getelementptr %gept, %gept* @gepy, i64 0, i32 0 |
| 63 | %b = getelementptr %gept, %gept* @gepy, i64 0, i32 1 |
Nick Lewycky | 3db143e | 2012-02-26 02:09:49 +0000 | [diff] [blame] | 64 | %equal = icmp eq i32* %a, %b |
| 65 | ret i1 %equal |
| 66 | ; CHECK-NEXT: ret i1 false |
| 67 | } |
| 68 | |
| 69 | define i1 @gep5() { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 70 | ; CHECK-LABEL: @gep5( |
Nick Lewycky | 3db143e | 2012-02-26 02:09:49 +0000 | [diff] [blame] | 71 | %x = alloca %gept, align 8 |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 72 | %a = getelementptr inbounds %gept, %gept* %x, i64 0, i32 1 |
| 73 | %b = getelementptr %gept, %gept* @gepy, i64 0, i32 0 |
Nick Lewycky | 3db143e | 2012-02-26 02:09:49 +0000 | [diff] [blame] | 74 | %equal = icmp eq i32* %a, %b |
| 75 | ret i1 %equal |
| 76 | ; CHECK-NEXT: ret i1 false |
| 77 | } |
| 78 | |
| 79 | define i1 @gep6(%gept* %x) { |
| 80 | ; Same as @gep3 but potentially null. |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 81 | ; CHECK-LABEL: @gep6( |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 82 | %a = getelementptr %gept, %gept* %x, i64 0, i32 0 |
| 83 | %b = getelementptr %gept, %gept* %x, i64 0, i32 1 |
Nick Lewycky | 3db143e | 2012-02-26 02:09:49 +0000 | [diff] [blame] | 84 | %equal = icmp eq i32* %a, %b |
| 85 | ret i1 %equal |
| 86 | ; CHECK-NEXT: ret i1 false |
| 87 | } |
| 88 | |
| 89 | define i1 @gep7(%gept* %x) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 90 | ; CHECK-LABEL: @gep7( |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 91 | %a = getelementptr %gept, %gept* %x, i64 0, i32 0 |
| 92 | %b = getelementptr %gept, %gept* @gepz, i64 0, i32 0 |
Nick Lewycky | 3db143e | 2012-02-26 02:09:49 +0000 | [diff] [blame] | 93 | %equal = icmp eq i32* %a, %b |
| 94 | ret i1 %equal |
| 95 | ; CHECK: ret i1 %equal |
| 96 | } |
| 97 | |
| 98 | define i1 @gep8(%gept* %x) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 99 | ; CHECK-LABEL: @gep8( |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 100 | %a = getelementptr %gept, %gept* %x, i32 1 |
| 101 | %b = getelementptr %gept, %gept* %x, i32 -1 |
Nick Lewycky | 3db143e | 2012-02-26 02:09:49 +0000 | [diff] [blame] | 102 | %equal = icmp ugt %gept* %a, %b |
| 103 | ret i1 %equal |
| 104 | ; CHECK: ret i1 %equal |
| 105 | } |
| 106 | |
Chandler Carruth | 8059c84 | 2012-03-25 21:28:14 +0000 | [diff] [blame] | 107 | define i1 @gep9(i8* %ptr) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 108 | ; CHECK-LABEL: @gep9( |
Chandler Carruth | 8059c84 | 2012-03-25 21:28:14 +0000 | [diff] [blame] | 109 | ; CHECK-NOT: ret |
| 110 | ; CHECK: ret i1 true |
| 111 | |
| 112 | entry: |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 113 | %first1 = getelementptr inbounds i8, i8* %ptr, i32 0 |
| 114 | %first2 = getelementptr inbounds i8, i8* %first1, i32 1 |
| 115 | %first3 = getelementptr inbounds i8, i8* %first2, i32 2 |
| 116 | %first4 = getelementptr inbounds i8, i8* %first3, i32 4 |
| 117 | %last1 = getelementptr inbounds i8, i8* %first2, i32 48 |
| 118 | %last2 = getelementptr inbounds i8, i8* %last1, i32 8 |
| 119 | %last3 = getelementptr inbounds i8, i8* %last2, i32 -4 |
| 120 | %last4 = getelementptr inbounds i8, i8* %last3, i32 -4 |
Chandler Carruth | 8059c84 | 2012-03-25 21:28:14 +0000 | [diff] [blame] | 121 | %first.int = ptrtoint i8* %first4 to i32 |
| 122 | %last.int = ptrtoint i8* %last4 to i32 |
| 123 | %cmp = icmp ne i32 %last.int, %first.int |
| 124 | ret i1 %cmp |
| 125 | } |
| 126 | |
| 127 | define i1 @gep10(i8* %ptr) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 128 | ; CHECK-LABEL: @gep10( |
Chandler Carruth | 8059c84 | 2012-03-25 21:28:14 +0000 | [diff] [blame] | 129 | ; CHECK-NOT: ret |
| 130 | ; CHECK: ret i1 true |
| 131 | |
| 132 | entry: |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 133 | %first1 = getelementptr inbounds i8, i8* %ptr, i32 -2 |
| 134 | %first2 = getelementptr inbounds i8, i8* %first1, i32 44 |
| 135 | %last1 = getelementptr inbounds i8, i8* %ptr, i32 48 |
| 136 | %last2 = getelementptr inbounds i8, i8* %last1, i32 -6 |
Chandler Carruth | 8059c84 | 2012-03-25 21:28:14 +0000 | [diff] [blame] | 137 | %first.int = ptrtoint i8* %first2 to i32 |
| 138 | %last.int = ptrtoint i8* %last2 to i32 |
| 139 | %cmp = icmp eq i32 %last.int, %first.int |
| 140 | ret i1 %cmp |
| 141 | } |
| 142 | |
| 143 | define i1 @gep11(i8* %ptr) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 144 | ; CHECK-LABEL: @gep11( |
Chandler Carruth | 8059c84 | 2012-03-25 21:28:14 +0000 | [diff] [blame] | 145 | ; CHECK-NOT: ret |
| 146 | ; CHECK: ret i1 true |
| 147 | |
| 148 | entry: |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 149 | %first1 = getelementptr inbounds i8, i8* %ptr, i32 -2 |
| 150 | %last1 = getelementptr inbounds i8, i8* %ptr, i32 48 |
| 151 | %last2 = getelementptr inbounds i8, i8* %last1, i32 -6 |
Chandler Carruth | 8059c84 | 2012-03-25 21:28:14 +0000 | [diff] [blame] | 152 | %cmp = icmp ult i8* %first1, %last2 |
| 153 | ret i1 %cmp |
| 154 | } |
| 155 | |
| 156 | define i1 @gep12(i8* %ptr) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 157 | ; CHECK-LABEL: @gep12( |
Chandler Carruth | 8059c84 | 2012-03-25 21:28:14 +0000 | [diff] [blame] | 158 | ; CHECK-NOT: ret |
| 159 | ; CHECK: ret i1 %cmp |
| 160 | |
| 161 | entry: |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 162 | %first1 = getelementptr inbounds i8, i8* %ptr, i32 -2 |
| 163 | %last1 = getelementptr inbounds i8, i8* %ptr, i32 48 |
| 164 | %last2 = getelementptr inbounds i8, i8* %last1, i32 -6 |
Chandler Carruth | 8059c84 | 2012-03-25 21:28:14 +0000 | [diff] [blame] | 165 | %cmp = icmp slt i8* %first1, %last2 |
| 166 | ret i1 %cmp |
| 167 | } |
| 168 | |
Chandler Carruth | 80d3e56 | 2012-12-07 02:08:58 +0000 | [diff] [blame] | 169 | define i1 @gep13(i8* %ptr) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 170 | ; CHECK-LABEL: @gep13( |
Chandler Carruth | 80d3e56 | 2012-12-07 02:08:58 +0000 | [diff] [blame] | 171 | ; We can prove this GEP is non-null because it is inbounds. |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 172 | %x = getelementptr inbounds i8, i8* %ptr, i32 1 |
Chandler Carruth | 80d3e56 | 2012-12-07 02:08:58 +0000 | [diff] [blame] | 173 | %cmp = icmp eq i8* %x, null |
| 174 | ret i1 %cmp |
| 175 | ; CHECK-NEXT: ret i1 false |
| 176 | } |
| 177 | |
| 178 | define i1 @gep14({ {}, i8 }* %ptr) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 179 | ; CHECK-LABEL: @gep14( |
Chandler Carruth | 80d3e56 | 2012-12-07 02:08:58 +0000 | [diff] [blame] | 180 | ; We can't simplify this because the offset of one in the GEP actually doesn't |
| 181 | ; move the pointer. |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 182 | %x = getelementptr inbounds { {}, i8 }, { {}, i8 }* %ptr, i32 0, i32 1 |
Chandler Carruth | 80d3e56 | 2012-12-07 02:08:58 +0000 | [diff] [blame] | 183 | %cmp = icmp eq i8* %x, null |
| 184 | ret i1 %cmp |
| 185 | ; CHECK-NOT: ret i1 false |
| 186 | } |
| 187 | |
| 188 | define i1 @gep15({ {}, [4 x {i8, i8}]}* %ptr, i32 %y) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 189 | ; CHECK-LABEL: @gep15( |
Chandler Carruth | 80d3e56 | 2012-12-07 02:08:58 +0000 | [diff] [blame] | 190 | ; We can prove this GEP is non-null even though there is a user value, as we |
| 191 | ; would necessarily violate inbounds on one side or the other. |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 192 | %x = getelementptr inbounds { {}, [4 x {i8, i8}]}, { {}, [4 x {i8, i8}]}* %ptr, i32 0, i32 1, i32 %y, i32 1 |
Chandler Carruth | 80d3e56 | 2012-12-07 02:08:58 +0000 | [diff] [blame] | 193 | %cmp = icmp eq i8* %x, null |
| 194 | ret i1 %cmp |
| 195 | ; CHECK-NEXT: ret i1 false |
| 196 | } |
| 197 | |
| 198 | define i1 @gep16(i8* %ptr, i32 %a) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 199 | ; CHECK-LABEL: @gep16( |
Chandler Carruth | 80d3e56 | 2012-12-07 02:08:58 +0000 | [diff] [blame] | 200 | ; We can prove this GEP is non-null because it is inbounds and because we know |
| 201 | ; %b is non-zero even though we don't know its value. |
| 202 | %b = or i32 %a, 1 |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 203 | %x = getelementptr inbounds i8, i8* %ptr, i32 %b |
Chandler Carruth | 80d3e56 | 2012-12-07 02:08:58 +0000 | [diff] [blame] | 204 | %cmp = icmp eq i8* %x, null |
| 205 | ret i1 %cmp |
| 206 | ; CHECK-NEXT: ret i1 false |
| 207 | } |
| 208 | |
Duncan Sands | 8fb2c38 | 2011-01-20 13:21:55 +0000 | [diff] [blame] | 209 | define i1 @zext(i32 %x) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 210 | ; CHECK-LABEL: @zext( |
Duncan Sands | 8fb2c38 | 2011-01-20 13:21:55 +0000 | [diff] [blame] | 211 | %e1 = zext i32 %x to i64 |
| 212 | %e2 = zext i32 %x to i64 |
| 213 | %r = icmp eq i64 %e1, %e2 |
| 214 | ret i1 %r |
| 215 | ; CHECK: ret i1 true |
| 216 | } |
| 217 | |
| 218 | define i1 @zext2(i1 %x) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 219 | ; CHECK-LABEL: @zext2( |
Duncan Sands | 8fb2c38 | 2011-01-20 13:21:55 +0000 | [diff] [blame] | 220 | %e = zext i1 %x to i32 |
| 221 | %c = icmp ne i32 %e, 0 |
| 222 | ret i1 %c |
| 223 | ; CHECK: ret i1 %x |
| 224 | } |
| 225 | |
Duncan Sands | d395108 | 2011-01-25 09:38:29 +0000 | [diff] [blame] | 226 | define i1 @zext3() { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 227 | ; CHECK-LABEL: @zext3( |
Duncan Sands | d395108 | 2011-01-25 09:38:29 +0000 | [diff] [blame] | 228 | %e = zext i1 1 to i32 |
| 229 | %c = icmp ne i32 %e, 0 |
| 230 | ret i1 %c |
| 231 | ; CHECK: ret i1 true |
| 232 | } |
| 233 | |
Duncan Sands | 8fb2c38 | 2011-01-20 13:21:55 +0000 | [diff] [blame] | 234 | define i1 @sext(i32 %x) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 235 | ; CHECK-LABEL: @sext( |
Duncan Sands | 8fb2c38 | 2011-01-20 13:21:55 +0000 | [diff] [blame] | 236 | %e1 = sext i32 %x to i64 |
| 237 | %e2 = sext i32 %x to i64 |
| 238 | %r = icmp eq i64 %e1, %e2 |
| 239 | ret i1 %r |
| 240 | ; CHECK: ret i1 true |
| 241 | } |
| 242 | |
| 243 | define i1 @sext2(i1 %x) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 244 | ; CHECK-LABEL: @sext2( |
Duncan Sands | 8fb2c38 | 2011-01-20 13:21:55 +0000 | [diff] [blame] | 245 | %e = sext i1 %x to i32 |
| 246 | %c = icmp ne i32 %e, 0 |
| 247 | ret i1 %c |
| 248 | ; CHECK: ret i1 %x |
| 249 | } |
Duncan Sands | d395108 | 2011-01-25 09:38:29 +0000 | [diff] [blame] | 250 | |
| 251 | define i1 @sext3() { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 252 | ; CHECK-LABEL: @sext3( |
Duncan Sands | d395108 | 2011-01-25 09:38:29 +0000 | [diff] [blame] | 253 | %e = sext i1 1 to i32 |
| 254 | %c = icmp ne i32 %e, 0 |
| 255 | ret i1 %c |
| 256 | ; CHECK: ret i1 true |
| 257 | } |
| 258 | |
| 259 | define i1 @add(i32 %x, i32 %y) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 260 | ; CHECK-LABEL: @add( |
Duncan Sands | d395108 | 2011-01-25 09:38:29 +0000 | [diff] [blame] | 261 | %l = lshr i32 %x, 1 |
Duncan Sands | 9e9d5b2 | 2011-01-25 15:14:15 +0000 | [diff] [blame] | 262 | %q = lshr i32 %y, 1 |
| 263 | %r = or i32 %q, 1 |
Duncan Sands | d395108 | 2011-01-25 09:38:29 +0000 | [diff] [blame] | 264 | %s = add i32 %l, %r |
| 265 | %c = icmp eq i32 %s, 0 |
| 266 | ret i1 %c |
Duncan Sands | 9e9d5b2 | 2011-01-25 15:14:15 +0000 | [diff] [blame] | 267 | ; CHECK: ret i1 false |
Duncan Sands | d395108 | 2011-01-25 09:38:29 +0000 | [diff] [blame] | 268 | } |
| 269 | |
| 270 | define i1 @add2(i8 %x, i8 %y) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 271 | ; CHECK-LABEL: @add2( |
Duncan Sands | d395108 | 2011-01-25 09:38:29 +0000 | [diff] [blame] | 272 | %l = or i8 %x, 128 |
| 273 | %r = or i8 %y, 129 |
| 274 | %s = add i8 %l, %r |
| 275 | %c = icmp eq i8 %s, 0 |
| 276 | ret i1 %c |
| 277 | ; CHECK: ret i1 false |
| 278 | } |
| 279 | |
Duncan Sands | 9e9d5b2 | 2011-01-25 15:14:15 +0000 | [diff] [blame] | 280 | define i1 @add3(i8 %x, i8 %y) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 281 | ; CHECK-LABEL: @add3( |
Duncan Sands | 9e9d5b2 | 2011-01-25 15:14:15 +0000 | [diff] [blame] | 282 | %l = zext i8 %x to i32 |
| 283 | %r = zext i8 %y to i32 |
| 284 | %s = add i32 %l, %r |
| 285 | %c = icmp eq i32 %s, 0 |
| 286 | ret i1 %c |
| 287 | ; CHECK: ret i1 %c |
| 288 | } |
| 289 | |
Duncan Sands | d114ab3 | 2011-02-13 17:15:40 +0000 | [diff] [blame] | 290 | define i1 @add4(i32 %x, i32 %y) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 291 | ; CHECK-LABEL: @add4( |
Duncan Sands | d114ab3 | 2011-02-13 17:15:40 +0000 | [diff] [blame] | 292 | %z = add nsw i32 %y, 1 |
| 293 | %s1 = add nsw i32 %x, %y |
| 294 | %s2 = add nsw i32 %x, %z |
| 295 | %c = icmp slt i32 %s1, %s2 |
| 296 | ret i1 %c |
| 297 | ; CHECK: ret i1 true |
| 298 | } |
| 299 | |
| 300 | define i1 @add5(i32 %x, i32 %y) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 301 | ; CHECK-LABEL: @add5( |
Duncan Sands | d114ab3 | 2011-02-13 17:15:40 +0000 | [diff] [blame] | 302 | %z = add nuw i32 %y, 1 |
| 303 | %s1 = add nuw i32 %x, %z |
| 304 | %s2 = add nuw i32 %x, %y |
| 305 | %c = icmp ugt i32 %s1, %s2 |
| 306 | ret i1 %c |
| 307 | ; CHECK: ret i1 true |
| 308 | } |
| 309 | |
Duncan Sands | c41076c | 2012-11-16 19:41:26 +0000 | [diff] [blame] | 310 | define i1 @add6(i64 %A, i64 %B) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 311 | ; CHECK-LABEL: @add6( |
Duncan Sands | c41076c | 2012-11-16 19:41:26 +0000 | [diff] [blame] | 312 | %s1 = add i64 %A, %B |
| 313 | %s2 = add i64 %B, %A |
| 314 | %cmp = icmp eq i64 %s1, %s2 |
| 315 | ret i1 %cmp |
| 316 | ; CHECK: ret i1 true |
| 317 | } |
| 318 | |
Duncan Sands | d395108 | 2011-01-25 09:38:29 +0000 | [diff] [blame] | 319 | define i1 @addpowtwo(i32 %x, i32 %y) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 320 | ; CHECK-LABEL: @addpowtwo( |
Duncan Sands | d395108 | 2011-01-25 09:38:29 +0000 | [diff] [blame] | 321 | %l = lshr i32 %x, 1 |
| 322 | %r = shl i32 1, %y |
| 323 | %s = add i32 %l, %r |
| 324 | %c = icmp eq i32 %s, 0 |
| 325 | ret i1 %c |
| 326 | ; CHECK: ret i1 false |
| 327 | } |
| 328 | |
| 329 | define i1 @or(i32 %x) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 330 | ; CHECK-LABEL: @or( |
Duncan Sands | d395108 | 2011-01-25 09:38:29 +0000 | [diff] [blame] | 331 | %o = or i32 %x, 1 |
| 332 | %c = icmp eq i32 %o, 0 |
| 333 | ret i1 %c |
| 334 | ; CHECK: ret i1 false |
| 335 | } |
Duncan Sands | 2e9e4f1 | 2011-01-29 13:27:00 +0000 | [diff] [blame] | 336 | |
Jun Bum Lim | cd197cf | 2016-02-11 17:11:49 +0000 | [diff] [blame] | 337 | ; Do not simplify if we cannot guarantee that the ConstantExpr is a non-zero |
| 338 | ; constant. |
| 339 | @GV = common global i32* null |
| 340 | define i1 @or_constexp(i32 %x) { |
| 341 | ; CHECK-LABEL: @or_constexp( |
| 342 | entry: |
| 343 | %0 = and i32 ptrtoint (i32** @GV to i32), 32 |
| 344 | %o = or i32 %x, %0 |
| 345 | %c = icmp eq i32 %o, 0 |
| 346 | ret i1 %c |
| 347 | ; CHECK: or |
| 348 | ; CHECK-NEXT: icmp eq |
| 349 | ; CHECK-NOT: ret i1 false |
| 350 | } |
| 351 | |
David Majnemer | 76d06bc | 2014-08-28 03:34:28 +0000 | [diff] [blame] | 352 | define i1 @shl1(i32 %x) { |
| 353 | ; CHECK-LABEL: @shl1( |
Duncan Sands | 2e9e4f1 | 2011-01-29 13:27:00 +0000 | [diff] [blame] | 354 | %s = shl i32 1, %x |
| 355 | %c = icmp eq i32 %s, 0 |
| 356 | ret i1 %c |
| 357 | ; CHECK: ret i1 false |
| 358 | } |
| 359 | |
David Majnemer | 76d06bc | 2014-08-28 03:34:28 +0000 | [diff] [blame] | 360 | define i1 @shl2(i32 %X) { |
| 361 | ; CHECK: @shl2 |
| 362 | %sub = shl nsw i32 -1, %X |
| 363 | %cmp = icmp eq i32 %sub, 31 |
| 364 | ret i1 %cmp |
| 365 | ; CHECK-NEXT: ret i1 false |
| 366 | } |
| 367 | |
| 368 | define i1 @shl3(i32 %X) { |
| 369 | ; CHECK: @shl3 |
| 370 | %sub = shl nuw i32 4, %X |
| 371 | %cmp = icmp eq i32 %sub, 31 |
| 372 | ret i1 %cmp |
| 373 | ; CHECK-NEXT: ret i1 false |
| 374 | } |
| 375 | |
| 376 | define i1 @shl4(i32 %X) { |
| 377 | ; CHECK: @shl4 |
| 378 | %sub = shl nsw i32 -1, %X |
| 379 | %cmp = icmp sle i32 %sub, -1 |
| 380 | ret i1 %cmp |
| 381 | ; CHECK-NEXT: ret i1 true |
| 382 | } |
| 383 | |
| 384 | define i1 @shl5(i32 %X) { |
| 385 | ; CHECK: @shl5 |
| 386 | %sub = shl nuw i32 4, %X |
| 387 | %cmp = icmp ugt i32 %sub, 3 |
| 388 | ret i1 %cmp |
| 389 | ; CHECK-NEXT: ret i1 true |
| 390 | } |
| 391 | |
Nick Lewycky | 3cec6f5 | 2011-03-04 07:00:57 +0000 | [diff] [blame] | 392 | define i1 @lshr1(i32 %x) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 393 | ; CHECK-LABEL: @lshr1( |
Duncan Sands | 2e9e4f1 | 2011-01-29 13:27:00 +0000 | [diff] [blame] | 394 | %s = lshr i32 -1, %x |
| 395 | %c = icmp eq i32 %s, 0 |
| 396 | ret i1 %c |
| 397 | ; CHECK: ret i1 false |
| 398 | } |
| 399 | |
Nick Lewycky | 3cec6f5 | 2011-03-04 07:00:57 +0000 | [diff] [blame] | 400 | define i1 @lshr2(i32 %x) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 401 | ; CHECK-LABEL: @lshr2( |
Nick Lewycky | 3cec6f5 | 2011-03-04 07:00:57 +0000 | [diff] [blame] | 402 | %s = lshr i32 %x, 30 |
| 403 | %c = icmp ugt i32 %s, 8 |
| 404 | ret i1 %c |
| 405 | ; CHECK: ret i1 false |
| 406 | } |
| 407 | |
David Majnemer | a80fed7 | 2013-07-09 22:01:22 +0000 | [diff] [blame] | 408 | define i1 @lshr3(i32 %x) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 409 | ; CHECK-LABEL: @lshr3( |
David Majnemer | a80fed7 | 2013-07-09 22:01:22 +0000 | [diff] [blame] | 410 | %s = lshr i32 %x, %x |
| 411 | %c = icmp eq i32 %s, 0 |
| 412 | ret i1 %c |
| 413 | ; CHECK: ret i1 true |
| 414 | } |
| 415 | |
David Majnemer | 3af5bf3 | 2016-01-21 18:55:54 +0000 | [diff] [blame] | 416 | define i1 @lshr4(i32 %X, i32 %Y) { |
| 417 | ; CHECK-LABEL: @lshr4( |
| 418 | %A = lshr i32 %X, %Y |
| 419 | %C = icmp ule i32 %A, %X |
| 420 | ret i1 %C |
| 421 | ; CHECK: ret i1 true |
| 422 | } |
| 423 | |
| 424 | define i1 @lshr5(i32 %X, i32 %Y) { |
| 425 | ; CHECK-LABEL: @lshr5( |
| 426 | %A = lshr i32 %X, %Y |
| 427 | %C = icmp ugt i32 %A, %X |
| 428 | ret i1 %C |
| 429 | ; CHECK: ret i1 false |
| 430 | } |
| 431 | |
Nick Lewycky | 3cec6f5 | 2011-03-04 07:00:57 +0000 | [diff] [blame] | 432 | define i1 @ashr1(i32 %x) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 433 | ; CHECK-LABEL: @ashr1( |
Duncan Sands | 2e9e4f1 | 2011-01-29 13:27:00 +0000 | [diff] [blame] | 434 | %s = ashr i32 -1, %x |
| 435 | %c = icmp eq i32 %s, 0 |
| 436 | ret i1 %c |
| 437 | ; CHECK: ret i1 false |
| 438 | } |
Duncan Sands | 0650402 | 2011-02-03 09:37:39 +0000 | [diff] [blame] | 439 | |
Nick Lewycky | 3cec6f5 | 2011-03-04 07:00:57 +0000 | [diff] [blame] | 440 | define i1 @ashr2(i32 %x) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 441 | ; CHECK-LABEL: @ashr2( |
Nick Lewycky | 3cec6f5 | 2011-03-04 07:00:57 +0000 | [diff] [blame] | 442 | %s = ashr i32 %x, 30 |
| 443 | %c = icmp slt i32 %s, -5 |
| 444 | ret i1 %c |
| 445 | ; CHECK: ret i1 false |
| 446 | } |
| 447 | |
David Majnemer | a80fed7 | 2013-07-09 22:01:22 +0000 | [diff] [blame] | 448 | define i1 @ashr3(i32 %x) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 449 | ; CHECK-LABEL: @ashr3( |
David Majnemer | a80fed7 | 2013-07-09 22:01:22 +0000 | [diff] [blame] | 450 | %s = ashr i32 %x, %x |
| 451 | %c = icmp eq i32 %s, 0 |
| 452 | ret i1 %c |
| 453 | ; CHECK: ret i1 true |
| 454 | } |
| 455 | |
Duncan Sands | 0650402 | 2011-02-03 09:37:39 +0000 | [diff] [blame] | 456 | define i1 @select1(i1 %cond) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 457 | ; CHECK-LABEL: @select1( |
Duncan Sands | 0650402 | 2011-02-03 09:37:39 +0000 | [diff] [blame] | 458 | %s = select i1 %cond, i32 1, i32 0 |
| 459 | %c = icmp eq i32 %s, 1 |
| 460 | ret i1 %c |
| 461 | ; CHECK: ret i1 %cond |
| 462 | } |
| 463 | |
| 464 | define i1 @select2(i1 %cond) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 465 | ; CHECK-LABEL: @select2( |
Duncan Sands | 0650402 | 2011-02-03 09:37:39 +0000 | [diff] [blame] | 466 | %x = zext i1 %cond to i32 |
| 467 | %s = select i1 %cond, i32 %x, i32 0 |
| 468 | %c = icmp ne i32 %s, 0 |
| 469 | ret i1 %c |
| 470 | ; CHECK: ret i1 %cond |
| 471 | } |
| 472 | |
| 473 | define i1 @select3(i1 %cond) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 474 | ; CHECK-LABEL: @select3( |
Duncan Sands | 0650402 | 2011-02-03 09:37:39 +0000 | [diff] [blame] | 475 | %x = zext i1 %cond to i32 |
| 476 | %s = select i1 %cond, i32 1, i32 %x |
| 477 | %c = icmp ne i32 %s, 0 |
| 478 | ret i1 %c |
| 479 | ; CHECK: ret i1 %cond |
| 480 | } |
| 481 | |
| 482 | define i1 @select4(i1 %cond) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 483 | ; CHECK-LABEL: @select4( |
Duncan Sands | 0650402 | 2011-02-03 09:37:39 +0000 | [diff] [blame] | 484 | %invert = xor i1 %cond, 1 |
| 485 | %s = select i1 %invert, i32 0, i32 1 |
| 486 | %c = icmp ne i32 %s, 0 |
| 487 | ret i1 %c |
| 488 | ; CHECK: ret i1 %cond |
| 489 | } |
Nick Lewycky | c9d2006 | 2011-03-01 08:15:50 +0000 | [diff] [blame] | 490 | |
Duncan Sands | 3d5692a | 2011-10-30 19:56:36 +0000 | [diff] [blame] | 491 | define i1 @select5(i32 %x) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 492 | ; CHECK-LABEL: @select5( |
Duncan Sands | 3d5692a | 2011-10-30 19:56:36 +0000 | [diff] [blame] | 493 | %c = icmp eq i32 %x, 0 |
| 494 | %s = select i1 %c, i32 1, i32 %x |
| 495 | %c2 = icmp eq i32 %s, 0 |
| 496 | ret i1 %c2 |
| 497 | ; CHECK: ret i1 false |
| 498 | } |
| 499 | |
| 500 | define i1 @select6(i32 %x) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 501 | ; CHECK-LABEL: @select6( |
Duncan Sands | 3d5692a | 2011-10-30 19:56:36 +0000 | [diff] [blame] | 502 | %c = icmp sgt i32 %x, 0 |
| 503 | %s = select i1 %c, i32 %x, i32 4 |
| 504 | %c2 = icmp eq i32 %s, 0 |
| 505 | ret i1 %c2 |
| 506 | ; CHECK: ret i1 %c2 |
| 507 | } |
| 508 | |
Nick Lewycky | c9d2006 | 2011-03-01 08:15:50 +0000 | [diff] [blame] | 509 | define i1 @urem1(i32 %X, i32 %Y) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 510 | ; CHECK-LABEL: @urem1( |
Nick Lewycky | c9d2006 | 2011-03-01 08:15:50 +0000 | [diff] [blame] | 511 | %A = urem i32 %X, %Y |
| 512 | %B = icmp ult i32 %A, %Y |
| 513 | ret i1 %B |
| 514 | ; CHECK: ret i1 true |
| 515 | } |
| 516 | |
| 517 | define i1 @urem2(i32 %X, i32 %Y) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 518 | ; CHECK-LABEL: @urem2( |
Nick Lewycky | c9d2006 | 2011-03-01 08:15:50 +0000 | [diff] [blame] | 519 | %A = urem i32 %X, %Y |
| 520 | %B = icmp eq i32 %A, %Y |
| 521 | ret i1 %B |
Benjamin Kramer | 1885d21 | 2011-03-09 22:07:31 +0000 | [diff] [blame] | 522 | ; CHECK: ret i1 false |
Nick Lewycky | c9d2006 | 2011-03-01 08:15:50 +0000 | [diff] [blame] | 523 | } |
Nick Lewycky | 3cec6f5 | 2011-03-04 07:00:57 +0000 | [diff] [blame] | 524 | |
| 525 | define i1 @urem3(i32 %X) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 526 | ; CHECK-LABEL: @urem3( |
Nick Lewycky | 3cec6f5 | 2011-03-04 07:00:57 +0000 | [diff] [blame] | 527 | %A = urem i32 %X, 10 |
| 528 | %B = icmp ult i32 %A, 15 |
| 529 | ret i1 %B |
| 530 | ; CHECK: ret i1 true |
| 531 | } |
| 532 | |
| 533 | define i1 @urem4(i32 %X) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 534 | ; CHECK-LABEL: @urem4( |
Nick Lewycky | 3cec6f5 | 2011-03-04 07:00:57 +0000 | [diff] [blame] | 535 | %A = urem i32 %X, 15 |
| 536 | %B = icmp ult i32 %A, 10 |
| 537 | ret i1 %B |
| 538 | ; CHECK: ret i1 %B |
| 539 | } |
| 540 | |
Nick Lewycky | 8e3a79d | 2011-03-04 10:06:52 +0000 | [diff] [blame] | 541 | define i1 @urem5(i16 %X, i32 %Y) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 542 | ; CHECK-LABEL: @urem5( |
Nick Lewycky | 8e3a79d | 2011-03-04 10:06:52 +0000 | [diff] [blame] | 543 | %A = zext i16 %X to i32 |
| 544 | %B = urem i32 %A, %Y |
| 545 | %C = icmp slt i32 %B, %Y |
| 546 | ret i1 %C |
Nick Lewycky | 35aeea9 | 2013-07-12 23:42:57 +0000 | [diff] [blame] | 547 | ; CHECK-NOT: ret i1 true |
Nick Lewycky | 8e3a79d | 2011-03-04 10:06:52 +0000 | [diff] [blame] | 548 | } |
| 549 | |
Nick Lewycky | 980104d | 2011-03-09 06:26:03 +0000 | [diff] [blame] | 550 | define i1 @urem6(i32 %X, i32 %Y) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 551 | ; CHECK-LABEL: @urem6( |
Nick Lewycky | 980104d | 2011-03-09 06:26:03 +0000 | [diff] [blame] | 552 | %A = urem i32 %X, %Y |
| 553 | %B = icmp ugt i32 %Y, %A |
| 554 | ret i1 %B |
| 555 | ; CHECK: ret i1 true |
| 556 | } |
| 557 | |
Nick Lewycky | 35aeea9 | 2013-07-12 23:42:57 +0000 | [diff] [blame] | 558 | define i1 @urem7(i32 %X) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 559 | ; CHECK-LABEL: @urem7( |
Nick Lewycky | 35aeea9 | 2013-07-12 23:42:57 +0000 | [diff] [blame] | 560 | %A = urem i32 1, %X |
| 561 | %B = icmp sgt i32 %A, %X |
| 562 | ret i1 %B |
| 563 | ; CHECK-NOT: ret i1 false |
| 564 | } |
| 565 | |
Nick Lewycky | 3cec6f5 | 2011-03-04 07:00:57 +0000 | [diff] [blame] | 566 | define i1 @srem1(i32 %X) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 567 | ; CHECK-LABEL: @srem1( |
Nick Lewycky | 3cec6f5 | 2011-03-04 07:00:57 +0000 | [diff] [blame] | 568 | %A = srem i32 %X, -5 |
| 569 | %B = icmp sgt i32 %A, 5 |
| 570 | ret i1 %B |
| 571 | ; CHECK: ret i1 false |
| 572 | } |
| 573 | |
Nick Lewycky | cc79973 | 2011-03-11 09:00:19 +0000 | [diff] [blame] | 574 | ; PR9343 #15 |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 575 | ; CHECK-LABEL: @srem2( |
Nick Lewycky | cc79973 | 2011-03-11 09:00:19 +0000 | [diff] [blame] | 576 | ; CHECK: ret i1 false |
| 577 | define i1 @srem2(i16 %X, i32 %Y) { |
| 578 | %A = zext i16 %X to i32 |
| 579 | %B = add nsw i32 %A, 1 |
| 580 | %C = srem i32 %B, %Y |
| 581 | %D = icmp slt i32 %C, 0 |
| 582 | ret i1 %D |
| 583 | } |
Benjamin Kramer | 5acc751 | 2011-03-12 17:18:11 +0000 | [diff] [blame] | 584 | |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 585 | ; CHECK-LABEL: @srem3( |
Benjamin Kramer | 5acc751 | 2011-03-12 17:18:11 +0000 | [diff] [blame] | 586 | ; CHECK-NEXT: ret i1 false |
| 587 | define i1 @srem3(i16 %X, i32 %Y) { |
| 588 | %A = zext i16 %X to i32 |
| 589 | %B = or i32 2147483648, %A |
| 590 | %C = sub nsw i32 1, %B |
| 591 | %D = srem i32 %C, %Y |
| 592 | %E = icmp slt i32 %D, 0 |
| 593 | ret i1 %E |
| 594 | } |
| 595 | |
Nick Lewycky | 3cec6f5 | 2011-03-04 07:00:57 +0000 | [diff] [blame] | 596 | define i1 @udiv1(i32 %X) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 597 | ; CHECK-LABEL: @udiv1( |
Nick Lewycky | 3cec6f5 | 2011-03-04 07:00:57 +0000 | [diff] [blame] | 598 | %A = udiv i32 %X, 1000000 |
| 599 | %B = icmp ult i32 %A, 5000 |
| 600 | ret i1 %B |
| 601 | ; CHECK: ret i1 true |
| 602 | } |
| 603 | |
Nick Lewycky | 9719a71 | 2011-03-05 05:19:11 +0000 | [diff] [blame] | 604 | define i1 @udiv2(i32 %X, i32 %Y, i32 %Z) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 605 | ; CHECK-LABEL: @udiv2( |
Nick Lewycky | 9719a71 | 2011-03-05 05:19:11 +0000 | [diff] [blame] | 606 | %A = udiv exact i32 10, %Z |
| 607 | %B = udiv exact i32 20, %Z |
| 608 | %C = icmp ult i32 %A, %B |
| 609 | ret i1 %C |
| 610 | ; CHECK: ret i1 true |
| 611 | } |
| 612 | |
Duncan Sands | 92af0a8 | 2011-10-28 18:17:44 +0000 | [diff] [blame] | 613 | define i1 @udiv3(i32 %X, i32 %Y) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 614 | ; CHECK-LABEL: @udiv3( |
Duncan Sands | 92af0a8 | 2011-10-28 18:17:44 +0000 | [diff] [blame] | 615 | %A = udiv i32 %X, %Y |
| 616 | %C = icmp ugt i32 %A, %X |
| 617 | ret i1 %C |
| 618 | ; CHECK: ret i1 false |
| 619 | } |
| 620 | |
| 621 | define i1 @udiv4(i32 %X, i32 %Y) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 622 | ; CHECK-LABEL: @udiv4( |
Duncan Sands | 92af0a8 | 2011-10-28 18:17:44 +0000 | [diff] [blame] | 623 | %A = udiv i32 %X, %Y |
| 624 | %C = icmp ule i32 %A, %X |
| 625 | ret i1 %C |
| 626 | ; CHECK: ret i1 true |
| 627 | } |
| 628 | |
| 629 | define i1 @udiv5(i32 %X) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 630 | ; CHECK-LABEL: @udiv5( |
Duncan Sands | 92af0a8 | 2011-10-28 18:17:44 +0000 | [diff] [blame] | 631 | %A = udiv i32 123, %X |
| 632 | %C = icmp ugt i32 %A, 124 |
| 633 | ret i1 %C |
| 634 | ; CHECK: ret i1 false |
| 635 | } |
| 636 | |
Eli Friedman | 0bae8b2 | 2011-11-08 21:08:02 +0000 | [diff] [blame] | 637 | ; PR11340 |
| 638 | define i1 @udiv6(i32 %X) nounwind { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 639 | ; CHECK-LABEL: @udiv6( |
Eli Friedman | 0bae8b2 | 2011-11-08 21:08:02 +0000 | [diff] [blame] | 640 | %A = udiv i32 1, %X |
| 641 | %C = icmp eq i32 %A, 0 |
| 642 | ret i1 %C |
| 643 | ; CHECK: ret i1 %C |
| 644 | } |
| 645 | |
| 646 | |
Nick Lewycky | 3cec6f5 | 2011-03-04 07:00:57 +0000 | [diff] [blame] | 647 | define i1 @sdiv1(i32 %X) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 648 | ; CHECK-LABEL: @sdiv1( |
Nick Lewycky | 3cec6f5 | 2011-03-04 07:00:57 +0000 | [diff] [blame] | 649 | %A = sdiv i32 %X, 1000000 |
| 650 | %B = icmp slt i32 %A, 3000 |
| 651 | ret i1 %B |
| 652 | ; CHECK: ret i1 true |
| 653 | } |
| 654 | |
| 655 | define i1 @or1(i32 %X) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 656 | ; CHECK-LABEL: @or1( |
Nick Lewycky | 3cec6f5 | 2011-03-04 07:00:57 +0000 | [diff] [blame] | 657 | %A = or i32 %X, 62 |
| 658 | %B = icmp ult i32 %A, 50 |
| 659 | ret i1 %B |
| 660 | ; CHECK: ret i1 false |
| 661 | } |
| 662 | |
| 663 | define i1 @and1(i32 %X) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 664 | ; CHECK-LABEL: @and1( |
Nick Lewycky | 3cec6f5 | 2011-03-04 07:00:57 +0000 | [diff] [blame] | 665 | %A = and i32 %X, 62 |
| 666 | %B = icmp ugt i32 %A, 70 |
| 667 | ret i1 %B |
| 668 | ; CHECK: ret i1 false |
| 669 | } |
Duncan Sands | 7cb61e5 | 2011-10-27 19:16:21 +0000 | [diff] [blame] | 670 | |
| 671 | define i1 @mul1(i32 %X) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 672 | ; CHECK-LABEL: @mul1( |
Duncan Sands | 7cb61e5 | 2011-10-27 19:16:21 +0000 | [diff] [blame] | 673 | ; Square of a non-zero number is non-zero if there is no overflow. |
| 674 | %Y = or i32 %X, 1 |
| 675 | %M = mul nuw i32 %Y, %Y |
| 676 | %C = icmp eq i32 %M, 0 |
| 677 | ret i1 %C |
| 678 | ; CHECK: ret i1 false |
| 679 | } |
| 680 | |
| 681 | define i1 @mul2(i32 %X) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 682 | ; CHECK-LABEL: @mul2( |
Duncan Sands | 7cb61e5 | 2011-10-27 19:16:21 +0000 | [diff] [blame] | 683 | ; Square of a non-zero number is positive if there is no signed overflow. |
| 684 | %Y = or i32 %X, 1 |
| 685 | %M = mul nsw i32 %Y, %Y |
| 686 | %C = icmp sgt i32 %M, 0 |
| 687 | ret i1 %C |
| 688 | ; CHECK: ret i1 true |
| 689 | } |
| 690 | |
| 691 | define i1 @mul3(i32 %X, i32 %Y) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 692 | ; CHECK-LABEL: @mul3( |
Duncan Sands | 7cb61e5 | 2011-10-27 19:16:21 +0000 | [diff] [blame] | 693 | ; Product of non-negative numbers is non-negative if there is no signed overflow. |
| 694 | %XX = mul nsw i32 %X, %X |
| 695 | %YY = mul nsw i32 %Y, %Y |
| 696 | %M = mul nsw i32 %XX, %YY |
| 697 | %C = icmp sge i32 %M, 0 |
| 698 | ret i1 %C |
| 699 | ; CHECK: ret i1 true |
| 700 | } |
Duncan Sands | bf48ac6 | 2012-02-10 14:26:42 +0000 | [diff] [blame] | 701 | |
| 702 | define <2 x i1> @vectorselect1(<2 x i1> %cond) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 703 | ; CHECK-LABEL: @vectorselect1( |
Duncan Sands | bf48ac6 | 2012-02-10 14:26:42 +0000 | [diff] [blame] | 704 | %invert = xor <2 x i1> %cond, <i1 1, i1 1> |
| 705 | %s = select <2 x i1> %invert, <2 x i32> <i32 0, i32 0>, <2 x i32> <i32 1, i32 1> |
| 706 | %c = icmp ne <2 x i32> %s, <i32 0, i32 0> |
| 707 | ret <2 x i1> %c |
| 708 | ; CHECK: ret <2 x i1> %cond |
| 709 | } |
Duncan Sands | 26641d7 | 2012-02-10 14:31:24 +0000 | [diff] [blame] | 710 | |
Chris Lattner | 445d8c6 | 2012-02-20 00:42:49 +0000 | [diff] [blame] | 711 | ; PR11948 |
| 712 | define <2 x i1> @vectorselectcrash(i32 %arg1) { |
Duncan Sands | 26641d7 | 2012-02-10 14:31:24 +0000 | [diff] [blame] | 713 | %tobool40 = icmp ne i32 %arg1, 0 |
| 714 | %cond43 = select i1 %tobool40, <2 x i16> <i16 -5, i16 66>, <2 x i16> <i16 46, i16 1> |
| 715 | %cmp45 = icmp ugt <2 x i16> %cond43, <i16 73, i16 21> |
| 716 | ret <2 x i1> %cmp45 |
| 717 | } |
Chris Lattner | 445d8c6 | 2012-02-20 00:42:49 +0000 | [diff] [blame] | 718 | |
| 719 | ; PR12013 |
| 720 | define i1 @alloca_compare(i64 %idx) { |
| 721 | %sv = alloca { i32, i32, [124 x i32] } |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 722 | %1 = getelementptr inbounds { i32, i32, [124 x i32] }, { i32, i32, [124 x i32] }* %sv, i32 0, i32 2, i64 %idx |
Chris Lattner | 445d8c6 | 2012-02-20 00:42:49 +0000 | [diff] [blame] | 723 | %2 = icmp eq i32* %1, null |
| 724 | ret i1 %2 |
| 725 | ; CHECK: alloca_compare |
| 726 | ; CHECK: ret i1 false |
| 727 | } |
Chris Lattner | 01990f0 | 2012-02-24 19:01:58 +0000 | [diff] [blame] | 728 | |
| 729 | ; PR12075 |
| 730 | define i1 @infinite_gep() { |
| 731 | ret i1 1 |
| 732 | |
| 733 | unreachableblock: |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 734 | %X = getelementptr i32, i32 *%X, i32 1 |
Chris Lattner | 01990f0 | 2012-02-24 19:01:58 +0000 | [diff] [blame] | 735 | %Y = icmp eq i32* %X, null |
| 736 | ret i1 %Y |
| 737 | } |
Dan Gohman | 995d40e | 2013-01-31 23:49:33 +0000 | [diff] [blame] | 738 | |
| 739 | ; It's not valid to fold a comparison of an argument with an alloca, even though |
| 740 | ; that's tempting. An argument can't *alias* an alloca, however the aliasing rule |
| 741 | ; relies on restrictions against guessing an object's address and dereferencing. |
| 742 | ; There are no restrictions against guessing an object's address and comparing. |
| 743 | |
| 744 | define i1 @alloca_argument_compare(i64* %arg) { |
| 745 | %alloc = alloca i64 |
| 746 | %cmp = icmp eq i64* %arg, %alloc |
| 747 | ret i1 %cmp |
| 748 | ; CHECK: alloca_argument_compare |
| 749 | ; CHECK: ret i1 %cmp |
| 750 | } |
Dan Gohman | b3e2d3a | 2013-02-01 00:11:13 +0000 | [diff] [blame] | 751 | |
| 752 | ; As above, but with the operands reversed. |
| 753 | |
| 754 | define i1 @alloca_argument_compare_swapped(i64* %arg) { |
| 755 | %alloc = alloca i64 |
| 756 | %cmp = icmp eq i64* %alloc, %arg |
| 757 | ret i1 %cmp |
| 758 | ; CHECK: alloca_argument_compare_swapped |
| 759 | ; CHECK: ret i1 %cmp |
| 760 | } |
| 761 | |
| 762 | ; Don't assume that a noalias argument isn't equal to a global variable's |
| 763 | ; address. This is an example where AliasAnalysis' NoAlias concept is |
| 764 | ; different from actual pointer inequality. |
| 765 | |
| 766 | @y = external global i32 |
| 767 | define zeroext i1 @external_compare(i32* noalias %x) { |
| 768 | %cmp = icmp eq i32* %x, @y |
| 769 | ret i1 %cmp |
| 770 | ; CHECK: external_compare |
| 771 | ; CHECK: ret i1 %cmp |
| 772 | } |
Manman Ren | 1217112 | 2013-03-18 21:23:25 +0000 | [diff] [blame] | 773 | |
| 774 | define i1 @alloca_gep(i64 %a, i64 %b) { |
Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 775 | ; CHECK-LABEL: @alloca_gep( |
Manman Ren | 1217112 | 2013-03-18 21:23:25 +0000 | [diff] [blame] | 776 | ; We can prove this GEP is non-null because it is inbounds and the pointer |
| 777 | ; is non-null. |
| 778 | %strs = alloca [1000 x [1001 x i8]], align 16 |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 779 | %x = getelementptr inbounds [1000 x [1001 x i8]], [1000 x [1001 x i8]]* %strs, i64 0, i64 %a, i64 %b |
Manman Ren | 1217112 | 2013-03-18 21:23:25 +0000 | [diff] [blame] | 780 | %cmp = icmp eq i8* %x, null |
| 781 | ret i1 %cmp |
| 782 | ; CHECK-NEXT: ret i1 false |
| 783 | } |
Benjamin Kramer | 942dfe6 | 2013-09-23 14:16:38 +0000 | [diff] [blame] | 784 | |
| 785 | define i1 @non_inbounds_gep_compare(i64* %a) { |
| 786 | ; CHECK-LABEL: @non_inbounds_gep_compare( |
| 787 | ; Equality compares with non-inbounds GEPs can be folded. |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 788 | %x = getelementptr i64, i64* %a, i64 42 |
| 789 | %y = getelementptr inbounds i64, i64* %x, i64 -42 |
| 790 | %z = getelementptr i64, i64* %a, i64 -42 |
| 791 | %w = getelementptr inbounds i64, i64* %z, i64 42 |
Benjamin Kramer | b517194 | 2013-09-23 14:41:35 +0000 | [diff] [blame] | 792 | %cmp = icmp eq i64* %y, %w |
Benjamin Kramer | 942dfe6 | 2013-09-23 14:16:38 +0000 | [diff] [blame] | 793 | ret i1 %cmp |
Benjamin Kramer | b517194 | 2013-09-23 14:41:35 +0000 | [diff] [blame] | 794 | ; CHECK-NEXT: ret i1 true |
Benjamin Kramer | 942dfe6 | 2013-09-23 14:16:38 +0000 | [diff] [blame] | 795 | } |
Benjamin Kramer | d75c8eb | 2013-09-28 21:27:49 +0000 | [diff] [blame] | 796 | |
| 797 | define i1 @non_inbounds_gep_compare2(i64* %a) { |
| 798 | ; CHECK-LABEL: @non_inbounds_gep_compare2( |
| 799 | ; Equality compares with non-inbounds GEPs can be folded. |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 800 | %x = getelementptr i64, i64* %a, i64 4294967297 |
| 801 | %y = getelementptr i64, i64* %a, i64 1 |
Benjamin Kramer | d75c8eb | 2013-09-28 21:27:49 +0000 | [diff] [blame] | 802 | %cmp = icmp eq i64* %y, %y |
| 803 | ret i1 %cmp |
| 804 | ; CHECK-NEXT: ret i1 true |
| 805 | } |
Benjamin Kramer | 5e1794e | 2014-01-24 17:09:53 +0000 | [diff] [blame] | 806 | |
| 807 | define <4 x i8> @vectorselectfold(<4 x i8> %a, <4 x i8> %b) { |
| 808 | %false = icmp ne <4 x i8> zeroinitializer, zeroinitializer |
| 809 | %sel = select <4 x i1> %false, <4 x i8> %a, <4 x i8> %b |
| 810 | ret <4 x i8> %sel |
| 811 | |
| 812 | ; CHECK-LABEL: @vectorselectfold |
| 813 | ; CHECK-NEXT: ret <4 x i8> %b |
| 814 | } |
| 815 | |
| 816 | define <4 x i8> @vectorselectfold2(<4 x i8> %a, <4 x i8> %b) { |
| 817 | %true = icmp eq <4 x i8> zeroinitializer, zeroinitializer |
| 818 | %sel = select <4 x i1> %true, <4 x i8> %a, <4 x i8> %b |
| 819 | ret <4 x i8> %sel |
| 820 | |
| 821 | ; CHECK-LABEL: @vectorselectfold |
| 822 | ; CHECK-NEXT: ret <4 x i8> %a |
| 823 | } |
David Majnemer | 2d6c023 | 2014-05-14 20:16:28 +0000 | [diff] [blame] | 824 | |
| 825 | define i1 @compare_always_true_slt(i16 %a) { |
| 826 | %1 = zext i16 %a to i32 |
| 827 | %2 = sub nsw i32 0, %1 |
| 828 | %3 = icmp slt i32 %2, 1 |
| 829 | ret i1 %3 |
| 830 | |
| 831 | ; CHECK-LABEL: @compare_always_true_slt |
| 832 | ; CHECK-NEXT: ret i1 true |
| 833 | } |
| 834 | |
| 835 | define i1 @compare_always_true_sle(i16 %a) { |
| 836 | %1 = zext i16 %a to i32 |
| 837 | %2 = sub nsw i32 0, %1 |
| 838 | %3 = icmp sle i32 %2, 0 |
| 839 | ret i1 %3 |
| 840 | |
| 841 | ; CHECK-LABEL: @compare_always_true_sle |
| 842 | ; CHECK-NEXT: ret i1 true |
| 843 | } |
| 844 | |
| 845 | define i1 @compare_always_false_sgt(i16 %a) { |
| 846 | %1 = zext i16 %a to i32 |
| 847 | %2 = sub nsw i32 0, %1 |
| 848 | %3 = icmp sgt i32 %2, 0 |
| 849 | ret i1 %3 |
| 850 | |
| 851 | ; CHECK-LABEL: @compare_always_false_sgt |
| 852 | ; CHECK-NEXT: ret i1 false |
| 853 | } |
| 854 | |
| 855 | define i1 @compare_always_false_sge(i16 %a) { |
| 856 | %1 = zext i16 %a to i32 |
| 857 | %2 = sub nsw i32 0, %1 |
| 858 | %3 = icmp sge i32 %2, 1 |
| 859 | ret i1 %3 |
| 860 | |
| 861 | ; CHECK-LABEL: @compare_always_false_sge |
| 862 | ; CHECK-NEXT: ret i1 false |
| 863 | } |
| 864 | |
| 865 | define i1 @compare_always_false_eq(i16 %a) { |
| 866 | %1 = zext i16 %a to i32 |
| 867 | %2 = sub nsw i32 0, %1 |
| 868 | %3 = icmp eq i32 %2, 1 |
| 869 | ret i1 %3 |
| 870 | |
| 871 | ; CHECK-LABEL: @compare_always_false_eq |
| 872 | ; CHECK-NEXT: ret i1 false |
| 873 | } |
| 874 | |
| 875 | define i1 @compare_always_false_ne(i16 %a) { |
| 876 | %1 = zext i16 %a to i32 |
| 877 | %2 = sub nsw i32 0, %1 |
| 878 | %3 = icmp ne i32 %2, 1 |
| 879 | ret i1 %3 |
| 880 | |
| 881 | ; CHECK-LABEL: @compare_always_false_ne |
| 882 | ; CHECK-NEXT: ret i1 true |
| 883 | } |
David Majnemer | ea8d5db | 2014-05-16 16:57:04 +0000 | [diff] [blame] | 884 | |
| 885 | define i1 @compare_dividend(i32 %a) { |
| 886 | %div = sdiv i32 2, %a |
| 887 | %cmp = icmp eq i32 %div, 3 |
| 888 | ret i1 %cmp |
| 889 | |
| 890 | ; CHECK-LABEL: @compare_dividend |
| 891 | ; CHECK-NEXT: ret i1 false |
| 892 | } |
David Majnemer | 78910fc | 2014-05-16 17:14:03 +0000 | [diff] [blame] | 893 | |
| 894 | define i1 @lshr_ugt_false(i32 %a) { |
| 895 | %shr = lshr i32 1, %a |
| 896 | %cmp = icmp ugt i32 %shr, 1 |
| 897 | ret i1 %cmp |
| 898 | ; CHECK-LABEL: @lshr_ugt_false |
| 899 | ; CHECK-NEXT: ret i1 false |
| 900 | } |
| 901 | |
| 902 | define i1 @exact_lshr_ugt_false(i32 %a) { |
| 903 | %shr = lshr exact i32 30, %a |
| 904 | %cmp = icmp ult i32 %shr, 15 |
| 905 | ret i1 %cmp |
| 906 | ; CHECK-LABEL: @exact_lshr_ugt_false |
| 907 | ; CHECK-NEXT: ret i1 false |
| 908 | } |
| 909 | |
| 910 | define i1 @lshr_sgt_false(i32 %a) { |
| 911 | %shr = lshr i32 1, %a |
| 912 | %cmp = icmp sgt i32 %shr, 1 |
| 913 | ret i1 %cmp |
| 914 | ; CHECK-LABEL: @lshr_sgt_false |
| 915 | ; CHECK-NEXT: ret i1 false |
| 916 | } |
| 917 | |
| 918 | define i1 @ashr_sgt_false(i32 %a) { |
| 919 | %shr = ashr i32 -30, %a |
| 920 | %cmp = icmp sgt i32 %shr, -1 |
| 921 | ret i1 %cmp |
| 922 | ; CHECK-LABEL: @ashr_sgt_false |
| 923 | ; CHECK-NEXT: ret i1 false |
| 924 | } |
| 925 | |
| 926 | define i1 @exact_ashr_sgt_false(i32 %a) { |
| 927 | %shr = ashr exact i32 -30, %a |
| 928 | %cmp = icmp sgt i32 %shr, -15 |
| 929 | ret i1 %cmp |
| 930 | ; CHECK-LABEL: @exact_ashr_sgt_false |
| 931 | ; CHECK-NEXT: ret i1 false |
| 932 | } |
Nick Lewycky | ec37354 | 2014-05-20 05:13:21 +0000 | [diff] [blame] | 933 | |
| 934 | define i1 @nonnull_arg(i32* nonnull %i) { |
| 935 | %cmp = icmp eq i32* %i, null |
| 936 | ret i1 %cmp |
| 937 | ; CHECK-LABEL: @nonnull_arg |
| 938 | ; CHECK: ret i1 false |
| 939 | } |
| 940 | |
Hal Finkel | b0407ba | 2014-07-18 15:51:28 +0000 | [diff] [blame] | 941 | define i1 @nonnull_deref_arg(i32* dereferenceable(4) %i) { |
| 942 | %cmp = icmp eq i32* %i, null |
| 943 | ret i1 %cmp |
| 944 | ; CHECK-LABEL: @nonnull_deref_arg |
| 945 | ; CHECK: ret i1 false |
| 946 | } |
| 947 | |
| 948 | define i1 @nonnull_deref_as_arg(i32 addrspace(1)* dereferenceable(4) %i) { |
| 949 | %cmp = icmp eq i32 addrspace(1)* %i, null |
| 950 | ret i1 %cmp |
| 951 | ; CHECK-LABEL: @nonnull_deref_as_arg |
| 952 | ; CHECK: icmp |
Ahmed Bougacha | 082c5c7 | 2015-03-14 01:43:57 +0000 | [diff] [blame] | 953 | ; CHECK: ret |
Hal Finkel | b0407ba | 2014-07-18 15:51:28 +0000 | [diff] [blame] | 954 | } |
| 955 | |
Nick Lewycky | ec37354 | 2014-05-20 05:13:21 +0000 | [diff] [blame] | 956 | declare nonnull i32* @returns_nonnull_helper() |
| 957 | define i1 @returns_nonnull() { |
| 958 | %call = call nonnull i32* @returns_nonnull_helper() |
| 959 | %cmp = icmp eq i32* %call, null |
| 960 | ret i1 %cmp |
| 961 | ; CHECK-LABEL: @returns_nonnull |
| 962 | ; CHECK: ret i1 false |
| 963 | } |
| 964 | |
Hal Finkel | b0407ba | 2014-07-18 15:51:28 +0000 | [diff] [blame] | 965 | declare dereferenceable(4) i32* @returns_nonnull_deref_helper() |
| 966 | define i1 @returns_nonnull_deref() { |
| 967 | %call = call dereferenceable(4) i32* @returns_nonnull_deref_helper() |
| 968 | %cmp = icmp eq i32* %call, null |
| 969 | ret i1 %cmp |
| 970 | ; CHECK-LABEL: @returns_nonnull_deref |
| 971 | ; CHECK: ret i1 false |
| 972 | } |
| 973 | |
| 974 | declare dereferenceable(4) i32 addrspace(1)* @returns_nonnull_deref_as_helper() |
| 975 | define i1 @returns_nonnull_as_deref() { |
| 976 | %call = call dereferenceable(4) i32 addrspace(1)* @returns_nonnull_deref_as_helper() |
| 977 | %cmp = icmp eq i32 addrspace(1)* %call, null |
| 978 | ret i1 %cmp |
| 979 | ; CHECK-LABEL: @returns_nonnull_as_deref |
| 980 | ; CHECK: icmp |
| 981 | ; CHECK: ret |
| 982 | } |
| 983 | |
Philip Reames | cdb72f3 | 2014-10-20 22:40:55 +0000 | [diff] [blame] | 984 | define i1 @nonnull_load(i32** %addr) { |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 985 | %ptr = load i32*, i32** %addr, !nonnull !{} |
Philip Reames | cdb72f3 | 2014-10-20 22:40:55 +0000 | [diff] [blame] | 986 | %cmp = icmp eq i32* %ptr, null |
| 987 | ret i1 %cmp |
| 988 | ; CHECK-LABEL: @nonnull_load |
| 989 | ; CHECK: ret i1 false |
| 990 | } |
| 991 | |
| 992 | define i1 @nonnull_load_as_outer(i32* addrspace(1)* %addr) { |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 993 | %ptr = load i32*, i32* addrspace(1)* %addr, !nonnull !{} |
Philip Reames | cdb72f3 | 2014-10-20 22:40:55 +0000 | [diff] [blame] | 994 | %cmp = icmp eq i32* %ptr, null |
| 995 | ret i1 %cmp |
| 996 | ; CHECK-LABEL: @nonnull_load_as_outer |
| 997 | ; CHECK: ret i1 false |
| 998 | } |
| 999 | define i1 @nonnull_load_as_inner(i32 addrspace(1)** %addr) { |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 1000 | %ptr = load i32 addrspace(1)*, i32 addrspace(1)** %addr, !nonnull !{} |
Philip Reames | cdb72f3 | 2014-10-20 22:40:55 +0000 | [diff] [blame] | 1001 | %cmp = icmp eq i32 addrspace(1)* %ptr, null |
| 1002 | ret i1 %cmp |
| 1003 | ; CHECK-LABEL: @nonnull_load_as_inner |
| 1004 | ; CHECK: ret i1 false |
| 1005 | } |
| 1006 | |
Nick Lewycky | c961030 | 2014-06-19 03:35:49 +0000 | [diff] [blame] | 1007 | ; If a bit is known to be zero for A and known to be one for B, |
| 1008 | ; then A and B cannot be equal. |
Sanjay Patel | bf82f44 | 2016-08-04 16:48:30 +0000 | [diff] [blame] | 1009 | define i1 @icmp_eq_const(i32 %a) { |
| 1010 | ; CHECK-LABEL: @icmp_eq_const( |
| 1011 | ; CHECK-NEXT: ret i1 false |
| 1012 | ; |
Nick Lewycky | c961030 | 2014-06-19 03:35:49 +0000 | [diff] [blame] | 1013 | %b = mul nsw i32 %a, -2 |
| 1014 | %c = icmp eq i32 %b, 1 |
| 1015 | ret i1 %c |
Nick Lewycky | c961030 | 2014-06-19 03:35:49 +0000 | [diff] [blame] | 1016 | } |
| 1017 | |
Sanjay Patel | bf82f44 | 2016-08-04 16:48:30 +0000 | [diff] [blame] | 1018 | ; FIXME: Vectors should fold the same way. |
| 1019 | define <2 x i1> @icmp_eq_const_vec(<2 x i32> %a) { |
| 1020 | ; CHECK-LABEL: @icmp_eq_const_vec( |
Sanjay Patel | bcaf6f3 | 2016-08-04 17:48:04 +0000 | [diff] [blame^] | 1021 | ; CHECK-NEXT: ret <2 x i1> zeroinitializer |
Sanjay Patel | bf82f44 | 2016-08-04 16:48:30 +0000 | [diff] [blame] | 1022 | ; |
| 1023 | %b = mul nsw <2 x i32> %a, <i32 -2, i32 -2> |
| 1024 | %c = icmp eq <2 x i32> %b, <i32 1, i32 1> |
| 1025 | ret <2 x i1> %c |
| 1026 | } |
| 1027 | |
| 1028 | define i1 @icmp_ne_const(i32 %a) { |
| 1029 | ; CHECK-LABEL: @icmp_ne_const( |
| 1030 | ; CHECK-NEXT: ret i1 true |
| 1031 | ; |
Nick Lewycky | c961030 | 2014-06-19 03:35:49 +0000 | [diff] [blame] | 1032 | %b = mul nsw i32 %a, -2 |
| 1033 | %c = icmp ne i32 %b, 1 |
| 1034 | ret i1 %c |
Sanjay Patel | bf82f44 | 2016-08-04 16:48:30 +0000 | [diff] [blame] | 1035 | } |
Nick Lewycky | c961030 | 2014-06-19 03:35:49 +0000 | [diff] [blame] | 1036 | |
Sanjay Patel | bf82f44 | 2016-08-04 16:48:30 +0000 | [diff] [blame] | 1037 | ; FIXME: Vectors should fold the same way. |
| 1038 | define <2 x i1> @icmp_ne_const_vec(<2 x i32> %a) { |
| 1039 | ; CHECK-LABEL: @icmp_ne_const_vec( |
Sanjay Patel | bcaf6f3 | 2016-08-04 17:48:04 +0000 | [diff] [blame^] | 1040 | ; CHECK-NEXT: ret <2 x i1> <i1 true, i1 true> |
Sanjay Patel | bf82f44 | 2016-08-04 16:48:30 +0000 | [diff] [blame] | 1041 | ; |
| 1042 | %b = mul nsw <2 x i32> %a, <i32 -2, i32 -2> |
| 1043 | %c = icmp ne <2 x i32> %b, <i32 1, i32 1> |
| 1044 | ret <2 x i1> %c |
Nick Lewycky | c961030 | 2014-06-19 03:35:49 +0000 | [diff] [blame] | 1045 | } |
David Majnemer | 651ed5e | 2014-07-04 00:23:39 +0000 | [diff] [blame] | 1046 | |
| 1047 | define i1 @icmp_sdiv_int_min(i32 %a) { |
| 1048 | %div = sdiv i32 -2147483648, %a |
| 1049 | %cmp = icmp ne i32 %div, -1073741824 |
| 1050 | ret i1 %cmp |
| 1051 | |
| 1052 | ; CHECK-LABEL: @icmp_sdiv_int_min |
| 1053 | ; CHECK-NEXT: [[DIV:%.*]] = sdiv i32 -2147483648, %a |
| 1054 | ; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 [[DIV]], -1073741824 |
| 1055 | ; CHECK-NEXT: ret i1 [[CMP]] |
| 1056 | } |
David Majnemer | 5ea4fc0 | 2014-07-14 19:49:57 +0000 | [diff] [blame] | 1057 | |
| 1058 | define i1 @icmp_sdiv_pr20288(i64 %a) { |
| 1059 | %div = sdiv i64 %a, -8589934592 |
| 1060 | %cmp = icmp ne i64 %div, 1073741824 |
| 1061 | ret i1 %cmp |
| 1062 | |
| 1063 | ; CHECK-LABEL: @icmp_sdiv_pr20288 |
| 1064 | ; CHECK-NEXT: [[DIV:%.*]] = sdiv i64 %a, -8589934592 |
| 1065 | ; CHECK-NEXT: [[CMP:%.*]] = icmp ne i64 [[DIV]], 1073741824 |
| 1066 | ; CHECK-NEXT: ret i1 [[CMP]] |
| 1067 | } |
David Majnemer | af9180f | 2014-07-14 20:38:45 +0000 | [diff] [blame] | 1068 | |
| 1069 | define i1 @icmp_sdiv_neg1(i64 %a) { |
David Majnemer | b8f435c | 2014-07-14 20:46:04 +0000 | [diff] [blame] | 1070 | %div = sdiv i64 %a, -1 |
David Majnemer | af9180f | 2014-07-14 20:38:45 +0000 | [diff] [blame] | 1071 | %cmp = icmp ne i64 %div, 1073741824 |
| 1072 | ret i1 %cmp |
| 1073 | |
| 1074 | ; CHECK-LABEL: @icmp_sdiv_neg1 |
| 1075 | ; CHECK-NEXT: [[DIV:%.*]] = sdiv i64 %a, -1 |
| 1076 | ; CHECK-NEXT: [[CMP:%.*]] = icmp ne i64 [[DIV]], 1073741824 |
| 1077 | ; CHECK-NEXT: ret i1 [[CMP]] |
| 1078 | } |
David Majnemer | 97ddca3 | 2014-08-22 00:40:43 +0000 | [diff] [blame] | 1079 | |
| 1080 | define i1 @icmp_known_bits(i4 %x, i4 %y) { |
| 1081 | %and1 = and i4 %y, -7 |
| 1082 | %and2 = and i4 %x, -7 |
| 1083 | %or1 = or i4 %and1, 2 |
| 1084 | %or2 = or i4 %and2, 2 |
| 1085 | %add = add i4 %or1, %or2 |
| 1086 | %cmp = icmp eq i4 %add, 0 |
| 1087 | ret i1 %cmp |
| 1088 | |
| 1089 | ; CHECK-LABEL: @icmp_known_bits |
| 1090 | ; CHECK-NEXT: ret i1 false |
| 1091 | } |
David Majnemer | d6d1671 | 2014-08-27 18:03:46 +0000 | [diff] [blame] | 1092 | |
| 1093 | define i1 @icmp_shl_nuw_1(i64 %a) { |
| 1094 | %shl = shl nuw i64 1, %a |
| 1095 | %cmp = icmp ne i64 %shl, 0 |
| 1096 | ret i1 %cmp |
| 1097 | |
| 1098 | ; CHECK-LABEL: @icmp_shl_nuw_1 |
| 1099 | ; CHECK-NEXT: ret i1 true |
| 1100 | } |
| 1101 | |
| 1102 | define i1 @icmp_shl_nsw_neg1(i64 %a) { |
| 1103 | %shl = shl nsw i64 -1, %a |
| 1104 | %cmp = icmp sge i64 %shl, 3 |
| 1105 | ret i1 %cmp |
| 1106 | |
| 1107 | ; CHECK-LABEL: @icmp_shl_nsw_neg1 |
| 1108 | ; CHECK-NEXT: ret i1 false |
| 1109 | } |
| 1110 | |
| 1111 | define i1 @icmp_shl_nsw_1(i64 %a) { |
| 1112 | %shl = shl nsw i64 1, %a |
| 1113 | %cmp = icmp sge i64 %shl, 0 |
| 1114 | ret i1 %cmp |
| 1115 | |
| 1116 | ; CHECK-LABEL: @icmp_shl_nsw_1 |
| 1117 | ; CHECK-NEXT: ret i1 true |
| 1118 | } |
David Majnemer | 76d06bc | 2014-08-28 03:34:28 +0000 | [diff] [blame] | 1119 | |
| 1120 | define i1 @icmp_shl_1_V_ugt_2147483648(i32 %V) { |
| 1121 | %shl = shl i32 1, %V |
| 1122 | %cmp = icmp ugt i32 %shl, 2147483648 |
| 1123 | ret i1 %cmp |
| 1124 | |
| 1125 | ; CHECK-LABEL: @icmp_shl_1_V_ugt_2147483648( |
| 1126 | ; CHECK-NEXT: ret i1 false |
| 1127 | } |
| 1128 | |
| 1129 | define i1 @icmp_shl_1_V_ule_2147483648(i32 %V) { |
| 1130 | %shl = shl i32 1, %V |
| 1131 | %cmp = icmp ule i32 %shl, 2147483648 |
| 1132 | ret i1 %cmp |
| 1133 | |
| 1134 | ; CHECK-LABEL: @icmp_shl_1_V_ule_2147483648( |
| 1135 | ; CHECK-NEXT: ret i1 true |
| 1136 | } |
| 1137 | |
| 1138 | define i1 @icmp_shl_1_V_eq_31(i32 %V) { |
| 1139 | %shl = shl i32 1, %V |
| 1140 | %cmp = icmp eq i32 %shl, 31 |
| 1141 | ret i1 %cmp |
| 1142 | |
| 1143 | ; CHECK-LABEL: @icmp_shl_1_V_eq_31( |
| 1144 | ; CHECK-NEXT: ret i1 false |
| 1145 | } |
| 1146 | |
| 1147 | define i1 @icmp_shl_1_V_ne_31(i32 %V) { |
| 1148 | %shl = shl i32 1, %V |
| 1149 | %cmp = icmp ne i32 %shl, 31 |
| 1150 | ret i1 %cmp |
| 1151 | |
| 1152 | ; CHECK-LABEL: @icmp_shl_1_V_ne_31( |
| 1153 | ; CHECK-NEXT: ret i1 true |
| 1154 | } |
David Majnemer | bd9ce4e | 2014-11-25 02:55:48 +0000 | [diff] [blame] | 1155 | |
| 1156 | define i1 @tautological1(i32 %A, i32 %B) { |
| 1157 | %C = and i32 %A, %B |
| 1158 | %D = icmp ugt i32 %C, %A |
| 1159 | ret i1 %D |
| 1160 | ; CHECK-LABEL: @tautological1( |
| 1161 | ; CHECK: ret i1 false |
| 1162 | } |
| 1163 | |
| 1164 | define i1 @tautological2(i32 %A, i32 %B) { |
| 1165 | %C = and i32 %A, %B |
| 1166 | %D = icmp ule i32 %C, %A |
| 1167 | ret i1 %D |
| 1168 | ; CHECK-LABEL: @tautological2( |
| 1169 | ; CHECK: ret i1 true |
| 1170 | } |
| 1171 | |
| 1172 | define i1 @tautological3(i32 %A, i32 %B) { |
| 1173 | %C = or i32 %A, %B |
| 1174 | %D = icmp ule i32 %A, %C |
| 1175 | ret i1 %D |
| 1176 | ; CHECK-LABEL: @tautological3( |
| 1177 | ; CHECK: ret i1 true |
| 1178 | } |
| 1179 | |
| 1180 | define i1 @tautological4(i32 %A, i32 %B) { |
| 1181 | %C = or i32 %A, %B |
| 1182 | %D = icmp ugt i32 %A, %C |
| 1183 | ret i1 %D |
| 1184 | ; CHECK-LABEL: @tautological4( |
| 1185 | ; CHECK: ret i1 false |
| 1186 | } |
| 1187 | |
| 1188 | define i1 @tautological5(i32 %A, i32 %B) { |
| 1189 | %C = or i32 %A, %B |
| 1190 | %D = icmp ult i32 %C, %A |
| 1191 | ret i1 %D |
| 1192 | ; CHECK-LABEL: @tautological5( |
| 1193 | ; CHECK: ret i1 false |
| 1194 | } |
| 1195 | |
| 1196 | define i1 @tautological6(i32 %A, i32 %B) { |
| 1197 | %C = or i32 %A, %B |
| 1198 | %D = icmp uge i32 %C, %A |
| 1199 | ret i1 %D |
| 1200 | ; CHECK-LABEL: @tautological6( |
| 1201 | ; CHECK: ret i1 true |
| 1202 | } |
| 1203 | |
| 1204 | define i1 @tautological7(i32 %A, i32 %B) { |
| 1205 | %C = and i32 %A, %B |
| 1206 | %D = icmp uge i32 %A, %C |
| 1207 | ret i1 %D |
| 1208 | ; CHECK-LABEL: @tautological7( |
| 1209 | ; CHECK: ret i1 true |
| 1210 | } |
| 1211 | |
| 1212 | define i1 @tautological8(i32 %A, i32 %B) { |
| 1213 | %C = and i32 %A, %B |
| 1214 | %D = icmp ult i32 %A, %C |
| 1215 | ret i1 %D |
| 1216 | ; CHECK-LABEL: @tautological8( |
| 1217 | ; CHECK: ret i1 false |
| 1218 | } |
David Majnemer | 2df38cd | 2015-08-20 23:01:41 +0000 | [diff] [blame] | 1219 | |
| 1220 | define i1 @tautological9(i32 %x) { |
| 1221 | %add = add nuw i32 %x, 13 |
| 1222 | %cmp = icmp ne i32 %add, 12 |
| 1223 | ret i1 %cmp |
| 1224 | ; CHECK-LABEL: @tautological9( |
| 1225 | ; CHECK: ret i1 true |
| 1226 | } |
Nick Lewycky | 762f8a8 | 2016-04-21 00:53:14 +0000 | [diff] [blame] | 1227 | |
| 1228 | declare void @helper_i1(i1) |
| 1229 | ; Series of tests for icmp s[lt|ge] (or A, B), A and icmp s[gt|le] A, (or A, B) |
| 1230 | define void @icmp_slt_sge_or(i32 %Ax, i32 %Bx) { |
| 1231 | ; 'p' for positive, 'n' for negative, 'x' for potentially either. |
| 1232 | ; %D is 'icmp slt (or A, B), A' |
| 1233 | ; %E is 'icmp sge (or A, B), A' making it the not of %D |
| 1234 | ; %F is 'icmp sgt A, (or A, B)' making it the same as %D |
| 1235 | ; %G is 'icmp sle A, (or A, B)' making it the not of %D |
| 1236 | %Aneg = or i32 %Ax, 2147483648 |
| 1237 | %Apos = and i32 %Ax, 2147483647 |
| 1238 | %Bneg = or i32 %Bx, 2147483648 |
| 1239 | %Bpos = and i32 %Bx, 2147483647 |
| 1240 | |
| 1241 | %Cpp = or i32 %Apos, %Bpos |
| 1242 | %Dpp = icmp slt i32 %Cpp, %Apos |
| 1243 | %Epp = icmp sge i32 %Cpp, %Apos |
| 1244 | %Fpp = icmp sgt i32 %Apos, %Cpp |
| 1245 | %Gpp = icmp sle i32 %Apos, %Cpp |
| 1246 | %Cpx = or i32 %Apos, %Bx |
| 1247 | %Dpx = icmp slt i32 %Cpx, %Apos |
| 1248 | %Epx = icmp sge i32 %Cpx, %Apos |
| 1249 | %Fpx = icmp sgt i32 %Apos, %Cpx |
| 1250 | %Gpx = icmp sle i32 %Apos, %Cpx |
| 1251 | %Cpn = or i32 %Apos, %Bneg |
| 1252 | %Dpn = icmp slt i32 %Cpn, %Apos |
| 1253 | %Epn = icmp sge i32 %Cpn, %Apos |
| 1254 | %Fpn = icmp sgt i32 %Apos, %Cpn |
| 1255 | %Gpn = icmp sle i32 %Apos, %Cpn |
| 1256 | |
| 1257 | %Cxp = or i32 %Ax, %Bpos |
| 1258 | %Dxp = icmp slt i32 %Cxp, %Ax |
| 1259 | %Exp = icmp sge i32 %Cxp, %Ax |
| 1260 | %Fxp = icmp sgt i32 %Ax, %Cxp |
| 1261 | %Gxp = icmp sle i32 %Ax, %Cxp |
| 1262 | %Cxx = or i32 %Ax, %Bx |
| 1263 | %Dxx = icmp slt i32 %Cxx, %Ax |
| 1264 | %Exx = icmp sge i32 %Cxx, %Ax |
| 1265 | %Fxx = icmp sgt i32 %Ax, %Cxx |
| 1266 | %Gxx = icmp sle i32 %Ax, %Cxx |
| 1267 | %Cxn = or i32 %Ax, %Bneg |
| 1268 | %Dxn = icmp slt i32 %Cxn, %Ax |
| 1269 | %Exn = icmp sge i32 %Cxn, %Ax |
| 1270 | %Fxn = icmp sgt i32 %Ax, %Cxn |
| 1271 | %Gxn = icmp sle i32 %Ax, %Cxn |
| 1272 | |
| 1273 | %Cnp = or i32 %Aneg, %Bpos |
| 1274 | %Dnp = icmp slt i32 %Cnp, %Aneg |
| 1275 | %Enp = icmp sge i32 %Cnp, %Aneg |
| 1276 | %Fnp = icmp sgt i32 %Aneg, %Cnp |
| 1277 | %Gnp = icmp sle i32 %Aneg, %Cnp |
| 1278 | %Cnx = or i32 %Aneg, %Bx |
| 1279 | %Dnx = icmp slt i32 %Cnx, %Aneg |
| 1280 | %Enx = icmp sge i32 %Cnx, %Aneg |
| 1281 | %Fnx = icmp sgt i32 %Aneg, %Cnx |
| 1282 | %Gnx = icmp sle i32 %Aneg, %Cnx |
| 1283 | %Cnn = or i32 %Aneg, %Bneg |
| 1284 | %Dnn = icmp slt i32 %Cnn, %Aneg |
| 1285 | %Enn = icmp sge i32 %Cnn, %Aneg |
| 1286 | %Fnn = icmp sgt i32 %Aneg, %Cnn |
| 1287 | %Gnn = icmp sle i32 %Aneg, %Cnn |
| 1288 | |
| 1289 | call void @helper_i1(i1 %Dpp) |
| 1290 | call void @helper_i1(i1 %Epp) |
| 1291 | call void @helper_i1(i1 %Fpp) |
| 1292 | call void @helper_i1(i1 %Gpp) |
| 1293 | call void @helper_i1(i1 %Dpx) |
| 1294 | call void @helper_i1(i1 %Epx) |
| 1295 | call void @helper_i1(i1 %Fpx) |
| 1296 | call void @helper_i1(i1 %Gpx) |
| 1297 | call void @helper_i1(i1 %Dpn) |
| 1298 | call void @helper_i1(i1 %Epn) |
| 1299 | call void @helper_i1(i1 %Fpn) |
| 1300 | call void @helper_i1(i1 %Gpn) |
| 1301 | call void @helper_i1(i1 %Dxp) |
| 1302 | call void @helper_i1(i1 %Exp) |
| 1303 | call void @helper_i1(i1 %Fxp) |
| 1304 | call void @helper_i1(i1 %Gxp) |
| 1305 | call void @helper_i1(i1 %Dxx) |
| 1306 | call void @helper_i1(i1 %Exx) |
| 1307 | call void @helper_i1(i1 %Fxx) |
| 1308 | call void @helper_i1(i1 %Gxx) |
| 1309 | call void @helper_i1(i1 %Dxn) |
| 1310 | call void @helper_i1(i1 %Exn) |
| 1311 | call void @helper_i1(i1 %Fxn) |
| 1312 | call void @helper_i1(i1 %Gxn) |
| 1313 | call void @helper_i1(i1 %Dnp) |
| 1314 | call void @helper_i1(i1 %Enp) |
| 1315 | call void @helper_i1(i1 %Fnp) |
| 1316 | call void @helper_i1(i1 %Gnp) |
| 1317 | call void @helper_i1(i1 %Dnx) |
| 1318 | call void @helper_i1(i1 %Enx) |
| 1319 | call void @helper_i1(i1 %Fnx) |
| 1320 | call void @helper_i1(i1 %Gnx) |
| 1321 | call void @helper_i1(i1 %Dnn) |
| 1322 | call void @helper_i1(i1 %Enn) |
| 1323 | call void @helper_i1(i1 %Fnn) |
| 1324 | call void @helper_i1(i1 %Gnn) |
| 1325 | ; CHECK-LABEL: @icmp_slt_sge_or |
| 1326 | ; CHECK: call void @helper_i1(i1 false) |
| 1327 | ; CHECK: call void @helper_i1(i1 true) |
| 1328 | ; CHECK: call void @helper_i1(i1 false) |
| 1329 | ; CHECK: call void @helper_i1(i1 true) |
| 1330 | ; CHECK: call void @helper_i1(i1 %Dpx) |
| 1331 | ; CHECK: call void @helper_i1(i1 %Epx) |
| 1332 | ; CHECK: call void @helper_i1(i1 %Fpx) |
| 1333 | ; CHECK: call void @helper_i1(i1 %Gpx) |
| 1334 | ; CHECK: call void @helper_i1(i1 true) |
| 1335 | ; CHECK: call void @helper_i1(i1 false) |
| 1336 | ; CHECK: call void @helper_i1(i1 true) |
| 1337 | ; CHECK: call void @helper_i1(i1 false) |
| 1338 | ; CHECK: call void @helper_i1(i1 false) |
| 1339 | ; CHECK: call void @helper_i1(i1 true) |
| 1340 | ; CHECK: call void @helper_i1(i1 false) |
| 1341 | ; CHECK: call void @helper_i1(i1 true) |
| 1342 | ; CHECK: call void @helper_i1(i1 %Dxx) |
| 1343 | ; CHECK: call void @helper_i1(i1 %Exx) |
| 1344 | ; CHECK: call void @helper_i1(i1 %Fxx) |
| 1345 | ; CHECK: call void @helper_i1(i1 %Gxx) |
| 1346 | ; CHECK: call void @helper_i1(i1 %Dxn) |
| 1347 | ; CHECK: call void @helper_i1(i1 %Exn) |
| 1348 | ; CHECK: call void @helper_i1(i1 %Fxn) |
| 1349 | ; CHECK: call void @helper_i1(i1 %Gxn) |
| 1350 | ; CHECK: call void @helper_i1(i1 false) |
| 1351 | ; CHECK: call void @helper_i1(i1 true) |
| 1352 | ; CHECK: call void @helper_i1(i1 false) |
| 1353 | ; CHECK: call void @helper_i1(i1 true) |
| 1354 | ; CHECK: call void @helper_i1(i1 false) |
| 1355 | ; CHECK: call void @helper_i1(i1 true) |
| 1356 | ; CHECK: call void @helper_i1(i1 false) |
| 1357 | ; CHECK: call void @helper_i1(i1 true) |
| 1358 | ; CHECK: call void @helper_i1(i1 false) |
| 1359 | ; CHECK: call void @helper_i1(i1 true) |
| 1360 | ; CHECK: call void @helper_i1(i1 false) |
| 1361 | ; CHECK: call void @helper_i1(i1 true) |
| 1362 | ret void |
| 1363 | } |