You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PR #84797 (Report coverage 0 of dead blocks, merged on May 7, 2021) replaces any MIR Coverage statement that is about to be dropped during MIR simplification with a CoverageKind::Unreachable statement, and adds that statement to the START_BLOCK. This makes it possible to still add the CodeRegions for the removed (unreachable) code to the coverage map, so they can be reported as unexecuted code.
The MIR InstrumentCoverage pass always adds a CoverageKind::Counter to the START_BLOCK (so if a function is called, it is counted), and I assumed that the START_BLOCK itself could never be simplified away.
However, when compiling some complex async and executor constructions from a large code base, the compiler ICE'd, and I was able to determine that some kind of MIR transform can drop the START_BLOCK, and can generate a final MIR that has all CoverageKind::Counter statements replaced with CoverageKind::Unreachable statements.
The ICE is caused now when a function has CoverageKind::Unreachable statements and no CoverageKind::Counter. At least one CoverageKind::Counter is required, to set the function hash for LLVM InstrProf, and an assert!() fails when generating the coverage map (for the unreachable regions) without this function hash.
A PR that fixes this issue has been uploaded (#85082).
The text was updated successfully, but these errors were encountered:
Fixes: rust-lang#85081
An `assert!()` in `FunctionCoverage` failed, because PR rust-lang#84797
replaces unreachable `Counter`s with `Unreachable` code regions to be
added to the function's coverage map.
To fix it, and still generate valid LLVM coverage IR, convert one
unreachable to a `Counter`.
PR #84797 (Report coverage 0 of dead blocks, merged on May 7, 2021) replaces any MIR
Coverage
statement that is about to be dropped during MIR simplification with aCoverageKind::Unreachable
statement, and adds that statement to theSTART_BLOCK
. This makes it possible to still add theCodeRegions
for the removed (unreachable) code to the coverage map, so they can be reported as unexecuted code.The MIR
InstrumentCoverage
pass always adds aCoverageKind::Counter
to theSTART_BLOCK
(so if a function is called, it is counted), and I assumed that theSTART_BLOCK
itself could never be simplified away.However, when compiling some complex async and executor constructions from a large code base, the compiler ICE'd, and I was able to determine that some kind of MIR transform can drop the
START_BLOCK
, and can generate a final MIR that has allCoverageKind::Counter
statements replaced withCoverageKind::Unreachable
statements.The ICE is caused now when a function has
CoverageKind::Unreachable
statements and noCoverageKind::Counter
. At least oneCoverageKind::Counter
is required, to set the function hash for LLVM InstrProf, and anassert!()
fails when generating the coverage map (for the unreachable regions) without this function hash.A PR that fixes this issue has been uploaded (#85082).
The text was updated successfully, but these errors were encountered: