about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src/coverage/counters
AgeCommit message (Collapse)AuthorLines
2025-08-22Uplift rustc_mir_transform::coverage::counters::union_find to ↵Camille Gillot-130/+1
rustc_data_structures.
2025-02-10Rollup merge of #136053 - Zalathar:defer-counters, r=saethlinJubilee-24/+1
coverage: Defer part of counter-creation until codegen Follow-up to #135481 and #135873. One of the pleasant properties of the new counter-assignment algorithm is that we can stop partway through the process, store the intermediate state in MIR, and then resume the rest of the algorithm during codegen. This lets it take into account which parts of the control-flow graph were eliminated by MIR opts, resulting in fewer physical counters and simpler counter expressions. Those improvements end up completely obsoleting much larger chunks of code that were previously responsible for cleaning up the coverage metadata after MIR opts, while also doing a more thorough cleanup job. (That change also unlocks some further simplifications that I've kept out of this PR to limit its scope.)
2025-02-08Rustfmtbjorn3-19/+15
2025-02-06coverage: Defer part of counter-creation until codegenZalathar-24/+1
2025-01-26Incorporate `iter_nodes` into `graph::DirectedGraph`Zalathar-19/+0
This assumes that the set of valid node IDs is exactly `0..num_nodes`. In practice, we have a lot of graph-algorithm code that already assumes that nodes are densely numbered, by using `num_nodes` to allocate per-node indexed data structures.
2025-01-24coverage: Treat the "merged node flow graph" as a plain data structZalathar-78/+82
By removing all methods from this struct and treating it as a collection of data fields, we make it easier for a future PR to store that data in a query result, without having to move all of its methods into `rustc_middle`.
2025-01-24coverage: Replace `FrozenUnionFind` with a plain IndexVecZalathar-31/+11
This dedicated type seemed like a good idea at the time, but if we want to store this information in a query result then a plainer data type is more convenient.
2025-01-24coverage: Simplify how counter terms are storedZalathar-27/+17
Using `SmallVec` here was fine when it was a module-private detail, but if we want to pass these terms across query boundaries then it's not worth the extra hassle. Replacing a method call with direct field access is slightly simpler. Using the name `counter_terms` is more consistent with other code that tries to maintain a distinction between (physical) "counters" and "expressions".
2025-01-16coverage: Make `yank_to_spantree_root` iterative instead of recursiveZalathar-19/+35
This avoids having to worry about stack space when traversing very long spantree paths, e.g. when instrumenting a long sequence of if/else statements.
2025-01-16coverage: Completely overhaul counter assignment, using node-flow graphsZalathar-41/+651
2024-12-04coverage: Add an extra "transcribe" step after counter creationZalathar-0/+41