rust/compiler/rustc_middle/src
bors 36aab8df0a Auto merge of #115301 - Zalathar:regions-vec, r=davidtwco
coverage: Allow each coverage statement to have multiple code regions

The original implementation of coverage instrumentation was built around the assumption that a coverage counter/expression would be associated with *up to one* code region. When it was discovered that *multiple* regions would sometimes need to share a counter, a workaround was found: for the remaining regions, the instrumentor would create a fresh expression that adds zero  to the existing counter/expression.

That got the job done, but resulted in some awkward code, and produces unnecessarily complicated coverage maps in the final binary.

---

This PR removes that tension by changing `StatementKind::Coverage`'s code region field from `Option<CodeRegion>` to `Vec<CodeRegion>`.

The changes on the codegen side are fairly straightforward. As long as each `CoverageKind::Counter` only injects one `llvm.instrprof.increment`, the rest of coverage codegen is happy to handle multiple regions mapped to the same counter/expression, with only minor option-to-vec adjustments.

On the instrumentor/mir-transform side, we can get rid of the code that creates extra (x + 0) expressions. Instead we gather all of the code regions associated with a single BCB, and inject them all into one coverage statement.

---

There are several patches here but they can be divided in to three phases:
- Preparatory work
- Actually switching over to multiple regions per coverage statement
- Cleaning up

So viewing the patches individually may be easier.
2023-10-03 18:36:21 +00:00
..
dep_graph Move DepKind to rustc_query_system and define it as u16 2023-09-21 17:06:14 +02:00
hir Don't store lazyness in DefKind 2023-09-26 02:53:59 +00:00
hooks Add tracing instrumentation, just like queries automatically add it 2023-09-22 09:25:38 +00:00
infer Remove span from BrAnon. 2023-09-24 09:46:55 +00:00
middle Rework no_coverage to coverage(off) 2023-09-08 12:46:06 +01:00
mir Auto merge of #115301 - Zalathar:regions-vec, r=davidtwco 2023-10-03 18:36:21 +00:00
query Don't store lazyness in DefKind 2023-09-26 02:53:59 +00:00
thir rename mir::Constant -> mir::ConstOperand, mir::ConstKind -> mir::Const 2023-09-21 08:12:30 +02:00
traits Check types live across yields in generators too 2023-09-23 04:19:14 +00:00
ty Rollup merge of #116261 - lcnr:wf-only-clause, r=davidtwco 2023-10-03 16:24:15 +02:00
util Merge ExternProviders into the general Providers struct 2023-09-22 20:15:34 +00:00
arena.rs Remove metadata_loader query 2023-08-13 16:38:50 +00:00
error.rs don't point at const usage site for resolution-time errors 2023-09-14 22:34:05 +02:00
lib.rs Add a way to decouple the implementation and the declaration of a TyCtxt method. 2023-09-22 09:23:15 +00:00
lint.rs give FutureIncompatibilityReason variants more explicit names 2023-09-22 08:51:18 +02:00
macros.rs Rename CloneLiftImpls as TrivialLiftImpls. 2023-09-18 09:37:09 +10:00
metadata.rs rustc_metadata: Remove Span from ModChild 2023-04-18 17:25:04 +03:00
tests.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
thir.rs Auto merge of #115887 - RalfJung:pat, r=oli-obk 2023-09-27 13:20:53 +00:00
values.rs Don't store lazyness in DefKind 2023-09-26 02:53:59 +00:00