1 ; RUN: opt < %s -passes='print<branch-prob>' -disable-output 2>&1 | FileCheck %s
3 ; CHECK-LABEL: no_hoist
4 ; CHECK: edge %entry -> %if.end probability is 0x40000000 / 0x80000000 = 50.00%
5 ; CHECK: edge %entry -> %if.then probability is 0x40000000 / 0x80000000 = 50.00%
6 ; CHECK: edge %if.end -> %if.end4 probability is 0x40000000 / 0x80000000 = 50.00%
7 ; CHECK: edge %if.end -> %if.then3 probability is 0x40000000 / 0x80000000 = 50.00%
8 define dso_local void @no_hoist(i64 %arg1, i64 %arg2) local_unnamed_addr #0 {
10 %and = and i64 %arg1, 1152921504606846976
11 %tobool.not = icmp eq i64 %and, 0
12 br i1 %tobool.not, label %if.end, label %if.then
14 if.then: ; preds = %entry
18 if.end: ; preds = %if.then, %entry
19 %and1 = and i64 %arg2, 1152921504606846976
20 %tobool2.not = icmp eq i64 %and1, 0
21 br i1 %tobool2.not, label %if.end4, label %if.then3
23 if.then3: ; preds = %if.end
27 if.end4: ; preds = %if.then3, %if.end
32 ; CHECK: edge %entry -> %if.end probability is 0x40000000 / 0x80000000 = 50.00%
33 ; CHECK: edge %entry -> %if.then probability is 0x40000000 / 0x80000000 = 50.00%
34 ; CHECK: edge %if.end -> %if.end4 probability is 0x40000000 / 0x80000000 = 50.00%
35 ; CHECK: edge %if.end -> %if.then3 probability is 0x40000000 / 0x80000000 = 50.00%
36 define dso_local void @hoist(i64 %arg1, i64 %arg2) local_unnamed_addr #0 {
38 %const = bitcast i64 1152921504606846976 to i64
39 %and = and i64 %arg1, %const
40 %tobool.not = icmp eq i64 %and, 0
41 br i1 %tobool.not, label %if.end, label %if.then
43 if.then: ; preds = %entry
47 if.end: ; preds = %if.then, %entry
48 %and1 = and i64 %arg2, %const
49 %tobool2.not = icmp eq i64 %and1, 0
50 br i1 %tobool2.not, label %if.end4, label %if.then3
52 if.then3: ; preds = %if.end
56 if.end4: ; preds = %if.then3, %if.end
60 declare dso_local void @bar() local_unnamed_addr #1
62 declare dso_local void @baz() local_unnamed_addr #1