1 ; NOTE: Assertions have been autogenerated by update_test_checks.py 2 ; RUN: opt -instsimplify -S < %s | FileCheck %s 3 4 define i64 @test0() { 5 ; CHECK-LABEL: @test0( 6 ; CHECK: ret i64 undef 7 ; 8 %r = mul i64 undef, undef 9 ret i64 %r 10 } 11 12 define i64 @test1() { 13 ; CHECK-LABEL: @test1( 14 ; CHECK: ret i64 undef 15 ; 16 %r = mul i64 3, undef 17 ret i64 %r 18 } 19 20 define i64 @test2() { 21 ; CHECK-LABEL: @test2( 22 ; CHECK: ret i64 undef 23 ; 24 %r = mul i64 undef, 3 25 ret i64 %r 26 } 27 28 define i64 @test3() { 29 ; CHECK-LABEL: @test3( 30 ; CHECK: ret i64 0 31 ; 32 %r = mul i64 undef, 6 33 ret i64 %r 34 } 35 36 define i64 @test4() { 37 ; CHECK-LABEL: @test4( 38 ; CHECK: ret i64 0 39 ; 40 %r = mul i64 6, undef 41 ret i64 %r 42 } 43 44 define i64 @test5() { 45 ; CHECK-LABEL: @test5( 46 ; CHECK: ret i64 undef 47 ; 48 %r = and i64 undef, undef 49 ret i64 %r 50 } 51 52 define i64 @test6() { 53 ; CHECK-LABEL: @test6( 54 ; CHECK: ret i64 undef 55 ; 56 %r = or i64 undef, undef 57 ret i64 %r 58 } 59 60 define i64 @test7() { 61 ; CHECK-LABEL: @test7( 62 ; CHECK: ret i64 undef 63 ; 64 %r = udiv i64 undef, 1 65 ret i64 %r 66 } 67 68 define i64 @test8() { 69 ; CHECK-LABEL: @test8( 70 ; CHECK: ret i64 undef 71 ; 72 %r = sdiv i64 undef, 1 73 ret i64 %r 74 } 75 76 define i64 @test9() { 77 ; CHECK-LABEL: @test9( 78 ; CHECK: ret i64 0 79 ; 80 %r = urem i64 undef, 1 81 ret i64 %r 82 } 83 84 define i64 @test10() { 85 ; CHECK-LABEL: @test10( 86 ; CHECK: ret i64 0 87 ; 88 %r = srem i64 undef, 1 89 ret i64 %r 90 } 91 92 define i64 @test11() { 93 ; CHECK-LABEL: @test11( 94 ; CHECK: ret i64 undef 95 ; 96 %r = shl i64 undef, undef 97 ret i64 %r 98 } 99 100 define i64 @test11b(i64 %a) { 101 ; CHECK-LABEL: @test11b( 102 ; CHECK: ret i64 undef 103 ; 104 %r = shl i64 %a, undef 105 ret i64 %r 106 } 107 108 define i64 @test12() { 109 ; CHECK-LABEL: @test12( 110 ; CHECK: ret i64 undef 111 ; 112 %r = ashr i64 undef, undef 113 ret i64 %r 114 } 115 116 define i64 @test12b(i64 %a) { 117 ; CHECK-LABEL: @test12b( 118 ; CHECK: ret i64 undef 119 ; 120 %r = ashr i64 %a, undef 121 ret i64 %r 122 } 123 124 define i64 @test13() { 125 ; CHECK-LABEL: @test13( 126 ; CHECK: ret i64 undef 127 ; 128 %r = lshr i64 undef, undef 129 ret i64 %r 130 } 131 132 define i64 @test13b(i64 %a) { 133 ; CHECK-LABEL: @test13b( 134 ; CHECK: ret i64 undef 135 ; 136 %r = lshr i64 %a, undef 137 ret i64 %r 138 } 139 140 define i1 @test14() { 141 ; CHECK-LABEL: @test14( 142 ; CHECK: ret i1 undef 143 ; 144 %r = icmp slt i64 undef, undef 145 ret i1 %r 146 } 147 148 define i1 @test15() { 149 ; CHECK-LABEL: @test15( 150 ; CHECK: ret i1 undef 151 ; 152 %r = icmp ult i64 undef, undef 153 ret i1 %r 154 } 155 156 define i64 @test16(i64 %a) { 157 ; CHECK-LABEL: @test16( 158 ; CHECK: ret i64 undef 159 ; 160 %r = select i1 undef, i64 %a, i64 undef 161 ret i64 %r 162 } 163 164 define i64 @test17(i64 %a) { 165 ; CHECK-LABEL: @test17( 166 ; CHECK: ret i64 undef 167 ; 168 %r = select i1 undef, i64 undef, i64 %a 169 ret i64 %r 170 } 171 172 define i64 @test18(i64 %a) { 173 ; CHECK-LABEL: @test18( 174 ; CHECK: [[R:%.*]] = call i64 undef(i64 %a) 175 ; CHECK-NEXT: ret i64 undef 176 ; 177 %r = call i64 (i64) undef(i64 %a) 178 ret i64 %r 179 } 180 181 define <4 x i8> @test19(<4 x i8> %a) { 182 ; CHECK-LABEL: @test19( 183 ; CHECK: ret <4 x i8> undef 184 ; 185 %b = shl <4 x i8> %a, <i8 8, i8 9, i8 undef, i8 -1> 186 ret <4 x i8> %b 187 } 188 189 define i32 @test20(i32 %a) { 190 ; CHECK-LABEL: @test20( 191 ; CHECK: ret i32 undef 192 ; 193 %b = udiv i32 %a, 0 194 ret i32 %b 195 } 196 197 define i32 @test21(i32 %a) { 198 ; CHECK-LABEL: @test21( 199 ; CHECK: ret i32 undef 200 ; 201 %b = sdiv i32 %a, 0 202 ret i32 %b 203 } 204 205 define i32 @test22(i32 %a) { 206 ; CHECK-LABEL: @test22( 207 ; CHECK: ret i32 undef 208 ; 209 %b = ashr exact i32 undef, %a 210 ret i32 %b 211 } 212 213 define i32 @test23(i32 %a) { 214 ; CHECK-LABEL: @test23( 215 ; CHECK: ret i32 undef 216 ; 217 %b = lshr exact i32 undef, %a 218 ret i32 %b 219 } 220 221 define i32 @test24() { 222 ; CHECK-LABEL: @test24( 223 ; CHECK: ret i32 undef 224 ; 225 %b = udiv i32 undef, 0 226 ret i32 %b 227 } 228 229 define i32 @test25() { 230 ; CHECK-LABEL: @test25( 231 ; CHECK: ret i32 undef 232 ; 233 %b = lshr i32 0, undef 234 ret i32 %b 235 } 236 237 define i32 @test26() { 238 ; CHECK-LABEL: @test26( 239 ; CHECK: ret i32 undef 240 ; 241 %b = ashr i32 0, undef 242 ret i32 %b 243 } 244 245 define i32 @test27() { 246 ; CHECK-LABEL: @test27( 247 ; CHECK: ret i32 undef 248 ; 249 %b = shl i32 0, undef 250 ret i32 %b 251 } 252 253 define i32 @test28(i32 %a) { 254 ; CHECK-LABEL: @test28( 255 ; CHECK: ret i32 undef 256 ; 257 %b = shl nsw i32 undef, %a 258 ret i32 %b 259 } 260 261 define i32 @test29(i32 %a) { 262 ; CHECK-LABEL: @test29( 263 ; CHECK: ret i32 undef 264 ; 265 %b = shl nuw i32 undef, %a 266 ret i32 %b 267 } 268 269 define i32 @test30(i32 %a) { 270 ; CHECK-LABEL: @test30( 271 ; CHECK: ret i32 undef 272 ; 273 %b = shl nsw nuw i32 undef, %a 274 ret i32 %b 275 } 276 277 define i32 @test31(i32 %a) { 278 ; CHECK-LABEL: @test31( 279 ; CHECK: ret i32 0 280 ; 281 %b = shl i32 undef, %a 282 ret i32 %b 283 } 284 285 define i32 @test32(i32 %a) { 286 ; CHECK-LABEL: @test32( 287 ; CHECK: ret i32 undef 288 ; 289 %b = shl i32 undef, 0 290 ret i32 %b 291 } 292 293 define i32 @test33(i32 %a) { 294 ; CHECK-LABEL: @test33( 295 ; CHECK: ret i32 undef 296 ; 297 %b = ashr i32 undef, 0 298 ret i32 %b 299 } 300 301 define i32 @test34(i32 %a) { 302 ; CHECK-LABEL: @test34( 303 ; CHECK: ret i32 undef 304 ; 305 %b = lshr i32 undef, 0 306 ret i32 %b 307 } 308 309 define i32 @test35(<4 x i32> %V) { 310 ; CHECK-LABEL: @test35( 311 ; CHECK: ret i32 undef 312 ; 313 %b = extractelement <4 x i32> %V, i32 4 314 ret i32 %b 315 } 316 317 define i32 @test36(i32 %V) { 318 ; CHECK-LABEL: @test36( 319 ; CHECK: ret i32 undef 320 ; 321 %b = extractelement <4 x i32> undef, i32 %V 322 ret i32 %b 323 } 324 325 define i32 @test37() { 326 ; CHECK-LABEL: @test37( 327 ; CHECK: ret i32 undef 328 ; 329 %b = udiv i32 undef, undef 330 ret i32 %b 331 } 332 333 define i32 @test38(i32 %a) { 334 ; CHECK-LABEL: @test38( 335 ; CHECK: ret i32 undef 336 ; 337 %b = udiv i32 %a, undef 338 ret i32 %b 339 } 340 341 define i32 @test39() { 342 ; CHECK-LABEL: @test39( 343 ; CHECK: ret i32 undef 344 ; 345 %b = udiv i32 0, undef 346 ret i32 %b 347 } 348