1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
2 ; RUN: opt < %s -passes=sccp -S | FileCheck %s
4 define i32 @test1(i1 %C) {
5 ; CHECK-LABEL: define i32 @test1(
6 ; CHECK-SAME: i1 [[C:%.*]]) {
7 ; CHECK-NEXT: ret i32 0
9 %X = select i1 %C, i32 0, i32 0
13 define i32 @test2(i1 %C) {
14 ; CHECK-LABEL: define i32 @test2(
15 ; CHECK-SAME: i1 [[C:%.*]]) {
16 ; CHECK-NEXT: ret i32 0
18 %X = select i1 %C, i32 0, i32 undef
22 define i1 @f2(i32 %x, i1 %cmp) {
23 ; CHECK-LABEL: define i1 @f2(
24 ; CHECK-SAME: i32 [[X:%.*]], i1 [[CMP:%.*]]) {
25 ; CHECK-NEXT: [[SEL_1:%.*]] = select i1 [[CMP]], i32 [[X]], i32 10
26 ; CHECK-NEXT: [[C_1:%.*]] = icmp sgt i32 [[SEL_1]], 300
27 ; CHECK-NEXT: [[C_2:%.*]] = icmp sgt i32 [[SEL_1]], 100
28 ; CHECK-NEXT: [[C_3:%.*]] = icmp eq i32 [[SEL_1]], 50
29 ; CHECK-NEXT: [[C_4:%.*]] = icmp slt i32 [[SEL_1]], 9
30 ; CHECK-NEXT: [[RES_1:%.*]] = add i1 [[C_1]], [[C_2]]
31 ; CHECK-NEXT: [[RES_2:%.*]] = add i1 [[RES_1]], [[C_3]]
32 ; CHECK-NEXT: [[RES_3:%.*]] = add i1 [[RES_2]], [[C_4]]
33 ; CHECK-NEXT: ret i1 [[RES_3]]
35 %sel.1 = select i1 %cmp, i32 %x, i32 10
36 %c.1 = icmp sgt i32 %sel.1, 300
37 %c.2 = icmp sgt i32 %sel.1, 100
38 %c.3 = icmp eq i32 %sel.1, 50
39 %c.4 = icmp slt i32 %sel.1, 9
40 %res.1 = add i1 %c.1, %c.2
41 %res.2 = add i1 %res.1, %c.3
42 %res.3 = add i1 %res.2, %c.4