1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
2 ; RUN: opt -S -passes=ipsccp %s | FileCheck %s
4 ; Make sure IPSCCP does not assume %r < 256 for @f1. Undef is passed at a call
5 ; site, which won't be eliminated.
7 define i1 @constant_and_undef(i64 %a) {
8 ; CHECK-LABEL: define i1 @constant_and_undef(
9 ; CHECK-SAME: i64 [[A:%.*]]) {
10 ; CHECK-NEXT: [[C_1:%.*]] = call i1 @f1(i64 undef)
11 ; CHECK-NEXT: br label %[[BB1:.*]]
13 ; CHECK-NEXT: [[C_2:%.*]] = call i1 @f1(i64 10)
14 ; CHECK-NEXT: br label %[[BB2:.*]]
16 ; CHECK-NEXT: [[RANGE:%.*]] = and i64 [[A]], 255
17 ; CHECK-NEXT: [[C_3:%.*]] = call i1 @f1(i64 [[RANGE]])
18 ; CHECK-NEXT: ret i1 true
20 %c.1 = call i1 @f1(i64 undef)
24 %c.2 = call i1 @f1(i64 10)
28 %range = and i64 %a, 255
29 %c.3 = call i1 @f1(i64 %range)
30 %r.1 = and i1 %c.1, %c.2
31 %r.2 = and i1 %r.1, %c.3
35 declare void @sideeffect(i1, i64 %a)
37 define internal i1 @f1(i64 %r) {
38 ; CHECK-LABEL: define internal i1 @f1(
39 ; CHECK-SAME: i64 [[R:%.*]]) {
40 ; CHECK-NEXT: call void @sideeffect(i1 true, i64 [[R]])
41 ; CHECK-NEXT: ret i1 poison
43 %c = icmp ult i64 %r, 256
44 call void @sideeffect(i1 %c, i64 %r)