1 // RUN: llvm-profdata merge %S/Inputs/branch-logical-mixed.proftext -o %t.profdata
2 // RUN: llvm-cov show --show-branches=count %S/Inputs/branch-logical-mixed.o32l -instr-profile %t.profdata -path-equivalence=/tmp,%S %s | FileCheck %s
3 // RUN: llvm-cov report --show-branch-summary %S/Inputs/branch-logical-mixed.o32l -instr-profile %t.profdata -show-functions -path-equivalence=/tmp,%S %s | FileCheck %s -check-prefix=REPORT
8 void func(int a
, int b
) {
16 bool c
= b0
&& // CHECK: Branch ([[@LINE]]:12): [True: 3, False: 1]
17 b1
&& // CHECK: Branch ([[@LINE]]:12): [True: 2, False: 1]
18 b2
&& // CHECK: Branch ([[@LINE]]:12): [True: 2, False: 0]
19 b3
&& // CHECK: Branch ([[@LINE]]:12): [True: 0, False: 2]
20 b4
&& // CHECK: Branch ([[@LINE]]:12): [True: 0, False: 0]
21 b5
; // CHECK: Branch ([[@LINE]]:12): [True: 0, False: 0]
23 bool d
= b0
|| // CHECK: Branch ([[@LINE]]:12): [True: 3, False: 1]
24 b1
|| // CHECK: Branch ([[@LINE]]:12): [True: 0, False: 1]
25 b2
|| // CHECK: Branch ([[@LINE]]:12): [True: 1, False: 0]
26 b3
|| // CHECK: Branch ([[@LINE]]:12): [True: 0, False: 0]
27 b4
|| // CHECK: Branch ([[@LINE]]:12): [True: 0, False: 0]
28 b5
; // CHECK: Branch ([[@LINE]]:12): [True: 0, False: 0]
30 bool e
= (b0
&& // CHECK: Branch ([[@LINE]]:13): [True: 3, False: 1]
31 b5
) || // CHECK: Branch ([[@LINE]]:13): [True: 1, False: 2]
32 (b1
&& // CHECK: Branch ([[@LINE]]:13): [True: 2, False: 1]
33 b4
) || // CHECK: Branch ([[@LINE]]:13): [True: 0, False: 2]
34 (b2
&& // CHECK: Branch ([[@LINE]]:13): [True: 3, False: 0]
35 b3
) || // CHECK: Branch ([[@LINE]]:13): [True: 0, False: 3]
36 (b3
&& // CHECK: Branch ([[@LINE]]:13): [True: 0, False: 3]
37 b2
) || // CHECK: Branch ([[@LINE]]:13): [True: 0, False: 0]
38 (b4
&& // CHECK: Branch ([[@LINE]]:13): [True: 1, False: 2]
39 b1
) || // CHECK: Branch ([[@LINE]]:13): [True: 0, False: 1]
40 (b5
&& // CHECK: Branch ([[@LINE]]:13): [True: 1, False: 2]
41 b0
); // CHECK: Branch ([[@LINE]]:13): [True: 0, False: 1]
43 bool f
= (b0
|| // CHECK: Branch ([[@LINE]]:13): [True: 3, False: 1]
44 b5
) && // CHECK: Branch ([[@LINE]]:13): [True: 1, False: 0]
45 (b1
|| // CHECK: Branch ([[@LINE]]:13): [True: 2, False: 2]
46 b4
) && // CHECK: Branch ([[@LINE]]:13): [True: 1, False: 1]
47 (b2
|| // CHECK: Branch ([[@LINE]]:13): [True: 3, False: 0]
48 b3
) && // CHECK: Branch ([[@LINE]]:13): [True: 0, False: 0]
49 (b3
|| // CHECK: Branch ([[@LINE]]:13): [True: 0, False: 3]
50 b2
) && // CHECK: Branch ([[@LINE]]:13): [True: 3, False: 0]
51 (b4
|| // CHECK: Branch ([[@LINE]]:13): [True: 1, False: 2]
52 b1
) && // CHECK: Branch ([[@LINE]]:13): [True: 2, False: 0]
53 (b5
|| // CHECK: Branch ([[@LINE]]:13): [True: 1, False: 2]
54 b0
); // CHECK: Branch ([[@LINE]]:13): [True: 2, False: 0]
56 if (c
) // CHECK: Branch ([[@LINE]]:7): [True: 0, False: 4]
61 if (d
) // CHECK: Branch ([[@LINE]]:7): [True: 4, False: 0]
66 if (e
) // CHECK: Branch ([[@LINE]]:7): [True: 1, False: 3]
71 if (f
) // CHECK: Branch ([[@LINE]]:7): [True: 3, False: 1]
77 extern "C" { extern void __llvm_profile_write_file(void); }
78 int main(int argc
, char *argv
[])
80 func(atoi(argv
[1]), atoi(argv
[2]));
81 __llvm_profile_write_file();
85 // REPORT: Name Regions Miss Cover Lines Miss Cover Branches Miss Cover
87 // REPORT-NEXT: _Z4funcii 77 9 88.31% 68 3 95.59% 80 32 60.00%
88 // REPORT-NEXT: main 1 0 100.00% 5 0 100.00% 0 0 0.00%
90 // REPORT-NEXT: TOTAL 78 9 88.46% 73 3 95.89% 80 32 60.00%