[RISCV][FMV] Support target_clones (#85786)
[llvm-project.git] / clang / test / CoverageMapping / mcdc-logical-stmt-ids.cpp
blob655bbf25ee103163bac508bfedf7673f1b125f65
1 // RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++11 -fcoverage-mcdc -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only %s | FileCheck %s
3 bool func_if_and(bool a, bool b, bool c, bool d, bool e, bool f) {
4 if (a && b)
5 if (a && b && c)
6 if (a && b && c && d)
7 if (a && b && c && d && e)
8 if (a && b && c && d && e && f)
9 return true;
10 return false;
13 // CHECK-LABEL: Decision,File 0, 4:7 -> 4:13 = M:3, C:2
14 // CHECK-NEXT: Branch,File 0, 4:7 -> 4:8 = #2, (#0 - #2) [1,2,0]
15 // CHECK: Branch,File 0, 4:12 -> 4:13 = #3, (#2 - #3) [2,0,0]
16 // CHECK-LABEL: Decision,File 0, 5:9 -> 5:20 = M:7, C:3
17 // CHECK-NEXT: Branch,File 0, 5:9 -> 5:10 = #7, (#1 - #7) [1,3,0]
18 // CHECK: Branch,File 0, 5:14 -> 5:15 = #8, (#7 - #8) [3,2,0]
19 // CHECK: Branch,File 0, 5:19 -> 5:20 = #6, (#5 - #6) [2,0,0]
20 // CHECK-LABEL: Decision,File 0, 6:11 -> 6:27 = M:12, C:4
21 // CHECK-NEXT: Branch,File 0, 6:11 -> 6:12 = #14, (#4 - #14) [1,4,0]
22 // CHECK: Branch,File 0, 6:16 -> 6:17 = #15, (#14 - #15) [4,3,0]
23 // CHECK: Branch,File 0, 6:21 -> 6:22 = #13, (#12 - #13) [3,2,0]
24 // CHECK: Branch,File 0, 6:26 -> 6:27 = #11, (#10 - #11) [2,0,0]
25 // CHECK-LABEL: Decision,File 0, 7:13 -> 7:34 = M:18, C:5
26 // CHECK-NEXT: Branch,File 0, 7:13 -> 7:14 = #23, (#9 - #23) [1,5,0]
27 // CHECK: Branch,File 0, 7:18 -> 7:19 = #24, (#23 - #24) [5,4,0]
28 // CHECK: Branch,File 0, 7:23 -> 7:24 = #22, (#21 - #22) [4,3,0]
29 // CHECK: Branch,File 0, 7:28 -> 7:29 = #20, (#19 - #20) [3,2,0]
30 // CHECK: Branch,File 0, 7:33 -> 7:34 = #18, (#17 - #18) [2,0,0]
31 // CHECK-LABEL: Decision,File 0, 8:16 -> 8:42 = M:25, C:6
32 // CHECK-NEXT: Branch,File 0, 8:16 -> 8:17 = #34, (#16 - #34) [1,6,0]
33 // CHECK: Branch,File 0, 8:21 -> 8:22 = #35, (#34 - #35) [6,5,0]
34 // CHECK: Branch,File 0, 8:26 -> 8:27 = #33, (#32 - #33) [5,4,0]
35 // CHECK: Branch,File 0, 8:31 -> 8:32 = #31, (#30 - #31) [4,3,0]
36 // CHECK: Branch,File 0, 8:36 -> 8:37 = #29, (#28 - #29) [3,2,0]
37 // CHECK: Branch,File 0, 8:41 -> 8:42 = #27, (#26 - #27) [2,0,0]
39 bool func_if_or(bool a, bool b, bool c, bool d, bool e, bool f) {
40 if (a || b)
41 if (a || b || c)
42 if (a || b || c || d)
43 if (a || b || c || d || e)
44 if (a || b || c || d || e || f)
45 return true;
46 return false;
49 // CHECK-LABEL: Decision,File 0, 40:7 -> 40:13 = M:3, C:2
50 // CHECK-NEXT: Branch,File 0, 40:7 -> 40:8 = (#0 - #2), #2 [1,0,2]
51 // CHECK: Branch,File 0, 40:12 -> 40:13 = (#2 - #3), #3 [2,0,0]
52 // CHECK-LABEL: Decision,File 0, 41:9 -> 41:20 = M:7, C:3
53 // CHECK-NEXT: Branch,File 0, 41:9 -> 41:10 = (#1 - #7), #7 [1,0,3]
54 // CHECK: Branch,File 0, 41:14 -> 41:15 = (#7 - #8), #8 [3,0,2]
55 // CHECK: Branch,File 0, 41:19 -> 41:20 = (#5 - #6), #6 [2,0,0]
56 // CHECK-LABEL: Decision,File 0, 42:11 -> 42:27 = M:12, C:4
57 // CHECK-NEXT: Branch,File 0, 42:11 -> 42:12 = (#4 - #14), #14 [1,0,4]
58 // CHECK: Branch,File 0, 42:16 -> 42:17 = (#14 - #15), #15 [4,0,3]
59 // CHECK: Branch,File 0, 42:21 -> 42:22 = (#12 - #13), #13 [3,0,2]
60 // CHECK: Branch,File 0, 42:26 -> 42:27 = (#10 - #11), #11 [2,0,0]
61 // CHECK-LABEL: Decision,File 0, 43:13 -> 43:34 = M:18, C:5
62 // CHECK-NEXT: Branch,File 0, 43:13 -> 43:14 = (#9 - #23), #23 [1,0,5]
63 // CHECK: Branch,File 0, 43:18 -> 43:19 = (#23 - #24), #24 [5,0,4]
64 // CHECK: Branch,File 0, 43:23 -> 43:24 = (#21 - #22), #22 [4,0,3]
65 // CHECK: Branch,File 0, 43:28 -> 43:29 = (#19 - #20), #20 [3,0,2]
66 // CHECK: Branch,File 0, 43:33 -> 43:34 = (#17 - #18), #18 [2,0,0]
67 // CHECK-LABEL: Decision,File 0, 44:16 -> 44:42 = M:25, C:6
68 // CHECK-NEXT: Branch,File 0, 44:16 -> 44:17 = (#16 - #34), #34 [1,0,6]
69 // CHECK: Branch,File 0, 44:21 -> 44:22 = (#34 - #35), #35 [6,0,5]
70 // CHECK: Branch,File 0, 44:26 -> 44:27 = (#32 - #33), #33 [5,0,4]
71 // CHECK: Branch,File 0, 44:31 -> 44:32 = (#30 - #31), #31 [4,0,3]
72 // CHECK: Branch,File 0, 44:36 -> 44:37 = (#28 - #29), #29 [3,0,2]
73 // CHECK: Branch,File 0, 44:41 -> 44:42 = (#26 - #27), #27 [2,0,0]
75 bool func_if_mix(bool a, bool b, bool c, bool d, bool e, bool f) {
76 if (a || b)
77 if (a && (b || c))
78 if ((a || b) && (c || d))
79 if (a && (b || c) && (d || e))
80 if ((a || b) && (c || d) && (e || f))
81 return true;
82 return false;
85 // CHECK-LABEL: Decision,File 0, 76:7 -> 76:13 = M:3, C:2
86 // CHECK-NEXT: Branch,File 0, 76:7 -> 76:8 = (#0 - #2), #2 [1,0,2]
87 // CHECK: Branch,File 0, 76:12 -> 76:13 = (#2 - #3), #3 [2,0,0]
88 // CHECK-LABEL: Decision,File 0, 77:9 -> 77:22 = M:7, C:3
89 // CHECK-NEXT: Branch,File 0, 77:9 -> 77:10 = #5, (#1 - #5) [1,2,0]
90 // CHECK: Branch,File 0, 77:15 -> 77:16 = (#5 - #6), #6 [2,0,3]
91 // CHECK: Branch,File 0, 77:20 -> 77:21 = (#6 - #7), #7 [3,0,0]
92 // CHECK-LABEL: Decision,File 0, 78:11 -> 78:31 = M:14, C:4
93 // CHECK-NEXT: File 0
94 // CHECK-NEXT: Branch,File 0, 78:12 -> 78:13 = (#4 - #10), #10 [1,2,3]
95 // CHECK: Branch,File 0, 78:17 -> 78:18 = (#10 - #11), #11 [3,2,0]
96 // CHECK: Branch,File 0, 78:24 -> 78:25 = (#9 - #12), #12 [2,0,4]
97 // CHECK: Branch,File 0, 78:29 -> 78:30 = (#12 - #13), #13 [4,0,0]
98 // CHECK-LABEL: Decision,File 0, 79:13 -> 79:38 = M:22, C:5
99 // CHECK-NEXT: Branch,File 0, 79:13 -> 79:14 = #16, (#8 - #16) [1,3,0]
100 // CHECK: Branch,File 0, 79:19 -> 79:20 = (#16 - #17), #17 [3,2,4]
101 // CHECK: Branch,File 0, 79:24 -> 79:25 = (#17 - #18), #18 [4,2,0]
102 // CHECK: Branch,File 0, 79:31 -> 79:32 = (#15 - #19), #19 [2,0,5]
103 // CHECK: Branch,File 0, 79:36 -> 79:37 = (#19 - #20), #20 [5,0,0]
104 // CHECK-LABEL: Decision,File 0, 80:15 -> 80:47 = M:37, C:6
105 // CHECK-NEXT: File 0
106 // CHECK-NEXT: Branch,File 0, 80:16 -> 80:17 = (#14 - #24), #24 [1,3,4]
107 // CHECK: Branch,File 0, 80:21 -> 80:22 = (#24 - #25), #25 [4,3,0]
108 // CHECK: Branch,File 0, 80:28 -> 80:29 = (#23 - #26), #26 [3,2,5]
109 // CHECK: Branch,File 0, 80:33 -> 80:34 = (#26 - #27), #27 [5,2,0]
110 // CHECK: Branch,File 0, 80:40 -> 80:41 = (#22 - #28), #28 [2,0,6]
111 // CHECK: Branch,File 0, 80:45 -> 80:46 = (#28 - #29), #29 [6,0,0]