forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#98868 - tmiasko:unreachable-coverage, r=wes…
…leywiser Fix unreachable coverage generation for inlined functions To generate a function coverage we need at least one coverage counter, so a coverage from unreachable blocks is retained only when some live counters remain. The previous implementation incorrectly retained unreachable coverage, because it didn't account for the fact that those live counters can belong to another function due to inlining. Fixes rust-lang#98833.
- Loading branch information
Showing
6 changed files
with
111 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.inline-dead.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
1| |// Regression test for issue #98833. | ||
2| |// compile-flags: -Zinline-mir | ||
3| | | ||
4| 1|fn main() { | ||
5| 1| println!("{}", live::<false>()); | ||
6| 1|} | ||
7| | | ||
8| |#[inline] | ||
9| 1|fn live<const B: bool>() -> u32 { | ||
10| 1| if B { | ||
11| 0| dead() | ||
12| | } else { | ||
13| 1| 0 | ||
14| | } | ||
15| 1|} | ||
16| | | ||
17| |#[inline] | ||
18| 0|fn dead() -> u32 { | ||
19| 0| 42 | ||
20| 0|} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Regression test for issue #98833. | ||
// compile-flags: -Zinline-mir | ||
|
||
fn main() { | ||
println!("{}", live::<false>()); | ||
} | ||
|
||
#[inline] | ||
fn live<const B: bool>() -> u32 { | ||
if B { | ||
dead() | ||
} else { | ||
0 | ||
} | ||
} | ||
|
||
#[inline] | ||
fn dead() -> u32 { | ||
42 | ||
} |