coverage: Migrate branch coverage to use CoveragePoint and HIR analysis - #162425
coverage: Migrate branch coverage to use CoveragePoint and HIR analysis#162425Zalathar wants to merge 1 commit into
Conversation
|
Some changes occurred in match lowering cc @Nadrieril Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
|
r? @fee1-dead rustbot has assigned @fee1-dead. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
|
This comment has been minimized.
This comment has been minimized.
While we still rely on injecting markers into the true and false blocks of a condition during MIR building, this approach avoids the need for a separate side-table, as the association between true/false markers can be recovered by matching their HirId. There is no longer any need to keep track of enclosing `!` expressions, because with HirId we can instead walk up the HIR parent chain to find the original condition. `CoverageEarlyInfo` and `CoverageKind::BlockMarker` have been removed, as they are no longer needed.
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
Proactively rerolling as @fee1-dead has usually declined to do reviews of coverage in the past. 👍 If someone wants to take this on, please feel free to ask for context, as there aren't many people with deep knowledge of coverage instrumentation. r? compiler |
Historically, the implementation of branch coverage instrumentation (#122322) required keeping a side-table of branch spans associated with opaque marker-statement IDs, which corresponded to injected marker statements. Using similar techniques to #161517, this PR instead injects marker statements that associate the true/false destination blocks with the HirId of the expression being inspected.
While we still rely on injecting markers into the true and false blocks of a condition during MIR building, this approach avoids the need for a separate side-table, as the association between true/false markers can be recovered by matching their HirId.
There is no longer any need to keep track of enclosing
!expressions, because with HirId we can instead walk up the HIR parent chain to find the original condition.CoverageEarlyInfoandCoverageKind::BlockMarkerhave been removed, as theyare no longer needed.