1; RUN: llc -mtriple=i686-pc-gnu-linux < %s | FileCheck %s 2; RUN: llc -mtriple=i686-pc-gnu-linux -print-after=finalize-isel %s -o /dev/null 2>&1 | FileCheck %s -check-prefix=CHECK-JT-PROB 3 4 5; An unreachable default destination is ignored and no compare and branch 6; is generated for the default values. 7 8define void @foo(i32 %x, i32* %to) { 9; CHECK-LABEL: foo: 10; CHECK: movl 4(%esp), [[REG:%e[a-z]{2}]] 11; CHECK-NEXT: jmpl *.LJTI0_0(,[[REG]],4) 12; CHECK: movl $4 13; CHECK: retl 14 15entry: 16 switch i32 %x, label %default [ 17 i32 0, label %bb0 18 i32 1, label %bb1 19 i32 2, label %bb2 20 i32 3, label %bb3 21 i32 4, label %bb4 22 i32 5, label %bb4 23 ] 24bb0: 25 store i32 0, i32* %to 26 br label %exit 27bb1: 28 store i32 1, i32* %to 29 br label %exit 30bb2: 31 store i32 2, i32* %to 32 br label %exit 33bb3: 34 store i32 3, i32* %to 35 br label %exit 36bb4: 37 store i32 4, i32* %to 38 br label %exit 39exit: 40 ret void 41default: 42 unreachable 43 44; The jump table has four entries. 45; CHECK-LABEL: .LJTI0_0: 46; CHECK-NEXT: .long .LBB0_1 47; CHECK-NEXT: .long .LBB0_2 48; CHECK-NEXT: .long .LBB0_3 49; CHECK-NEXT: .long .LBB0_4 50; CHECK-NEXT: .long .LBB0_5 51; CHECK-NEXT: .long .LBB0_5 52} 53 54; Check if branch probabilities are correctly assigned to the jump table. 55 56define void @bar(i32 %x, i32* %to) { 57; CHECK-JT-PROB-LABEL: bar: 58; CHECK-JT-PROB: successors: %bb.6(0x12492492), %bb.8(0x6db6db6e) 59; CHECK-JT-PROB: successors: %bb.1(0x15555555), %bb.2(0x15555555), %bb.3(0x15555555), %bb.4(0x15555555), %bb.5(0x2aaaaaab) 60 61entry: 62 switch i32 %x, label %default [ 63 i32 0, label %bb0 64 i32 1, label %bb1 65 i32 2, label %bb2 66 i32 3, label %bb3 67 i32 4, label %bb4 68 i32 5, label %bb4 69 ], !prof !1 70bb0: 71 store i32 0, i32* %to 72 br label %exit 73bb1: 74 store i32 1, i32* %to 75 br label %exit 76bb2: 77 store i32 2, i32* %to 78 br label %exit 79bb3: 80 store i32 3, i32* %to 81 br label %exit 82bb4: 83 store i32 4, i32* %to 84 br label %exit 85default: 86 store i32 5, i32* %to 87 br label %exit 88exit: 89 ret void 90} 91 92!1 = !{!"branch_weights", i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16} 93