diff options
| author | Zalathar <Zalathar@users.noreply.github.com> | 2023-09-25 23:09:27 +1000 |
|---|---|---|
| committer | Zalathar <Zalathar@users.noreply.github.com> | 2023-09-26 20:18:43 +1000 |
| commit | 64df5a851e1cb8c2ae539aa5331d48b8f3646bf4 (patch) | |
| tree | 1475cd8374d8051cfdc3b8e20159bfae12b5ed9c /compiler/rustc_mir_transform/src/coverage/counters.rs | |
| parent | d23062b5be6bbf5be15226c7f497c89cf7d3d6e1 (diff) | |
| download | rust-64df5a851e1cb8c2ae539aa5331d48b8f3646bf4.tar.gz rust-64df5a851e1cb8c2ae539aa5331d48b8f3646bf4.zip | |
Skip MIR pass `UnreachablePropagation` when coverage is enabled
When coverage instrumentation and MIR opts are both enabled, coverage relies on two assumptions: - MIR opts that would delete `StatementKind::Coverage` statements instead move them into bb0 and change them to `CoverageKind::Unreachable`. - MIR opts won't delete all `CoverageKind::Counter` statements from an instrumented function. Most MIR opts naturally satisfy the second assumption, because they won't remove coverage statements from bb0, but `UnreachablePropagation` can do so if it finds that bb0 is unreachable. If this happens, LLVM thinks the function isn't instrumented, and it vanishes from coverage reports. A proper solution won't be possible until after per-function coverage info lands in #116046, but for now we can avoid the problem by turning off this particular pass when coverage instrumentation is enabled.
Diffstat (limited to 'compiler/rustc_mir_transform/src/coverage/counters.rs')
0 files changed, 0 insertions, 0 deletions
