rust/compiler
Rich Kadel 7ceff6835a Translate counters from Rust 1-based to LLVM 0-based counter ids
A colleague contacted me and asked why Rust's counters start at 1, when
Clangs appear to start at 0. There is a reason why Rust's internal
counters start at 1 (see the docs), and I tried to keep them consistent
when codegenned to LLVM's coverage mapping format. LLVM should be
tolerant of missing counters, but as my colleague pointed out,
`llvm-cov` will silently fail to generate a coverage report for a
function based on LLVM's assumption that the counters are 0-based.

See:
https://github.com/llvm/llvm-project/blob/main/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp#L170

Apparently, if, for example, a function has no branches, it would have
exactly 1 counter. `CounterValues.size()` would be 1, and (with the
1-based index), the counter ID would be 1. This would fail the check
and abort reporting coverage for the function.

It turns out that by correcting for this during coverage map generation,
by subtracting 1 from the Rust Counter ID (both when generating the
counter increment intrinsic call, and when adding counters to the map),
some uncovered functions (including in tests) now appear covered! This
corrects the coverage for a few tests!
2021-04-02 17:16:36 -07:00
..
rustc Rollup merge of #82642 - sfackler:jemalloc-zone, r=pnkfelix 2021-03-08 13:13:22 +01:00
rustc_apfloat Use iter::zip in compiler/ 2021-03-26 09:32:31 -07:00
rustc_arena Remove (lots of) dead code 2021-03-27 22:16:33 -04:00
rustc_ast Remove (lots of) dead code 2021-03-27 22:16:33 -04:00
rustc_ast_lowering Remove hir::CrateItem. 2021-03-30 20:31:06 +02:00
rustc_ast_passes Auto merge of #80965 - camelid:rename-doc-spotlight, r=jyn514 2021-04-02 07:04:58 +00:00
rustc_ast_pretty Remove (lots of) dead code 2021-03-27 22:16:33 -04:00
rustc_attr stabilize or_patterns 2021-03-19 19:45:32 -05:00
rustc_builtin_macros Use iter::zip in compiler/ 2021-03-26 09:32:31 -07:00
rustc_codegen_cranelift Merge commit '0969bc6dde001e01e7e1f58c8ccd7750f8a49ae1' into sync_cg_clif-2021-03-29 2021-03-29 10:45:09 +02:00
rustc_codegen_llvm Translate counters from Rust 1-based to LLVM 0-based counter ids 2021-04-02 17:16:36 -07:00
rustc_codegen_ssa Translate counters from Rust 1-based to LLVM 0-based counter ids 2021-04-02 17:16:36 -07:00
rustc_data_structures Revert changes to sync data structures 2021-03-29 13:50:40 -04:00
rustc_driver Address review comments 2021-03-27 22:16:34 -04:00
rustc_error_codes progress, stuff compiles now 2021-03-23 17:16:20 +00:00
rustc_errors Auto merge of #83639 - osa1:issue83638, r=estebank 2021-03-30 17:07:19 +00:00
rustc_expand address comments 2021-04-02 08:08:02 +08:00
rustc_feature Auto merge of #80965 - camelid:rename-doc-spotlight, r=jyn514 2021-04-02 07:04:58 +00:00
rustc_fs_util
rustc_graphviz Remove (lots of) dead code 2021-03-27 22:16:33 -04:00
rustc_hir Add var to BoundRegion. Add query to get bound vars for applicable items. 2021-03-31 10:16:37 -04:00
rustc_hir_pretty Remove hir::CrateItem. 2021-03-30 20:31:06 +02:00
rustc_incremental Also profile finishing the encoding. 2021-03-30 18:10:08 +02:00
rustc_index Use iter::zip in compiler/ 2021-03-26 09:32:31 -07:00
rustc_infer Auto merge of #83207 - oli-obk:valtree2, r=lcnr 2021-04-02 10:28:12 +00:00
rustc_interface Stream the dep-graph to a file. 2021-03-30 18:09:59 +02:00
rustc_lexer
rustc_lint add OR_PATTERNS_BACK_COMPAT lint 2021-04-01 23:14:14 +08:00
rustc_lint_defs add OR_PATTERNS_BACK_COMPAT lint 2021-04-01 23:14:14 +08:00
rustc_llvm Auto merge of #83387 - cuviper:min-llvm-10, r=nagisa 2021-03-25 13:11:18 +00:00
rustc_macros Use iter::zip in compiler/ 2021-03-26 09:32:31 -07:00
rustc_metadata Remove hir::CrateItem. 2021-03-30 20:31:06 +02:00
rustc_middle Translate counters from Rust 1-based to LLVM 0-based counter ids 2021-04-02 17:16:36 -07:00
rustc_mir Auto merge of #76881 - hameerabbasi:issue-53325, r=oli-obk 2021-04-02 17:38:57 +00:00
rustc_mir_build Auto merge of #83207 - oli-obk:valtree2, r=lcnr 2021-04-02 10:28:12 +00:00
rustc_parse Always preserve None-delimited groups in a captured TokenStream 2021-03-26 23:32:18 -04:00
rustc_parse_format Rollup merge of #83348 - osa1:issue83344, r=jackh726 2021-03-28 01:33:13 +09:00
rustc_passes Auto merge of #80965 - camelid:rename-doc-spotlight, r=jyn514 2021-04-02 07:04:58 +00:00
rustc_plugin_impl Remove hir::Item::attrs. 2021-03-09 19:27:50 +01:00
rustc_privacy Update with comments 2021-03-23 17:16:20 +00:00
rustc_query_impl Auto merge of #83207 - oli-obk:valtree2, r=lcnr 2021-04-02 10:28:12 +00:00
rustc_query_system Enable debugging the dep-graph without debug-assertions. 2021-03-31 17:12:06 +02:00
rustc_resolve Cleanups and comments 2021-03-31 10:16:37 -04:00
rustc_save_analysis Remove hir::CrateItem. 2021-03-30 20:31:06 +02:00
rustc_serialize Auto merge of #83465 - michaelwoerister:safe-read_raw_bytes, r=cjgillot 2021-03-26 01:28:59 +00:00
rustc_session Clarify --print target-list is a rustc's option 2021-04-01 01:59:50 +09:00
rustc_span Auto merge of #80965 - camelid:rename-doc-spotlight, r=jyn514 2021-04-02 07:04:58 +00:00
rustc_symbol_mangling Add var to BoundRegion. Add query to get bound vars for applicable items. 2021-03-31 10:16:37 -04:00
rustc_target linker: Use data execution prevention options by default when linker supports them 2021-03-28 23:44:40 +03:00
rustc_trait_selection Rollup merge of #83673 - hi-rustin:rustin-patch-suggestion, r=estebank 2021-04-02 19:57:32 +02:00
rustc_traits Auto merge of #83207 - oli-obk:valtree2, r=lcnr 2021-04-02 10:28:12 +00:00
rustc_ty_utils Track bound vars 2021-03-31 10:15:27 -04:00
rustc_type_ir New pass to deduplicate blocks 2021-02-21 21:51:54 +01:00
rustc_typeck Rollup merge of #83757 - sexxi-goose:migrations_out, r=nikomatsakis 2021-04-02 19:57:34 +02:00