rust/compiler/rustc_mir_transform/src
Matthias Krüger 57cbd078f2
Rollup merge of #134497 - Zalathar:spans, r=jieyouxu
coverage: Store coverage source regions as `Span` until codegen (take 2)

This is an attempt to re-land #133418:

> Historically, coverage spans were converted into line/column coordinates during the MIR instrumentation pass.

> This PR moves that conversion step into codegen, so that coverage spans spend most of their time stored as Span instead.

> In addition to being conceptually nicer, this also reduces the size of coverage mappings in MIR, because Span is smaller than 4x u32.

That PR was reverted by #133608, because in some circumstances not covered by our test suite we were emitting coverage metadata that was causing `llvm-cov` to exit with an error (#133606).

---

The implementation here is *mostly* the same, but adapted for subsequent changes in the relevant code (e.g. #134163).

I believe that the changes in #134163 should be sufficient to prevent the problem that required the original PR to be reverted. But I haven't been able to reproduce the original breakage in a regression test, and the `llvm-cov` error message is extremely unhelpful, so I can't completely rule out the possibility of this breaking again.

r? jieyouxu (reviewer of the original PR)
2024-12-19 15:26:16 +01:00
..
coroutine Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
coverage coverage: Store coverage source regions as Span until codegen 2024-12-19 18:09:09 +11:00
inline use TypingEnv when no infcx is available 2024-11-18 10:38:56 +01:00
shim mir: require is_cleanup when creating BasicBlockData 2024-12-18 20:43:54 +08:00
abort_unwinding_calls.rs compiler: Directly use rustc_abi in mir_transform 2024-11-03 13:38:47 -08:00
add_call_guards.rs Inline and remove some functions. 2024-09-10 08:54:17 +10:00
add_moves_for_packed_drops.rs use TypingEnv when no infcx is available 2024-11-18 10:38:56 +01:00
add_retag.rs Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
add_subtyping_projections.rs Inline and remove some functions. 2024-09-10 08:54:17 +10:00
check_alignment.rs move fn is_item_raw to TypingEnv 2024-11-19 18:06:20 +01:00
check_const_item_mutation.rs Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
check_packed_ref.rs use TypingEnv when no infcx is available 2024-11-18 10:38:56 +01:00
check_undefined_transmutes.rs Add a Lint for Pointer to Integer Transmutes in Consts 2024-10-05 12:48:02 +00:00
cleanup_post_borrowck.rs be even more precise about "cast" vs "coercion" 2024-09-24 23:12:02 +02:00
copy_prop.rs move fn is_item_raw to TypingEnv 2024-11-19 18:06:20 +01:00
coroutine.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
cost_checker.rs use TypingEnv when no infcx is available 2024-11-18 10:38:56 +01:00
cross_crate_inline.rs rename rustc_attr to rustc_attr_parsing and create rustc_attr_data_structures 2024-12-16 19:08:19 +01:00
ctfe_limit.rs Reduce visibilities, and add warn(unreachable_pub). 2024-09-09 08:48:09 +10:00
dataflow_const_prop.rs Rollup merge of #133938 - nnethercote:rustc_mir_dataflow-renamings, r=oli-obk 2024-12-13 17:25:29 +01:00
dead_store_elimination.rs reduce false positives of tail-expr-drop-order from consumed values 2024-11-20 20:53:11 +08:00
deduce_param_attrs.rs move fn is_item_raw to TypingEnv 2024-11-19 18:06:20 +01:00
deduplicate_blocks.rs Rename and reorder lots of lifetimes. 2024-09-13 15:46:20 +10:00
deref_separator.rs Use LocalDecls in a couple of places. 2024-09-09 15:15:44 +10:00
dest_prop.rs Remove -Zfuel. 2024-11-26 10:45:21 +00:00
dump_mir.rs Dogfood feature(file_buffered) 2024-09-24 14:25:16 -07:00
early_otherwise_branch.rs mir-opt: Do not handle the cleanup BB in the EarlyOtherwiseBranch 2024-12-18 20:43:55 +08:00
elaborate_box_derefs.rs compiler: Directly use rustc_abi in mir_transform 2024-11-03 13:38:47 -08:00
elaborate_drops.rs Improve terminology in elaborate_drops.rs. 2024-12-10 12:06:03 +11:00
errors.rs Validate and test -Zmir-enable-passes 2024-11-12 13:28:05 +00:00
ffi_unwind_calls.rs compiler: Directly use rustc_abi in mir_transform 2024-11-03 13:38:47 -08:00
function_item_references.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
gvn.rs Do not unify dereferences in GVN. 2024-11-25 20:19:08 +01:00
inline.rs mir: require is_cleanup when creating BasicBlockData 2024-12-18 20:43:54 +08:00
instsimplify.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
jump_threading.rs Variants::Single: do not use invalid VariantIdx for uninhabited enums 2024-12-18 11:00:21 +01:00
known_panics_lint.rs remove remaining references to Reveal 2024-11-23 13:52:56 +01:00
large_enums.rs make no-variant types a dedicated Variants variant 2024-12-18 11:01:54 +01:00
lib.rs We don't need NonNull::as_ptr debuginfo 2024-12-10 01:29:43 -08:00
lint.rs Move always_storage_live_locals. 2024-11-26 12:05:57 +11:00
lint_tail_expr_drop_order.rs Change ChunkedBitSet<MovePathIndex>s to MixedBitSet. 2024-12-05 20:07:26 +11:00
lower_intrinsics.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
lower_slice_len.rs Inline and remove some functions. 2024-09-10 08:54:17 +10:00
match_branches.rs Remove -Zfuel. 2024-11-26 10:45:21 +00:00
mentioned_items.rs be even more precise about "cast" vs "coercion" 2024-09-24 23:12:02 +02:00
multiple_return_terminators.rs Remove -Zfuel. 2024-11-26 10:45:21 +00:00
nrvo.rs Remove -Zfuel. 2024-11-26 10:45:21 +00:00
pass_manager.rs mir validator: don't store mir phase 2024-12-02 13:38:18 +01:00
post_analysis_normalize.rs rebase 2024-11-23 13:52:57 +01:00
post_drop_elaboration.rs Make check_live_drops into a MirLint. 2024-09-10 09:11:17 +10:00
prettify.rs Improve comment formatting. 2024-09-10 08:42:30 +10:00
promote_consts.rs use TypingEnv when no infcx is available 2024-11-18 10:38:56 +01:00
ref_prop.rs Move always_storage_live_locals. 2024-11-26 12:05:57 +11:00
remove_noop_landing_pads.rs reduce false positives of tail-expr-drop-order from consumed values 2024-11-20 20:53:11 +08:00
remove_place_mention.rs Reduce visibilities, and add warn(unreachable_pub). 2024-09-09 08:48:09 +10:00
remove_storage_markers.rs Reduce visibilities, and add warn(unreachable_pub). 2024-09-09 08:48:09 +10:00
remove_uninit_drops.rs Change ChunkedBitSet<MovePathIndex>s to MixedBitSet. 2024-12-05 20:07:26 +11:00
remove_unneeded_drops.rs Remove -Zfuel. 2024-11-26 10:45:21 +00:00
remove_zsts.rs Remove -Zfuel. 2024-11-26 10:45:21 +00:00
required_consts.rs Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
sanity_check.rs Move MirPass to rustc_mir_transform. 2024-09-03 16:03:46 +10:00
shim.rs Implement projection and shim for AFIDT 2024-12-10 16:52:20 +00:00
simplify.rs reduce false positives of tail-expr-drop-order from consumed values 2024-11-20 20:53:11 +08:00
simplify_branches.rs use TypingEnv when no infcx is available 2024-11-18 10:38:56 +01:00
simplify_comparison_integral.rs use TypingEnv when no infcx is available 2024-11-18 10:38:56 +01:00
single_use_consts.rs cleanup: don't clone types that are Copy 2024-09-29 13:31:30 +02:00
sroa.rs use TypingEnv when no infcx is available 2024-11-18 10:38:56 +01:00
ssa.rs move fn is_item_raw to TypingEnv 2024-11-19 18:06:20 +01:00
strip_debuginfo.rs We don't need NonNull::as_ptr debuginfo 2024-12-10 01:29:43 -08:00
unreachable_enum_branching.rs make no-variant types a dedicated Variants variant 2024-12-18 11:01:54 +01:00
unreachable_prop.rs Remove -Zfuel. 2024-11-26 10:45:21 +00:00
validate.rs Bounds-check with PtrMetadata instead of Len in MIR 2024-12-03 11:05:45 -08:00