about summary refs log tree commit diff
path: root/tests/coverage/branch/lazy-boolean.coverage
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-12-04 18:23:42 +0100
committerGitHub <noreply@github.com>2024-12-04 18:23:42 +0100
commit553db5faeea0d5e7aa944706cd833bc93600d632 (patch)
tree54ba1d148864fa1f72b764a047f36a971b82d3ef /tests/coverage/branch/lazy-boolean.coverage
parenta4dc9634a8a7d25fc2ed3b0a5724d19b6e0697ca (diff)
parentba08056d470bc9bfff6304aa436ae3219d2e3775 (diff)
downloadrust-553db5faeea0d5e7aa944706cd833bc93600d632.tar.gz
rust-553db5faeea0d5e7aa944706cd833bc93600d632.zip
Rollup merge of #133849 - Zalathar:replay, r=oli-obk
coverage: Use a separate counter type and simplification step during counter creation

When instrumenting a function's MIR for coverage, there is a point where we need to decide, for each node in the control-flow graph, whether its execution count will be tracked by a physical counter, or by an expression that combines physical counters from other parts of the graph.

Currently the code for doing that is heavily tied to the final form of the LLVM coverage mapping format, and performs some important simplification steps on-the-fly. These factors make the code extremely difficult to modify without breaking or massively worsening the resulting coverage-instrumentation metadata.

---

This PR aims to improve that situation somewhat by adding an extra intermediate representation between the code that chooses how each node will be counted, and the code that converts those decisions into actual tables of physical counters and trees of counter expressions.

As part of doing that, some of the simplifications that are currently performed during the main counter creation step have been pulled out into a separate step.

In most cases the resulting coverage metadata is equivalent, slightly better, or slightly worse. The biggest outlier is `counters.rs`, where the coverage metadata ends up about 10% larger. This seems to be the result of the new approach having less subexpression sharing (because it relies on flatten-sort-cancel), and therefore being less effective at taking advantage of MIR optimizations to replace counters for unused control-flow with zeroes. I think the modest downside is acceptable in light of the future possibilities opened up by this decoupling.
Diffstat (limited to 'tests/coverage/branch/lazy-boolean.coverage')
0 files changed, 0 insertions, 0 deletions