1*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple=arm-apple-ios -print-machineinstrs=branch-folder \ 2*9880d681SAndroid Build Coastguard Worker; RUN: %s -o /dev/null 2>&1 | FileCheck %s 3*9880d681SAndroid Build Coastguard Worker 4*9880d681SAndroid Build Coastguard Worker; Branch probability of tailed-merged block: 5*9880d681SAndroid Build Coastguard Worker; 6*9880d681SAndroid Build Coastguard Worker; p(L0_L1 -> L2) = p(entry -> L0) * p(L0 -> L2) + p(entry -> L1) * p(L1 -> L2) 7*9880d681SAndroid Build Coastguard Worker; = 0.2 * 0.6 + 0.8 * 0.3 = 0.36 8*9880d681SAndroid Build Coastguard Worker; p(L0_L1 -> L3) = p(entry -> L0) * p(L0 -> L3) + p(entry -> L1) * p(L1 -> L3) 9*9880d681SAndroid Build Coastguard Worker; = 0.2 * 0.4 + 0.8 * 0.7 = 0.64 10*9880d681SAndroid Build Coastguard Worker 11*9880d681SAndroid Build Coastguard Worker; CHECK: # Machine code for function test0: 12*9880d681SAndroid Build Coastguard Worker; CHECK: Successors according to CFG: BB#{{[0-9]+}}({{[0-9a-fx/= ]+}}20.00%) BB#{{[0-9]+}}({{[0-9a-fx/= ]+}}80.00%) 13*9880d681SAndroid Build Coastguard Worker; CHECK: BB#{{[0-9]+}}: 14*9880d681SAndroid Build Coastguard Worker; CHECK: BB#{{[0-9]+}}: 15*9880d681SAndroid Build Coastguard Worker; CHECK: # End machine code for function test0. 16*9880d681SAndroid Build Coastguard Worker 17*9880d681SAndroid Build Coastguard Workerdefine i32 @test0(i32 %n, i32 %m, i32* nocapture %a, i32* nocapture %b) { 18*9880d681SAndroid Build Coastguard Workerentry: 19*9880d681SAndroid Build Coastguard Worker %cmp = icmp sgt i32 %n, 0 20*9880d681SAndroid Build Coastguard Worker br i1 %cmp, label %L0, label %L1, !prof !0 21*9880d681SAndroid Build Coastguard Worker 22*9880d681SAndroid Build Coastguard WorkerL0: ; preds = %entry 23*9880d681SAndroid Build Coastguard Worker store i32 12, i32* %a, align 4 24*9880d681SAndroid Build Coastguard Worker store i32 18, i32* %b, align 4 25*9880d681SAndroid Build Coastguard Worker %cmp1 = icmp eq i32 %m, 8 26*9880d681SAndroid Build Coastguard Worker br i1 %cmp1, label %L2, label %L3, !prof !1 27*9880d681SAndroid Build Coastguard Worker 28*9880d681SAndroid Build Coastguard WorkerL1: ; preds = %entry 29*9880d681SAndroid Build Coastguard Worker store i32 14, i32* %a, align 4 30*9880d681SAndroid Build Coastguard Worker store i32 18, i32* %b, align 4 31*9880d681SAndroid Build Coastguard Worker %cmp3 = icmp eq i32 %m, 8 32*9880d681SAndroid Build Coastguard Worker br i1 %cmp3, label %L2, label %L3, !prof !2 33*9880d681SAndroid Build Coastguard Worker 34*9880d681SAndroid Build Coastguard WorkerL2: ; preds = %L1, %L0 35*9880d681SAndroid Build Coastguard Worker br label %L3 36*9880d681SAndroid Build Coastguard Worker 37*9880d681SAndroid Build Coastguard WorkerL3: ; preds = %L0, %L1, %L2 38*9880d681SAndroid Build Coastguard Worker %retval.0 = phi i32 [ 100, %L2 ], [ 6, %L1 ], [ 6, %L0 ] 39*9880d681SAndroid Build Coastguard Worker ret i32 %retval.0 40*9880d681SAndroid Build Coastguard Worker} 41*9880d681SAndroid Build Coastguard Worker 42*9880d681SAndroid Build Coastguard Worker!0 = !{!"branch_weights", i32 200, i32 800} 43*9880d681SAndroid Build Coastguard Worker!1 = !{!"branch_weights", i32 600, i32 400} 44*9880d681SAndroid Build Coastguard Worker!2 = !{!"branch_weights", i32 300, i32 700} 45