1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
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: @constant_and_undef(
9 ; CHECK-NEXT: [[C_1:%.*]] = call i1 @f1(i64 undef)
10 ; CHECK-NEXT: br label [[BB1:%.*]]
12 ; CHECK-NEXT: [[C_2:%.*]] = call i1 @f1(i64 10)
13 ; CHECK-NEXT: br label [[BB2:%.*]]
15 ; CHECK-NEXT: [[RANGE:%.*]] = and i64 [[A:%.*]], 255
16 ; CHECK-NEXT: [[C_3:%.*]] = call i1 @f1(i64 [[RANGE]])
17 ; CHECK-NEXT: ret i1 true
19 %c.1 = call i1 @f1(i64 undef)
23 %c.2 = call i1 @f1(i64 10)
27 %range = and i64 %a, 255
28 %c.3 = call i1 @f1(i64 %range)
29 %r.1 = and i1 %c.1, %c.2
30 %r.2 = and i1 %r.1, %c.3
34 declare void @sideeffect(i1, i64 %a)
36 define internal i1 @f1(i64 %r) {
37 ; CHECK-LABEL: define {{.*}} @f1(
38 ; CHECK-NEXT: call void @sideeffect(i1 true, i64 [[R:%.*]])
39 ; CHECK-NEXT: ret i1 undef
41 %c = icmp ult i64 %r, 256
42 call void @sideeffect(i1 %c, i64 %r)