rust/compiler
Matthias Krüger 553db5faee
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.
2024-12-04 18:23:42 +01:00
..
rustc switch jemalloc-sys back to tikv-jemalloc-sys, and update to 0.6.0 2024-12-03 08:56:33 +00:00
rustc_abi fix safe-transmute handling of enums 2024-12-01 18:28:04 +01:00
rustc_arena move strict provenance lints to new feature gate, remove old feature gates 2024-10-21 15:22:17 +01:00
rustc_ast Rollup merge of #133784 - dtolnay:visitspans, r=compiler-errors 2024-12-04 05:42:08 +01:00
rustc_ast_ir Add sugar for &pin (const|mut) types 2024-10-07 11:15:04 -07:00
rustc_ast_lowering Rollup merge of #133779 - BoxyUwU:array_const_arg_infer_hir_id, r=compiler-errors 2024-12-03 17:27:10 +01:00
rustc_ast_passes Rollup merge of #133847 - nnethercote:rm-Z-show-span, r=compiler-errors 2024-12-04 18:23:42 +01:00
rustc_ast_pretty Rollup merge of #133746 - oli-obk:push-xwyrylxmrtvq, r=jieyouxu 2024-12-02 23:08:58 +01:00
rustc_attr ensure that all publicly reachable const fn have const stability info 2024-11-10 10:16:26 +01:00
rustc_baked_icu_data Delete the cfg(not(parallel)) serial compiler 2024-11-12 13:38:58 +00:00
rustc_borrowck Rollup merge of #133798 - lcnr:nested-bodies-opaques, r=compiler-errors 2024-12-04 05:42:08 +01:00
rustc_builtin_macros make CoercePointee errors translatable 2024-12-04 20:34:48 +08:00
rustc_codegen_cranelift Rollup merge of #133545 - clubby789:symbol-intern-lit, r=jieyouxu 2024-12-03 17:27:06 +01:00
rustc_codegen_gcc Rollup merge of #133395 - calebzulawski:simd_relaxed_fma, r=workingjubilee 2024-12-03 07:48:33 +01:00
rustc_codegen_llvm Auto merge of #104342 - mweber15:add_file_location_to_more_types, r=wesleywiser 2024-12-03 12:49:57 +00:00
rustc_codegen_ssa Rollup merge of #133041 - madsmtm:print-deployment-target-env-var, r=davidtwco 2024-12-03 07:48:31 +01:00
rustc_const_eval Rollup merge of #133681 - RalfJung:niches, r=wesleywiser 2024-12-03 21:55:26 +01:00
rustc_data_structures Assert that obligations are empty before deeply normalizing 2024-12-02 22:51:18 +00:00
rustc_driver Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_driver_impl Rollup merge of #133847 - nnethercote:rm-Z-show-span, r=compiler-errors 2024-12-04 18:23:42 +01:00
rustc_error_codes Rollup merge of #133726 - joshtriplett:breakpoint, r=oli-obk 2024-12-03 21:55:27 +01:00
rustc_error_messages Delete the cfg(not(parallel)) serial compiler 2024-11-12 13:38:58 +00:00
rustc_errors Eliminate magic numbers from expression precedence 2024-11-30 17:53:40 -08:00
rustc_expand Change AttrArgs::Eq into a struct variant 2024-12-02 10:28:58 +00:00
rustc_feature Auto merge of #133818 - matthiaskrgr:rollup-iav1wq7, r=matthiaskrgr 2024-12-04 00:47:09 +00:00
rustc_fluent_macro use tracked_path in rustc_fluent_macro 2024-10-19 22:32:38 +08:00
rustc_fs_util Couple of changes to make it easier to compile rustc for wasm 2024-09-26 19:51:14 +00:00
rustc_graphviz Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
rustc_hir Rollup merge of #133603 - dtolnay:precedence, r=lcnr 2024-12-02 17:36:03 +01:00
rustc_hir_analysis Rollup merge of #133831 - BoxyUwU:ice_on_unfed_type_of, r=compiler-errors 2024-12-04 18:23:39 +01:00
rustc_hir_pretty Rollup merge of #133603 - dtolnay:precedence, r=lcnr 2024-12-02 17:36:03 +01:00
rustc_hir_typeck Rollup merge of #133558 - compiler-errors:structurally-resolve-probe-adt, r=lcnr 2024-12-03 17:27:07 +01:00
rustc_incremental Move some code from Compiler::enter to GlobalCtxt::finish 2024-11-09 17:55:39 +00:00
rustc_index Remove HybridBitSet. 2024-11-29 17:23:34 +11:00
rustc_index_macros Auto merge of #130867 - michirakara:steps_between, r=dtolnay 2024-11-22 10:54:22 +00:00
rustc_infer Assert that obligations are empty before deeply normalizing 2024-12-02 22:51:18 +00:00
rustc_interface Rollup merge of #133847 - nnethercote:rm-Z-show-span, r=compiler-errors 2024-12-04 18:23:42 +01:00
rustc_lexer Revert "Reject raw lifetime followed by \' as well" 2024-12-01 05:22:16 +00:00
rustc_lint Rollup merge of #133753 - dingxiangfei2009:reduce-false-positive-if-let-rescope, r=jieyouxu 2024-12-03 17:27:08 +01:00
rustc_lint_defs Rollup merge of #133535 - RalfJung:forbidden_lint_groups-future-compat, r=davidtwco 2024-12-02 23:08:53 +01:00
rustc_llvm Respect verify-llvm-ir option in the backend 2024-11-26 15:26:03 +01:00
rustc_log Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
rustc_macros give a better error for tuple structs in derive(Diagnostic) 2024-10-27 21:23:28 -04:00
rustc_metadata Rollup merge of #133779 - BoxyUwU:array_const_arg_infer_hir_id, r=compiler-errors 2024-12-03 17:27:10 +01:00
rustc_middle Rollup merge of #133681 - RalfJung:niches, r=wesleywiser 2024-12-03 21:55:26 +01:00
rustc_mir_build remove Ty::is_copy_modulo_regions 2024-12-02 13:57:56 +01:00
rustc_mir_dataflow Simplify ResultsHandle. 2024-12-02 16:19:17 +11:00
rustc_mir_transform coverage: Remove the expression simplifier from CoverageCounters 2024-12-04 17:55:57 +11:00
rustc_monomorphize Share inline(never) generics across crates 2024-11-28 13:43:05 -05:00
rustc_next_trait_solver support revealing defined opaque post borrowck 2024-11-28 10:40:58 +01:00
rustc_parse Rollup merge of #133545 - clubby789:symbol-intern-lit, r=jieyouxu 2024-12-03 17:27:06 +01:00
rustc_parse_format Remove 'apostrophes' from rustc_parse_format 2024-10-14 23:22:51 +02:00
rustc_passes Auto merge of #133321 - compiler-errors:const-checker, r=wesleywiser 2024-12-03 04:39:48 +00:00
rustc_pattern_analysis no more Reveal :( 2024-11-23 13:52:54 +01:00
rustc_privacy Simplify some places that deal with generic parameter defaults 2024-11-11 21:29:18 +01:00
rustc_query_impl Rollup merge of #132410 - bjorn3:yet_another_driver_refactor_round, r=cjgillot 2024-11-27 22:23:24 +01:00
rustc_query_system Auto merge of #124780 - Mark-Simulacrum:lockless-cache, r=lcnr 2024-11-19 02:07:48 +00:00
rustc_resolve Rollup merge of #133545 - clubby789:symbol-intern-lit, r=jieyouxu 2024-12-03 17:27:06 +01:00
rustc_sanitizers use TypingEnv when no infcx is available 2024-11-18 10:38:56 +01:00
rustc_serialize Fix explicit_iter_loop in rustc_serialize 2024-10-16 15:44:16 +02:00
rustc_session Rollup merge of #133847 - nnethercote:rm-Z-show-span, r=compiler-errors 2024-12-04 18:23:42 +01:00
rustc_smir Rollup merge of #132410 - bjorn3:yet_another_driver_refactor_round, r=cjgillot 2024-11-27 22:23:24 +01:00
rustc_span Rollup merge of #133545 - clubby789:symbol-intern-lit, r=jieyouxu 2024-12-03 17:27:06 +01:00
rustc_symbol_mangling additional TypingEnv cleanups 2024-11-19 21:36:23 +01:00
rustc_target change aix default codemodel=large 2024-12-03 12:44:35 -05:00
rustc_trait_selection Auto merge of #133818 - matthiaskrgr:rollup-iav1wq7, r=matthiaskrgr 2024-12-04 00:47:09 +00:00
rustc_traits Delay a bug when encountering an impl with unconstrained generics in codegen_select 2024-11-23 05:27:45 +00:00
rustc_transmute fix safe-transmute handling of enums 2024-12-01 18:28:04 +01:00
rustc_ty_utils Rollup merge of #133681 - RalfJung:niches, r=wesleywiser 2024-12-03 21:55:26 +01:00
rustc_type_ir Auto merge of #133566 - lcnr:fast-reject-perf, r=compiler-errors 2024-12-02 09:19:20 +00:00
rustc_type_ir_macros do not relate Abi and Safety 2024-10-22 23:13:04 +02:00
stable_mir Rollup merge of #132161 - celinval:smir-fix-indent, r=compiler-errors 2024-11-08 18:51:28 +11:00