1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -S | FileCheck %s
4 define i32 @func(i32 %x) {
6 ; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i32 [[X:.*]], 0
7 ; CHECK-NEXT: [[TMP2:%.*]] = call i32 @foo(i1 [[TMP1]])
8 ; CHECK-NEXT: [[TMP3:%.*]] = icmp eq i32 [[X]], 1
9 ; CHECK-NEXT: [[TMP4:%.*]] = call i32 @foo(i1 [[TMP3]])
10 ; CHECK-NEXT: [[TMP5:%.*]] = icmp ne i32 [[TMP4]], 0
11 ; CHECK-NEXT: [[TMP6:%.*]] = select i1 [[TMP5]], i32 [[TMP4]], i32 [[TMP2]]
12 ; CHECK-NEXT: [[TMP7:%.*]] = icmp eq i32 [[X]], 2
13 ; CHECK-NEXT: [[TMP8:%.*]] = call i32 @foo(i1 [[TMP7]])
14 ; CHECK-NEXT: [[TMP9:%.*]] = icmp ne i32 [[TMP8]], 0
15 ; CHECK-NEXT: [[TMP10:%.*]] = select i1 [[TMP9]], i32 [[TMP8]], i32 [[TMP6]]
16 ; CHECK-NEXT: ret i32 [[TMP10]]
18 %1 = icmp eq i32 %x, 0
19 %2 = call i32 @foo(i1 %1)
21 %3 = icmp eq i32 %x, 2
22 %4 = call i32 @foo(i1 %3)
23 %5 = icmp ne i32 %4, 0
24 %6 = select i1 %5, i32 %4, i32 %2