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