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 3 4; Make sure IPSCCP does not assume %r < 256 for @f1. Undef is passed at a call 5; site, which won't be eliminated. 6 7define 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:.*]] 12; CHECK: [[BB1]]: 13; CHECK-NEXT: [[C_2:%.*]] = call i1 @f1(i64 10) 14; CHECK-NEXT: br label %[[BB2:.*]] 15; CHECK: [[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 19; 20 %c.1 = call i1 @f1(i64 undef) 21 br label %bb1 22 23bb1: 24 %c.2 = call i1 @f1(i64 10) 25 br label %bb2 26 27bb2: 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 32 ret i1 %r.2 33} 34 35declare void @sideeffect(i1, i64 %a) 36 37define 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 42; 43 %c = icmp ult i64 %r, 256 44 call void @sideeffect(i1 %c, i64 %r) 45 ret i1 %c 46} 47