Skip to content

PR #84797 causes an ICE in some situations #85081

Closed

Description

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions