[InstCombine] Signed saturation patterns
[llvm-complete.git] / test / tools / llvm-cov / deferred-region.cpp
blob3bc675d66e710c400a803ff30f2dbd9b50517357
1 // RUN: llvm-cov show %S/Inputs/deferred-regions.covmapping -instr-profile %S/Inputs/deferred-regions.profdata -show-line-counts-or-regions -dump -path-equivalence=/tmp,%S %s 2>%t.markers > %t.out && FileCheck %s -input-file %t.out && FileCheck %s -input-file %t.markers -check-prefix=MARKER
3 void foo(int x) {
4 if (x == 0) { // CHECK: [[@LINE]]|{{ +}}2|
5 return; // CHECK-NEXT: [[@LINE]]|{{ +}}1|
8 } // CHECK: [[@LINE]]|{{ +}}1|
10 void bar() {
11 return;
13 } // CHECK: [[@LINE]]|{{ +}}1|
15 void for_loop() {
16 if (false)
17 return; // CHECK: [[@LINE]]|{{ +}}0|
19 for (int i = 0; i < 10; ++i) { // CHECK: [[@LINE]]|{{ +}}2|
20 if (i % 2 == 0) // CHECK: [[@LINE]]|{{ +}}2|
21 continue; // CHECK: [[@LINE]]|{{ +}}1|
23 if (i % 5 == 0) // CHECK: [[@LINE]]|{{ +}}1|
24 break; // CHECK: [[@LINE]]|{{ +}}0|
26 int x = i;
27 return; // CHECK: [[@LINE]]|{{ +}}1|
29 } // CHECK: [[@LINE]]|{{ +}}1|
32 struct Error {};
34 void while_loop() {
35 if (false)
36 return; // CHECK: [[@LINE]]|{{ +}}0|
38 int x = 0;
39 while (++x < 10) { // CHECK: [[@LINE]]|{{ +}}3|
40 if (x == 1) // CHECK: [[@LINE]]|{{ +}}2|
41 continue; // CHECK: [[@LINE]]|{{ +}}1|
43 while (++x < 4) { // CHECK: [[@LINE]]|{{ +}}1|
44 if (x == 3) // CHECK: [[@LINE]]|{{ +}}1|
45 break; // CHECK: [[@LINE]]|{{ +}}1|
46 // CHECK: [[@LINE]]|{{ +}}0|
47 while (++x < 5) {} // CHECK: [[@LINE]]|{{ +}}0|
48 } // CHECK: [[@LINE]]|{{ +}}0|
50 if (x == 0) // CHECK: [[@LINE]]|{{ +}}1|
51 throw Error(); // CHECK: [[@LINE]]|{{ +}}0|
52 // CHECK: [[@LINE]]|{{ +}}1|
53 while (++x < 9) { // CHECK: [[@LINE]]|{{ +}}6|
54 if (x == 0) // CHECK: [[@LINE]]|{{ +}}5|
55 break; // CHECK: [[@LINE]]|{{ +}}0|
61 void gotos() {
62 if (false) // CHECK: [[@LINE]]|{{ +}}1|
63 goto out; // CHECK: [[@LINE]]|{{ +}}0|
64 // CHECK: [[@LINE]]|{{ +}}1|
65 return; // CHECK: [[@LINE]]|{{ +}}1|
67 out: // CHECK: [[@LINE]]|{{ +}}0|
68 return;
71 void if_else(bool flag) {
72 if (flag) { // CHECK: [[@LINE]]|{{ +}}2|
73 return; // CHECK: [[@LINE]]|{{ +}}1|
74 } else { // CHECK: [[@LINE]]|{{ +}}1|
75 return; // CHECK: [[@LINE]]|{{ +}}1|
76 } // CHECK: [[@LINE]]|{{ +}}1|
79 int main() {
80 foo(0);
81 foo(1);
82 bar();
83 for_loop();
84 while_loop();
85 gotos();
86 if_else(true);
87 if_else(false);
88 return 0;
91 // MARKER: Highlighted line 17, 5 -> 11
92 // MARKER-NEXT: Marker at 19:3 = 1
93 // MARKER-NEXT: Marker at 19:27 = 1
94 // MARKER-NEXT: Highlighted line 24, 7 -> 12
95 // MARKER-NEXT: Highlighted line 36, 5 -> 11
96 // MARKER-NEXT: Highlighted line 47, 7 -> 14
97 // MARKER-NEXT: Highlighted line 47, 14 -> 21
98 // MARKER-NEXT: Highlighted line 47, 21 -> 23
99 // MARKER-NEXT: Highlighted line 47, 23 -> 25
100 // MARKER-NEXT: Highlighted line 47, 25 -> ?
101 // MARKER-NEXT: Highlighted line 48, 1 -> 6
102 // MARKER-NEXT: Highlighted line 51, 7 -> 20
103 // MARKER-NEXT: Marker at 53:5 = 1
104 // MARKER-NEXT: Highlighted line 55, 9 -> 14
105 // MARKER-NEXT: Highlighted line 63, 5 -> 13
106 // MARKER-NEXT: Highlighted line 67, 1 -> ?
107 // MARKER-NEXT: Highlighted line 68, 1 -> 8