1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=lower-switch -S | FileCheck %s
4 define i64 @f(i1 %bool, i128 %i128) {
7 ; CHECK-NEXT: br label [[NODEBLOCK1:%.*]]
9 ; CHECK-NEXT: [[PIVOT2:%.*]] = icmp slt i128 [[I128:%.*]], 16201310291018008446
10 ; CHECK-NEXT: br i1 [[PIVOT2]], label [[LEAFBLOCK:%.*]], label [[NODEBLOCK:%.*]]
12 ; CHECK-NEXT: [[PIVOT:%.*]] = icmp slt i128 [[I128]], 16201310291018008447
13 ; CHECK-NEXT: br i1 [[PIVOT]], label [[SW_C3:%.*]], label [[SW_C2:%.*]]
15 ; CHECK-NEXT: [[SWITCHLEAF:%.*]] = icmp eq i128 [[I128]], 16201310291018008445
16 ; CHECK-NEXT: br i1 [[SWITCHLEAF]], label [[SW_C4:%.*]], label [[SW_C1:%.*]]
18 ; CHECK-NEXT: unreachable
20 ; CHECK-NEXT: br i1 [[BOOL:%.*]], label [[BB1:%.*]], label [[SW_C1]]
22 ; CHECK-NEXT: ret i64 0
24 ; CHECK-NEXT: ret i64 1
26 ; CHECK-NEXT: ret i64 2
29 switch i128 %i128, label %BB1 [
30 i128 627, label %SW_C1
31 i128 16201310291018008447, label %SW_C2
32 i128 16201310291018008446, label %SW_C3
33 i128 16201310291018008445, label %SW_C4
36 BB1: ; preds = %SW_C1, %BB
39 SW_C1: ; preds = %SW_C1, %BB
40 br i1 %bool, label %BB1, label %SW_C1
52 define i64 @f_empty(i1 %bool, i128 %i128) {
53 ; CHECK-LABEL: @f_empty(
55 ; CHECK-NEXT: br label [[BB1:%.*]]
57 ; CHECK-NEXT: unreachable
60 switch i128 %i128, label %BB1 []
68 switch i1 false, label %sw.bb [
69 i1 false, label %sw.bb12
72 sw.bb: ; preds = %entry
75 sw.bb12: ; preds = %entry
79 define void @f_i2(i2 %cond) {
81 switch i2 %cond, label %sw.bb [
88 sw.bb: ; preds = %entry
91 sw.bb12: ; preds = %entry