rust/compiler
bors 8532e742fc Auto merge of #78267 - richkadel:llvm-coverage-counters-2.0.3r1, r=tmandry
Working expression optimization, and some improvements to branch-level source coverage

This replaces PR #78040 after reorganizing the original commits (by request) into a more logical sequence of major changes.

Most of the work is in the MIR `transform/coverage/` directory (originally, `transform/instrument_coverage.rs`).

Note this PR includes some significant additional debugging capabilities, to help myself and any future developer working on coverage improvements or issues.

In particular, there's a new Graphviz (.dot file) output for the coverage graph (the `BasicCoverageBlock` control flow graph) that provides ways to get some very good insight into the relationships between the MIR, the coverage graph BCBs, coverage spans, and counters. (There are also some cool debugging options, available via environment variable, to alter how some data in the graph appears.)

And the code for this Graphviz view is actually generic... it can be used by any implementation of the Rust `Graph` traits.

Finally (for now), I also now output information from `llvm-cov` that shows the actual counters and spans it found in the coverage map, and their counts (from the `--debug` flag). I found this to be enormously helpful in debugging some coverage issues, so I kept it in the test results as well for additional context.

`@tmandry` `@wesleywiser`

r? `@tmandry`

Here's an example of the new coverage graph:

* Within each `BasicCoverageBlock` (BCB), you can see each `CoverageSpan` and its contributing statements (MIR `Statement`s and/or `Terminator`s)
* Each `CoverageSpan` has a `Counter` or and `Expression`, and `Expression`s show their Add/Subtract operation with nested operations. (This can be changed to show the Counter and Expression IDs instead, or in addition to, the BCB.)
* The terminators of all MIR `BasicBlock`s in the BCB, including one final `Terminator`
* If an "edge counter" is required (because we need to count an edge between blocks, in some cases) the edge's Counter or Expression is shown next to its label. (Not shown in the example below.) (FYI, Edge Counters are converted into a new MIR `BasicBlock` with `Goto`)

<img width="1116" alt="Screen Shot 2020-10-17 at 12 23 29 AM" src="https://user-images.githubusercontent.com/3827298/96331095-616cb480-100f-11eb-8212-60f2d433e2d8.png">

r? `@tmandry`
FYI: `@wesleywiser`
2020-11-06 06:59:44 +00:00
..
rustc
rustc_apfloat
rustc_arena Fix even more clippy warnings 2020-10-30 10:13:39 -04:00
rustc_ast fix a couple of clippy warnings: 2020-11-04 13:48:50 +01:00
rustc_ast_lowering Implement rustc side of report-future-incompat 2020-10-30 20:02:14 -04:00
rustc_ast_passes Fix typos 2020-10-29 16:51:46 +01:00
rustc_ast_pretty Fix even more clippy warnings 2020-10-30 10:13:39 -04:00
rustc_attr Improve deprecation attribute diagnostic messages. 2020-11-02 13:21:18 +01:00
rustc_builtin_macros
rustc_codegen_cranelift Fix even more URLs 2020-11-05 20:11:29 +01:00
rustc_codegen_llvm Addressed all feedback to date 2020-11-05 18:24:17 -08:00
rustc_codegen_ssa Addressed all feedback to date 2020-11-05 18:24:17 -08:00
rustc_data_structures Move post order walk to iterative approach 2020-10-31 18:52:00 +01:00
rustc_driver Fix even more clippy warnings 2020-10-30 10:13:39 -04:00
rustc_error_codes Rollup merge of #78332 - PoignardAzur:doc_E0308, r=camelid 2020-10-27 08:44:54 +09:00
rustc_errors Auto merge of #76931 - oli-obk:const_prop_inline_lint_madness, r=wesleywiser 2020-11-03 16:32:34 +00:00
rustc_expand Rollup merge of #78626 - fusion-engineering-forks:deprecated-trait-impl, r=estebank 2020-11-03 19:32:36 +01:00
rustc_feature Fix even more clippy warnings 2020-10-30 10:13:39 -04:00
rustc_fs_util
rustc_graphviz Rust coverage before splitting instrument_coverage.rs 2020-11-05 18:24:12 -08:00
rustc_hir Fix even more clippy warnings 2020-10-30 10:13:39 -04:00
rustc_hir_pretty Fix even more clippy warnings 2020-10-30 10:13:39 -04:00
rustc_incremental Delete files immediately, instead of collecting into vector 2020-10-28 17:22:10 +01:00
rustc_index
rustc_infer fix a couple of clippy warnings: 2020-11-04 13:48:50 +01:00
rustc_interface fix a couple of clippy warnings: 2020-11-04 13:48:50 +01:00
rustc_lexer Add back missing comments 2020-10-30 10:13:41 -04:00
rustc_lint Rename lint to non_autolinks 2020-11-05 10:22:08 +01:00
rustc_lint_defs Fix more URLs 2020-11-05 10:23:39 +01:00
rustc_llvm Rollup merge of #77950 - arlosi:sha256, r=eddyb 2020-11-03 19:32:26 +01:00
rustc_macros Remove implicit Continue type 2020-10-30 12:27:47 +01:00
rustc_metadata Auto merge of #78448 - rylev:cache-foreign_modules, r=wesleywiser 2020-11-03 04:27:27 +00:00
rustc_middle Auto merge of #78267 - richkadel:llvm-coverage-counters-2.0.3r1, r=tmandry 2020-11-06 06:59:44 +00:00
rustc_mir Auto merge of #78267 - richkadel:llvm-coverage-counters-2.0.3r1, r=tmandry 2020-11-06 06:59:44 +00:00
rustc_mir_build Auto merge of #77856 - GuillaumeGomez:automatic-links-lint, r=jyn514,ollie27 2020-11-06 04:17:41 +00:00
rustc_parse Fix even more URLs 2020-11-05 20:11:29 +01:00
rustc_parse_format
rustc_passes Rollup merge of #78626 - fusion-engineering-forks:deprecated-trait-impl, r=estebank 2020-11-03 19:32:36 +01:00
rustc_plugin_impl
rustc_privacy Fix even more URLs 2020-11-05 20:11:29 +01:00
rustc_query_system Fix even more clippy warnings 2020-10-30 10:13:39 -04:00
rustc_resolve fix a couple of clippy warnings: 2020-11-04 13:48:50 +01:00
rustc_save_analysis Show the inline stack of MIR lints that only occur after inlining 2020-10-27 14:08:07 +00:00
rustc_serialize
rustc_session Responded to all feedback as of 2020-10-30 2020-11-05 18:24:18 -08:00
rustc_span fix a couple of clippy warnings: 2020-11-04 13:48:50 +01:00
rustc_symbol_mangling u128 truncation and sign extension are not just interpreter related 2020-11-04 13:41:58 +00:00
rustc_target Fix automatic_links warnings 2020-11-05 10:22:08 +01:00
rustc_trait_selection Auto merge of #77856 - GuillaumeGomez:automatic-links-lint, r=jyn514,ollie27 2020-11-06 04:17:41 +00:00
rustc_traits Auto merge of #78182 - LeSeulArtichaut:ty-visitor-contolflow, r=lcnr,oli-obk 2020-10-30 22:53:55 +00:00
rustc_ty
rustc_typeck Rollup merge of #78739 - hameerabbasi:issue-78654, r=nikomatsakis 2020-11-05 10:29:57 +01:00