rust/tests
Matthias Krüger 4aae8d15d6
Rollup merge of #135481 - Zalathar:node-flow, r=oli-obk
coverage: Completely overhaul counter assignment, using node-flow graphs

The existing code for choosing where to put physical counter-increments gets the job done, but is very ad-hoc and hard to modify without introducing tricky regressions.

This PR replaces all of that with a more principled approach, based on the algorithm described in "Optimal measurement points for program frequency counts" (Knuth & Stevenson, 1973).

---

We start by ensuring that our graph has “balanced flow”, i.e. each node's flow (execution count) is equal to the sum of all its in-edge flows, and equal to the sum of all its out-edge flows. That isn't naturally true of control-flow graphs, so we introduce a wrapper type `BalancedFlowGraph` to fix that by introducing synthetic nodes and edges as needed.

Once our graph has balanced flow, the next step is to create another view of that graph in which each node's successors have all been merged into one “supernode”. Consequently, each node's out-edges can be coalesced into a single out-edge to one of those supernodes. Because of the balanced-flow property, the flow of that coalesced edge is equal to the flow of the original node.

Having expressed all of our node flows as edge flows, we can then analyze node flows using techniques for analyzing edge flows. We incrementally build a spanning tree over the merged supernodes, such that each new edge in the spanning tree represents a node whose flow can be computed from that of other nodes.

When this is done, we end up with a list of “counter terms” for each node, describing which nodes need physical counters, and how the remaining nodes can have their flow calculated by adding and subtracting those physical counters.

---

The re-blessed coverage tests show that this results in modest or major improvements for our test programs. Some tests need fewer physical counters, some tests need fewer expression nodes for the same number of physical counters, and some tests show striking reductions in both.
2025-01-16 18:46:09 +01:00
..
assembly llvm: Allow sized-word rather than ymmword in tests 2025-01-13 20:50:57 +00:00
auxiliary tests/assembly/asm: Remove uses of rustc_attrs and lang_items features by using minicore 2024-12-18 02:59:07 +09:00
codegen Auto merge of #135204 - RalfJung:win64-zst, r=SparrowLii 2025-01-13 13:05:53 +00:00
codegen-units Make sure we actually use the right trivial lifetime substs when eagerly monomorphizing drop for structs 2025-01-15 04:20:25 +00:00
coverage coverage: Completely overhaul counter assignment, using node-flow graphs 2025-01-16 22:07:18 +11:00
coverage-run-rustdoc coverage: Restrict empty-span expansion to only cover { and } 2024-11-08 20:43:08 +11:00
crashes fix ICE with references to infinite structs in consts 2025-01-14 01:22:04 +01:00
debuginfo Revert "Remove the Arc rt::init allocation for thread info" 2025-01-14 13:37:25 +01:00
incremental add test for issue 135514 2025-01-15 08:26:23 +00:00
mir-opt Rollup merge of #135481 - Zalathar:node-flow, r=oli-obk 2025-01-16 18:46:09 +01:00
pretty Update tests to use new proc-macro header 2024-11-27 07:18:25 -08:00
run-make Auto merge of #135458 - jieyouxu:migrate-extern-fn-reachable, r=lqd 2025-01-16 02:31:22 +00:00
rustdoc Rollup merge of #134216 - GuillaumeGomez:jump-to-def-pats, r=fmease 2025-01-14 19:25:04 +01:00
rustdoc-gui Add GUI test for #135499 2025-01-15 16:31:20 +01:00
rustdoc-js Rollup merge of #134277 - notriddle:notriddle/inline-into, r=GuillaumeGomez 2024-12-16 20:00:20 +01:00
rustdoc-js-std for purely return-type based searches, deprioritize clone-like functions 2025-01-13 12:22:34 -06:00
rustdoc-json Rollup merge of #134880 - as1100k-forks:fix-rustdoc-json-path-name, r=aDotInTheVoid 2025-01-14 19:25:05 +01:00
rustdoc-ui Remove some empty expected files to fix blessing 2025-01-12 12:49:24 +02:00
ui Rollup merge of #134754 - frank-king:feature/import_trait_associated_functions, r=oli-obk 2025-01-16 18:46:08 +01:00
ui-fulldeps Rollup merge of #134834 - dtolnay:unnamedcall, r=compiler-errors 2024-12-27 18:43:05 -08:00
COMPILER_TESTS.md