mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Rollup merge of #80072 - richkadel:llvm-coverage-counters-2.2.1, r=tmandry
Fixed conflict with drop elaboration and coverage See https://github.com/rust-lang/rust/issues/80045#issuecomment-745733339 Coverage statements are moved to the beginning of the BCB. This does also affect what's counted before a panic, changing some results, but I think these results may even be preferred? In any case, there are no guarantees about what's counted when a panic occurs (by design). r? `@tmandry` FYI `@wesleywiser` `@ecstatic-morse`
This commit is contained in:
commit
a5b1d2252f
@ -310,7 +310,7 @@ impl<'a, 'tcx> Instrumentor<'a, 'tcx> {
|
||||
inject_statement(
|
||||
self.mir_body,
|
||||
counter_kind,
|
||||
self.bcb_last_bb(bcb),
|
||||
self.bcb_leader_bb(bcb),
|
||||
Some(make_code_region(file_name, &self.source_file, span, body_span)),
|
||||
);
|
||||
}
|
||||
@ -470,7 +470,7 @@ fn inject_statement(
|
||||
code_region: some_code_region,
|
||||
}),
|
||||
};
|
||||
data.statements.push(statement);
|
||||
data.statements.insert(0, statement);
|
||||
}
|
||||
|
||||
// Non-code expressions are injected into the coverage map, without generating executable code.
|
||||
|
@ -2,5 +2,5 @@ digraph Cov_0_4 {
|
||||
graph [fontname="Courier, monospace"];
|
||||
node [fontname="Courier, monospace"];
|
||||
edge [fontname="Courier, monospace"];
|
||||
bcb0__Cov_0_4 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">bcb0</td></tr><tr><td align="left" balign="left"></td></tr><tr><td align="left" balign="left">Counter(bcb0) at 18:1-20:2<br/> 19:5-19:9: @0[0]: _0 = const true<br/> 20:2-20:2: @0.Return: return</td></tr><tr><td align="left" balign="left">bb0: Return</td></tr></table>>];
|
||||
bcb0__Cov_0_4 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">bcb0</td></tr><tr><td align="left" balign="left"></td></tr><tr><td align="left" balign="left">Counter(bcb0) at 18:1-20:2<br/> 19:5-19:9: @0[0]: Coverage::Counter(1) for $DIR/coverage_graphviz.rs:18:1 - 20:2<br/> 20:2-20:2: @0.Return: return</td></tr><tr><td align="left" balign="left">bb0: Return</td></tr></table>>];
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ digraph Cov_0_3 {
|
||||
graph [fontname="Courier, monospace"];
|
||||
node [fontname="Courier, monospace"];
|
||||
edge [fontname="Courier, monospace"];
|
||||
bcb2__Cov_0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">bcb2</td></tr><tr><td align="left" balign="left">Expression(bcb0 - bcb1) at 13:10-13:10<br/> 13:10-13:10: @4[0]: _1 = const ()</td></tr><tr><td align="left" balign="left">bb4: Goto</td></tr></table>>];
|
||||
bcb2__Cov_0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">bcb2</td></tr><tr><td align="left" balign="left">Expression(bcb0 - bcb1) at 13:10-13:10<br/> 13:10-13:10: @4[0]: Coverage::Expression(4294967295) = 1 - 2 for $DIR/coverage_graphviz.rs:13:10 - 13:11</td></tr><tr><td align="left" balign="left">bb4: Goto</td></tr></table>>];
|
||||
bcb1__Cov_0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">bcb1</td></tr><tr><td align="left" balign="left">Counter(bcb1) at 12:13-12:18<br/> 12:13-12:18: @5[0]: _0 = const ()<br/>Expression(bcb1 + 0) at 15:2-15:2<br/> 15:2-15:2: @5.Return: return</td></tr><tr><td align="left" balign="left">bb3: FalseEdge</td></tr><tr><td align="left" balign="left">bb5: Return</td></tr></table>>];
|
||||
bcb0__Cov_0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">bcb0</td></tr><tr><td align="left" balign="left"></td></tr><tr><td align="left" balign="left">Counter(bcb0) at 9:1-11:17<br/> 11:12-11:17: @1.Call: _2 = bar() -> [return: bb2, unwind: bb6]<br/> 11:12-11:17: @2[0]: FakeRead(ForMatchedPlace, _2)</td></tr><tr><td align="left" balign="left">bb0: FalseUnwind<br/>bb1: Call</td></tr><tr><td align="left" balign="left">bb2: SwitchInt</td></tr></table>>];
|
||||
bcb2__Cov_0_3 -> bcb0__Cov_0_3 [label=<>];
|
||||
|
@ -5,8 +5,8 @@
|
||||
let mut _0: bool; // return place in scope 0 at /the/src/instrument_coverage.rs:19:13: 19:17
|
||||
|
||||
bb0: {
|
||||
_0 = const true; // scope 0 at /the/src/instrument_coverage.rs:20:5: 20:9
|
||||
+ Coverage::Counter(1) for /the/src/instrument_coverage.rs:19:1 - 21:2; // scope 0 at /the/src/instrument_coverage.rs:21:2: 21:2
|
||||
_0 = const true; // scope 0 at /the/src/instrument_coverage.rs:20:5: 20:9
|
||||
return; // scope 0 at /the/src/instrument_coverage.rs:21:2: 21:2
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
let mut _3: !; // in scope 0 at /the/src/instrument_coverage.rs:12:18: 14:10
|
||||
|
||||
bb0: {
|
||||
+ Coverage::Counter(1) for /the/src/instrument_coverage.rs:10:1 - 12:17; // scope 0 at /the/src/instrument_coverage.rs:11:5: 15:6
|
||||
falseUnwind -> [real: bb1, cleanup: bb6]; // scope 0 at /the/src/instrument_coverage.rs:11:5: 15:6
|
||||
}
|
||||
|
||||
@ -21,26 +22,25 @@
|
||||
|
||||
bb2: {
|
||||
FakeRead(ForMatchedPlace, _2); // scope 0 at /the/src/instrument_coverage.rs:12:12: 12:17
|
||||
+ Coverage::Counter(1) for /the/src/instrument_coverage.rs:10:1 - 12:17; // scope 0 at /the/src/instrument_coverage.rs:12:9: 14:10
|
||||
switchInt(_2) -> [false: bb4, otherwise: bb3]; // scope 0 at /the/src/instrument_coverage.rs:12:9: 14:10
|
||||
}
|
||||
|
||||
bb3: {
|
||||
+ Coverage::Expression(4294967294) = 2 + 0 for /the/src/instrument_coverage.rs:16:1 - 16:2; // scope 0 at /the/src/instrument_coverage.rs:12:9: 14:10
|
||||
+ Coverage::Counter(2) for /the/src/instrument_coverage.rs:13:13 - 13:18; // scope 0 at /the/src/instrument_coverage.rs:12:9: 14:10
|
||||
falseEdge -> [real: bb5, imaginary: bb4]; // scope 0 at /the/src/instrument_coverage.rs:12:9: 14:10
|
||||
}
|
||||
|
||||
bb4: {
|
||||
+ Coverage::Expression(4294967295) = 1 - 2 for /the/src/instrument_coverage.rs:14:10 - 14:11; // scope 0 at /the/src/instrument_coverage.rs:11:5: 15:6
|
||||
_1 = const (); // scope 0 at /the/src/instrument_coverage.rs:14:10: 14:10
|
||||
StorageDead(_2); // scope 0 at /the/src/instrument_coverage.rs:15:5: 15:6
|
||||
+ Coverage::Expression(4294967295) = 1 - 2 for /the/src/instrument_coverage.rs:14:10 - 14:11; // scope 0 at /the/src/instrument_coverage.rs:11:5: 15:6
|
||||
goto -> bb0; // scope 0 at /the/src/instrument_coverage.rs:11:5: 15:6
|
||||
}
|
||||
|
||||
bb5: {
|
||||
_0 = const (); // scope 0 at /the/src/instrument_coverage.rs:13:13: 13:18
|
||||
StorageDead(_2); // scope 0 at /the/src/instrument_coverage.rs:15:5: 15:6
|
||||
+ Coverage::Counter(2) for /the/src/instrument_coverage.rs:13:13 - 13:18; // scope 0 at /the/src/instrument_coverage.rs:16:2: 16:2
|
||||
+ Coverage::Expression(4294967294) = 2 + 0 for /the/src/instrument_coverage.rs:16:1 - 16:2; // scope 0 at /the/src/instrument_coverage.rs:16:2: 16:2
|
||||
return; // scope 0 at /the/src/instrument_coverage.rs:16:2: 16:2
|
||||
}
|
||||
|
||||
|
@ -17,14 +17,14 @@
|
||||
},
|
||||
"lines": {
|
||||
"count": 15,
|
||||
"covered": 12,
|
||||
"percent": 80
|
||||
"covered": 13,
|
||||
"percent": 86.66666666666667
|
||||
},
|
||||
"regions": {
|
||||
"count": 14,
|
||||
"covered": 12,
|
||||
"notcovered": 2,
|
||||
"percent": 85.71428571428571
|
||||
"covered": 13,
|
||||
"notcovered": 1,
|
||||
"percent": 92.85714285714286
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -42,14 +42,14 @@
|
||||
},
|
||||
"lines": {
|
||||
"count": 15,
|
||||
"covered": 12,
|
||||
"percent": 80
|
||||
"covered": 13,
|
||||
"percent": 86.66666666666667
|
||||
},
|
||||
"regions": {
|
||||
"count": 14,
|
||||
"covered": 12,
|
||||
"notcovered": 2,
|
||||
"percent": 85.71428571428571
|
||||
"covered": 13,
|
||||
"notcovered": 1,
|
||||
"percent": 92.85714285714286
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,14 +17,14 @@
|
||||
},
|
||||
"lines": {
|
||||
"count": 23,
|
||||
"covered": 19,
|
||||
"percent": 82.6086956521739
|
||||
"covered": 21,
|
||||
"percent": 91.30434782608695
|
||||
},
|
||||
"regions": {
|
||||
"count": 13,
|
||||
"covered": 11,
|
||||
"notcovered": 2,
|
||||
"percent": 84.61538461538461
|
||||
"covered": 12,
|
||||
"notcovered": 1,
|
||||
"percent": 92.3076923076923
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -42,14 +42,14 @@
|
||||
},
|
||||
"lines": {
|
||||
"count": 23,
|
||||
"covered": 19,
|
||||
"percent": 82.6086956521739
|
||||
"covered": 21,
|
||||
"percent": 91.30434782608695
|
||||
},
|
||||
"regions": {
|
||||
"count": 13,
|
||||
"covered": 11,
|
||||
"notcovered": 2,
|
||||
"percent": 84.61538461538461
|
||||
"covered": 12,
|
||||
"notcovered": 1,
|
||||
"percent": 92.3076923076923
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,14 +17,14 @@
|
||||
},
|
||||
"lines": {
|
||||
"count": 19,
|
||||
"covered": 16,
|
||||
"percent": 84.21052631578947
|
||||
"covered": 17,
|
||||
"percent": 89.47368421052632
|
||||
},
|
||||
"regions": {
|
||||
"count": 13,
|
||||
"covered": 11,
|
||||
"notcovered": 2,
|
||||
"percent": 84.61538461538461
|
||||
"covered": 12,
|
||||
"notcovered": 1,
|
||||
"percent": 92.3076923076923
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -42,14 +42,14 @@
|
||||
},
|
||||
"lines": {
|
||||
"count": 19,
|
||||
"covered": 16,
|
||||
"percent": 84.21052631578947
|
||||
"covered": 17,
|
||||
"percent": 89.47368421052632
|
||||
},
|
||||
"regions": {
|
||||
"count": 13,
|
||||
"covered": 11,
|
||||
"notcovered": 2,
|
||||
"percent": 84.61538461538461
|
||||
"covered": 12,
|
||||
"notcovered": 1,
|
||||
"percent": 92.3076923076923
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,13 +9,13 @@
|
||||
8| |
|
||||
9| 1|fn main() -> Result<(),u8> {
|
||||
10| 1| let mut countdown = 10;
|
||||
11| 10| while countdown > 0 {
|
||||
12| 10| if countdown == 1 {
|
||||
13| 0| might_fail_assert(3);
|
||||
11| 11| while countdown > 0 {
|
||||
12| 11| if countdown == 1 {
|
||||
13| 1| might_fail_assert(3);
|
||||
14| 10| } else if countdown < 5 {
|
||||
15| 3| might_fail_assert(2);
|
||||
16| 6| }
|
||||
17| 9| countdown -= 1;
|
||||
17| 10| countdown -= 1;
|
||||
18| | }
|
||||
19| 0| Ok(())
|
||||
20| 0|}
|
||||
|
@ -14,15 +14,15 @@
|
||||
14| |
|
||||
15| 1|fn main() -> Result<(),u8> {
|
||||
16| 1| let mut countdown = 10;
|
||||
17| 10| while countdown > 0 {
|
||||
18| 10| if countdown == 1 {
|
||||
19| 0| let result = might_overflow(10);
|
||||
20| 0| println!("Result: {}", result);
|
||||
17| 11| while countdown > 0 {
|
||||
18| 11| if countdown == 1 {
|
||||
19| 1| let result = might_overflow(10);
|
||||
20| 1| println!("Result: {}", result);
|
||||
21| 10| } else if countdown < 5 {
|
||||
22| 3| let result = might_overflow(1);
|
||||
23| 3| println!("Result: {}", result);
|
||||
24| 6| }
|
||||
25| 9| countdown -= 1;
|
||||
25| 10| countdown -= 1;
|
||||
26| | }
|
||||
27| 0| Ok(())
|
||||
28| 0|}
|
||||
|
@ -12,13 +12,13 @@
|
||||
12| |
|
||||
13| 1|fn main() -> Result<(), u8> {
|
||||
14| 1| let mut countdown = 10;
|
||||
15| 10| while countdown > 0 {
|
||||
16| 10| if countdown == 1 {
|
||||
17| 0| might_panic(true);
|
||||
15| 11| while countdown > 0 {
|
||||
16| 11| if countdown == 1 {
|
||||
17| 1| might_panic(true);
|
||||
18| 10| } else if countdown < 5 {
|
||||
19| 3| might_panic(false);
|
||||
20| 6| }
|
||||
21| 9| countdown -= 1;
|
||||
21| 10| countdown -= 1;
|
||||
22| | }
|
||||
23| 0| Ok(())
|
||||
24| 0|}
|
||||
|
@ -20,13 +20,13 @@ Combined regions:
|
||||
6:37 -> 6:61 (count=1)
|
||||
7:1 -> 7:2 (count=3)
|
||||
9:1 -> 10:27 (count=1)
|
||||
11:11 -> 11:24 (count=10)
|
||||
12:12 -> 12:26 (count=10)
|
||||
12:27 -> 14:10 (count=0)
|
||||
11:11 -> 11:24 (count=11)
|
||||
12:12 -> 12:26 (count=11)
|
||||
12:27 -> 14:10 (count=1)
|
||||
14:19 -> 14:32 (count=10)
|
||||
14:33 -> 16:10 (count=3)
|
||||
16:10 -> 16:11 (count=6)
|
||||
17:9 -> 17:23 (count=9)
|
||||
17:9 -> 17:23 (count=10)
|
||||
19:5 -> 20:2 (count=0)
|
||||
Segment at 4:1 (count = 4), RegionEntry
|
||||
Segment at 4:41 (count = 0), Skipped
|
||||
@ -40,18 +40,18 @@ Segment at 7:1 (count = 3), RegionEntry
|
||||
Segment at 7:2 (count = 0), Skipped
|
||||
Segment at 9:1 (count = 1), RegionEntry
|
||||
Segment at 10:27 (count = 0), Skipped
|
||||
Segment at 11:11 (count = 10), RegionEntry
|
||||
Segment at 11:11 (count = 11), RegionEntry
|
||||
Segment at 11:24 (count = 0), Skipped
|
||||
Segment at 12:12 (count = 10), RegionEntry
|
||||
Segment at 12:12 (count = 11), RegionEntry
|
||||
Segment at 12:26 (count = 0), Skipped
|
||||
Segment at 12:27 (count = 0), RegionEntry
|
||||
Segment at 12:27 (count = 1), RegionEntry
|
||||
Segment at 14:10 (count = 0), Skipped
|
||||
Segment at 14:19 (count = 10), RegionEntry
|
||||
Segment at 14:32 (count = 0), Skipped
|
||||
Segment at 14:33 (count = 3), RegionEntry
|
||||
Segment at 16:10 (count = 6), RegionEntry
|
||||
Segment at 16:11 (count = 0), Skipped
|
||||
Segment at 17:9 (count = 9), RegionEntry
|
||||
Segment at 17:9 (count = 10), RegionEntry
|
||||
Segment at 17:23 (count = 0), Skipped
|
||||
Segment at 19:5 (count = 0), RegionEntry
|
||||
Segment at 20:2 (count = 0), Skipped
|
||||
|
@ -18,13 +18,13 @@ Combined regions:
|
||||
7:6 -> 7:7 (count=3)
|
||||
8:9 -> 13:2 (count=4)
|
||||
15:1 -> 16:27 (count=1)
|
||||
17:11 -> 17:24 (count=10)
|
||||
18:12 -> 18:26 (count=10)
|
||||
18:27 -> 21:10 (count=0)
|
||||
17:11 -> 17:24 (count=11)
|
||||
18:12 -> 18:26 (count=11)
|
||||
18:27 -> 21:10 (count=1)
|
||||
21:19 -> 21:32 (count=10)
|
||||
21:33 -> 24:10 (count=3)
|
||||
24:10 -> 24:11 (count=6)
|
||||
25:9 -> 25:23 (count=9)
|
||||
25:9 -> 25:23 (count=10)
|
||||
27:5 -> 28:2 (count=0)
|
||||
Segment at 4:1 (count = 4), RegionEntry
|
||||
Segment at 5:18 (count = 0), Skipped
|
||||
@ -35,18 +35,18 @@ Segment at 8:9 (count = 4), RegionEntry
|
||||
Segment at 13:2 (count = 0), Skipped
|
||||
Segment at 15:1 (count = 1), RegionEntry
|
||||
Segment at 16:27 (count = 0), Skipped
|
||||
Segment at 17:11 (count = 10), RegionEntry
|
||||
Segment at 17:11 (count = 11), RegionEntry
|
||||
Segment at 17:24 (count = 0), Skipped
|
||||
Segment at 18:12 (count = 10), RegionEntry
|
||||
Segment at 18:12 (count = 11), RegionEntry
|
||||
Segment at 18:26 (count = 0), Skipped
|
||||
Segment at 18:27 (count = 0), RegionEntry
|
||||
Segment at 18:27 (count = 1), RegionEntry
|
||||
Segment at 21:10 (count = 0), Skipped
|
||||
Segment at 21:19 (count = 10), RegionEntry
|
||||
Segment at 21:32 (count = 0), Skipped
|
||||
Segment at 21:33 (count = 3), RegionEntry
|
||||
Segment at 24:10 (count = 6), RegionEntry
|
||||
Segment at 24:11 (count = 0), Skipped
|
||||
Segment at 25:9 (count = 9), RegionEntry
|
||||
Segment at 25:9 (count = 10), RegionEntry
|
||||
Segment at 25:23 (count = 0), Skipped
|
||||
Segment at 27:5 (count = 0), RegionEntry
|
||||
Segment at 28:2 (count = 0), Skipped
|
||||
|
@ -18,13 +18,13 @@ Combined regions:
|
||||
6:9 -> 7:26 (count=1)
|
||||
8:12 -> 11:2 (count=3)
|
||||
13:1 -> 14:27 (count=1)
|
||||
15:11 -> 15:24 (count=10)
|
||||
16:12 -> 16:26 (count=10)
|
||||
16:27 -> 18:10 (count=0)
|
||||
15:11 -> 15:24 (count=11)
|
||||
16:12 -> 16:26 (count=11)
|
||||
16:27 -> 18:10 (count=1)
|
||||
18:19 -> 18:32 (count=10)
|
||||
18:33 -> 20:10 (count=3)
|
||||
20:10 -> 20:11 (count=6)
|
||||
21:9 -> 21:23 (count=9)
|
||||
21:9 -> 21:23 (count=10)
|
||||
23:5 -> 24:2 (count=0)
|
||||
Segment at 4:1 (count = 4), RegionEntry
|
||||
Segment at 4:36 (count = 0), Skipped
|
||||
@ -36,18 +36,18 @@ Segment at 8:12 (count = 3), RegionEntry
|
||||
Segment at 11:2 (count = 0), Skipped
|
||||
Segment at 13:1 (count = 1), RegionEntry
|
||||
Segment at 14:27 (count = 0), Skipped
|
||||
Segment at 15:11 (count = 10), RegionEntry
|
||||
Segment at 15:11 (count = 11), RegionEntry
|
||||
Segment at 15:24 (count = 0), Skipped
|
||||
Segment at 16:12 (count = 10), RegionEntry
|
||||
Segment at 16:12 (count = 11), RegionEntry
|
||||
Segment at 16:26 (count = 0), Skipped
|
||||
Segment at 16:27 (count = 0), RegionEntry
|
||||
Segment at 16:27 (count = 1), RegionEntry
|
||||
Segment at 18:10 (count = 0), Skipped
|
||||
Segment at 18:19 (count = 10), RegionEntry
|
||||
Segment at 18:32 (count = 0), Skipped
|
||||
Segment at 18:33 (count = 3), RegionEntry
|
||||
Segment at 20:10 (count = 6), RegionEntry
|
||||
Segment at 20:11 (count = 0), Skipped
|
||||
Segment at 21:9 (count = 9), RegionEntry
|
||||
Segment at 21:9 (count = 10), RegionEntry
|
||||
Segment at 21:23 (count = 0), Skipped
|
||||
Segment at 23:5 (count = 0), RegionEntry
|
||||
Segment at 24:2 (count = 0), Skipped
|
||||
|
Loading…
Reference in New Issue
Block a user