1 ; RUN: opt < %s -analyze -branch-prob -enable-new-pm=0 | FileCheck %s
2 ; RUN: opt < %s -analyze -lazy-branch-prob -enable-new-pm=0 | FileCheck %s
3 ; RUN: opt < %s -passes='print<branch-prob>' -disable-output 2>&1 | FileCheck %s
7 ; Check correctness of reported probabilities in case of multiple edges between
8 ; basic blocks. In this case sum of probabilities over all edges should be
9 ; returned by BranchProbabilityInfo::getEdgeProbability.
11 define void @test1(i32 %x) {
12 ;CHECK: edge entry -> return probability is 0x0ccccccd / 0x80000000 = 10.00%
13 ;CHECK: edge entry -> bb0 probability is 0x26666666 / 0x80000000 = 30.00%
14 ;CHECK: edge entry -> bb0 probability is 0x26666666 / 0x80000000 = 30.00%
15 ;CHECK: edge entry -> bb0 probability is 0x26666666 / 0x80000000 = 30.00%
16 ;CHECK: edge entry -> bb1 probability is 0x26666666 / 0x80000000 = 30.00%
17 ;CHECK: edge entry -> bb1 probability is 0x26666666 / 0x80000000 = 30.00%
18 ;CHECK: edge entry -> bb1 probability is 0x26666666 / 0x80000000 = 30.00%
19 ;CHECK: edge entry -> bb2 probability is 0x26666666 / 0x80000000 = 30.00%
20 ;CHECK: edge entry -> bb2 probability is 0x26666666 / 0x80000000 = 30.00%
21 ;CHECK: edge entry -> bb2 probability is 0x26666666 / 0x80000000 = 30.00%
22 ;CHECK: edge bb0 -> return probability is 0x80000000 / 0x80000000 = 100.00% [HOT edge]
23 ;CHECK: edge bb1 -> return probability is 0x80000000 / 0x80000000 = 100.00% [HOT edge]
24 ;CHECK: edge bb2 -> return probability is 0x80000000 / 0x80000000 = 100.00% [HOT edge]
27 switch i32 %x, label %return [
39 bb0: ; preds = %entry, %entry, %entry
40 tail call void @g(i32 0)
43 bb1: ; preds = %entry, %entry, %entry
44 tail call void @g(i32 1)
47 bb2: ; preds = %entry, %entry, %entry
48 tail call void @g(i32 2)
51 return: ; preds = %bb2, %bb1, %bb0, %entry