1 ; RUN: llc < %s -print-machineinstrs=expand-isel-pseudos -o /dev/null 2>&1 | FileCheck %s
3 ; ARM & AArch64 run an extra SimplifyCFG which disrupts this test.
6 ; Make sure we have the correct weight attached to each successor.
7 define i32 @test2(i32 %x) nounwind uwtable readnone ssp {
8 ; CHECK-LABEL: Machine code for function test2:
10 %conv = sext i32 %x to i64
11 switch i64 %conv, label %return [
17 ; CHECK: BB#0: derived from LLVM BB %entry
18 ; CHECK: Successors according to CFG: BB#2(64) BB#4(21)
19 ; CHECK: BB#4: derived from LLVM BB %entry
20 ; CHECK: Successors according to CFG: BB#1(10) BB#5(11)
21 ; CHECK: BB#5: derived from LLVM BB %entry
22 ; CHECK: Successors according to CFG: BB#1(4) BB#3(7)
31 %retval.0 = phi i32 [ 5, %sw.bb1 ], [ 1, %sw.bb ], [ 0, %entry ]
35 !0 = !{!"branch_weights", i32 7, i32 6, i32 4, i32 4, i32 64}
39 define void @left_leaning_weight_balanced_tree(i32 %x) {
41 switch i32 %x, label %return [
49 bb0: tail call void @g(i32 0) br label %return
50 bb1: tail call void @g(i32 1) br label %return
51 bb2: tail call void @g(i32 2) br label %return
52 bb3: tail call void @g(i32 3) br label %return
53 bb4: tail call void @g(i32 4) br label %return
54 bb5: tail call void @g(i32 5) br label %return
57 ; Check that we set branch weights on the pivot cmp instruction correctly.
58 ; Cases {0,10,20,30} go on the left with weight 13; cases {40,50} go on the
59 ; right with weight 20.
61 ; CHECK-LABEL: Machine code for function left_leaning_weight_balanced_tree:
62 ; CHECK: BB#0: derived from LLVM BB %entry
63 ; CHECK-NOT: Successors
64 ; CHECK: Successors according to CFG: BB#8(13) BB#9(20)
67 !1 = !{!"branch_weights",
73 i32 1, i32 10, i32 10}