1 ; RUN: opt < %s -lowerswitch -S | FileCheck %s
3 ; We have switch on input.
4 ; On output we should got binary comparison tree. Check that all is fine.
7 ;CHECK-NEXT: br label %NodeBlock19
9 ;CHECK: NodeBlock19: ; preds = %entry
10 ;CHECK-NEXT: %Pivot20 = icmp slt i32 %tmp158, 10
11 ;CHECK-NEXT: br i1 %Pivot20, label %NodeBlock5, label %NodeBlock17
13 ;CHECK: NodeBlock17: ; preds = %NodeBlock19
14 ;CHECK-NEXT: %Pivot18 = icmp slt i32 %tmp158, 13
15 ;CHECK-NEXT: br i1 %Pivot18, label %NodeBlock9, label %NodeBlock15
17 ;CHECK: NodeBlock15: ; preds = %NodeBlock17
18 ;CHECK-NEXT: %Pivot16 = icmp slt i32 %tmp158, 14
19 ;CHECK-NEXT: br i1 %Pivot16, label %bb330, label %NodeBlock13
21 ;CHECK: NodeBlock13: ; preds = %NodeBlock15
22 ;CHECK-NEXT: %Pivot14 = icmp slt i32 %tmp158, 15
23 ;CHECK-NEXT: br i1 %Pivot14, label %bb332, label %LeafBlock11
25 ;CHECK: LeafBlock11: ; preds = %NodeBlock13
26 ;CHECK-NEXT: %SwitchLeaf12 = icmp eq i32 %tmp158, 15
27 ;CHECK-NEXT: br i1 %SwitchLeaf12, label %bb334, label %NewDefault
29 ;CHECK: NodeBlock9: ; preds = %NodeBlock17
30 ;CHECK-NEXT: %Pivot10 = icmp slt i32 %tmp158, 11
31 ;CHECK-NEXT: br i1 %Pivot10, label %bb324, label %NodeBlock7
33 ;CHECK: NodeBlock7: ; preds = %NodeBlock9
34 ;CHECK-NEXT: %Pivot8 = icmp slt i32 %tmp158, 12
35 ;CHECK-NEXT: br i1 %Pivot8, label %bb326, label %bb328
37 ;CHECK: NodeBlock5: ; preds = %NodeBlock19
38 ;CHECK-NEXT: %Pivot6 = icmp slt i32 %tmp158, 7
39 ;CHECK-NEXT: br i1 %Pivot6, label %NodeBlock, label %NodeBlock3
41 ;CHECK: NodeBlock3: ; preds = %NodeBlock5
42 ;CHECK-NEXT: %Pivot4 = icmp slt i32 %tmp158, 8
43 ;CHECK-NEXT: br i1 %Pivot4, label %bb, label %NodeBlock1
45 ;CHECK: NodeBlock1: ; preds = %NodeBlock3
46 ;CHECK-NEXT: %Pivot2 = icmp slt i32 %tmp158, 9
47 ;CHECK-NEXT: br i1 %Pivot2, label %bb338, label %bb322
49 ;CHECK: NodeBlock: ; preds = %NodeBlock5
50 ;CHECK-NEXT: %Pivot = icmp slt i32 %tmp158, 0
51 ;CHECK-NEXT: br i1 %Pivot, label %LeafBlock, label %bb338
53 ;CHECK: LeafBlock: ; preds = %NodeBlock
54 ;CHECK-NEXT: %tmp158.off = add i32 %tmp158, 6
55 ;CHECK-NEXT: %SwitchLeaf = icmp ule i32 %tmp158.off, 4
56 ;CHECK-NEXT: br i1 %SwitchLeaf, label %bb338, label %NewDefault
58 define i32 @main(i32 %tmp158) {
61 switch i32 %tmp158, label %bb336 [