]> git.lizzy.rs Git - rust.git/commitdiff
removed experiments for cleaner github PR
authorRich Kadel <richkadel@google.com>
Fri, 5 Jun 2020 00:52:27 +0000 (17:52 -0700)
committerRich Kadel <richkadel@google.com>
Mon, 15 Jun 2020 23:50:10 +0000 (16:50 -0700)
28 files changed:
src/libcore/intrinsics.rs
src/test/codegen/coverage-experiments/Cargo.lock [deleted file]
src/test/codegen/coverage-experiments/Cargo.toml [deleted file]
src/test/codegen/coverage-experiments/README-THIS-IS-TEMPORARY.md [deleted file]
src/test/codegen/coverage-experiments/src/coverage_injection_test.rs [deleted file]
src/test/codegen/coverage-experiments/src/coverage_injection_test2.rs [deleted file]
src/test/codegen/coverage-experiments/src/coverage_injection_test_alt.rs [deleted file]
src/test/codegen/coverage-experiments/src/drop_trait.rs [deleted file]
src/test/codegen/coverage-experiments/src/drop_trait_with_comments_prints.rs [deleted file]
src/test/codegen/coverage-experiments/src/for.rs [deleted file]
src/test/codegen/coverage-experiments/src/for_with_comments.rs [deleted file]
src/test/codegen/coverage-experiments/src/if.rs [deleted file]
src/test/codegen/coverage-experiments/src/if_with_comments.rs [deleted file]
src/test/codegen/coverage-experiments/src/increment_intrinsic.rs [deleted file]
src/test/codegen/coverage-experiments/src/just_main.rs [deleted file]
src/test/codegen/coverage-experiments/src/lazy_boolean.rs [deleted file]
src/test/codegen/coverage-experiments/src/loop_break_value.rs [deleted file]
src/test/codegen/coverage-experiments/src/match.rs [deleted file]
src/test/codegen/coverage-experiments/src/match_with_increment.rs [deleted file]
src/test/codegen/coverage-experiments/src/match_with_increment_alt.rs [deleted file]
src/test/codegen/coverage-experiments/src/match_without_increment.mir [deleted file]
src/test/codegen/coverage-experiments/src/match_without_increment.rs [deleted file]
src/test/codegen/coverage-experiments/src/match_without_increment_alt.mir [deleted file]
src/test/codegen/coverage-experiments/src/question_mark_err_status_handling_with_comments.rs [deleted file]
src/test/codegen/coverage-experiments/src/while.rs [deleted file]
src/test/codegen/coverage-experiments/src/while_clean.rs [deleted file]
src/test/codegen/coverage-experiments/src/while_early_return.rs [deleted file]
src/test/codegen/coverage-experiments/src/while_with_comments.rs [deleted file]

index 0e5af35229ca0564cee7b7bdc2414d0cae205d91..06a432a26961ef56200eeb76b1faaab498538943 100644 (file)
     pub fn miri_start_panic(payload: *mut u8) -> !;
 }
 
-// Since `count_code_region` is lang_item, it must have a function body that the compiler can use
-// to register its DefId with the lang_item entry. This function body is never actually called
-// (and is therefore implemented as an aborting stub) because it is replaced with the
-// LLVM intrinsic `llvm.instrprof.increment` by
-// `rustc_codegen_llvm::intrinsic::IntrinsicCallMethods::codegen_intrinsic_call()`.
-#[doc(hidden)]
+/// Defines the `count_code_region` intrinsic as a `LangItem`. `LangItem`s require a function body
+/// to register its DefId with the LangItem entry. The function body is never actually called (and
+/// is therefore implemented as an aborting stub) because it is replaced with the LLVM intrinsic
+/// `llvm.instrprof.increment` by
+/// `rustc_codegen_llvm::intrinsic::IntrinsicCallMethods::codegen_intrinsic_call()`.
 #[cfg(not(bootstrap))]
 #[cfg_attr(not(bootstrap), lang = "count_code_region")]
-pub fn count_code_region(_index: u32) {
-    #[cfg_attr(not(bootstrap), allow(unused_unsafe))] // remove `unsafe` on bootstrap bump
+fn count_code_region(_index: u32) {
+    // remove `unsafe` (and safety comment) on bootstrap bump
+    #[cfg_attr(not(bootstrap), allow(unused_unsafe))]
+    // SAFETY: the `abort` intrinsic has no requirements to be called.
     unsafe {
         abort()
     }
diff --git a/src/test/codegen/coverage-experiments/Cargo.lock b/src/test/codegen/coverage-experiments/Cargo.lock
deleted file mode 100644 (file)
index 132469c..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-# This file is automatically @generated by Cargo.
-# It is not intended for manual editing.
-[[package]]
-name = "coverage_experiments"
-version = "0.1.0"
diff --git a/src/test/codegen/coverage-experiments/Cargo.toml b/src/test/codegen/coverage-experiments/Cargo.toml
deleted file mode 100644 (file)
index 296a8d5..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-[workspace]
-
-[package]
-name = "coverage_experiments"
-version = "0.1.0"
-license = "BSD-3-Clause"
-authors = ["rust-fuchsia@fuchsia.com"]
-edition = "2018"
-
-[[bin]]
-
-name = "coverage_injection_test"
-path = "src/coverage_injection_test.rs"
-
-[[bin]]
-
-name = "coverage_injection_test2"
-path = "src/coverage_injection_test2.rs"
-
-[[bin]]
-
-name = "while"
-path = "src/while.rs"
-
-[[bin]]
-
-name = "while_clean"
-path = "src/while_clean.rs"
-
-[[bin]]
-
-name = "while_early_return"
-path = "src/while_early_return.rs"
-
-[[bin]]
-
-name = "if_with_comments"
-path = "src/if_with_comments.rs"
-
-[[bin]]
-
-name = "if"
-path = "src/if.rs"
-
-[[bin]]
-
-name = "increment_intrinsic"
-path = "src/increment_intrinsic.rs"
-
-[[bin]]
-
-name = "just_main"
-path = "src/just_main.rs"
-
-[[bin]]
-
-name = "lazy_boolean"
-path = "src/lazy_boolean.rs"
-
-[[bin]]
-
-name = "match"
-path = "src/match.rs"
-
-[[bin]]
-
-name = "match_without_increment"
-path = "src/match_without_increment.rs" # identical to -Zunpretty=hir output
-
-[[bin]]
-
-name = "match_with_increment"
-path = "src/match_with_increment.rs"
-
-[[bin]]
-
-name = "match_with_increment_alt"
-path = "src/match_with_increment_alt.rs"
-
-[[bin]]
-
-name = "loop_break_value"
-path = "src/loop_break_value.rs"
-
-[[bin]]
-
-name = "for_with_comments"
-path = "src/for_with_comments.rs"
-
-[[bin]]
-
-name = "for"
-path = "src/for.rs"
-
-[[bin]]
-
-name = "drop_trait"
-path = "src/drop_trait.rs"
-
-#[dependencies] # Should not need to manually add coverage dependencies
-#version = "0.1.0"
-#path = "../__builtin" # for mod __builtin::coverage
-
diff --git a/src/test/codegen/coverage-experiments/README-THIS-IS-TEMPORARY.md b/src/test/codegen/coverage-experiments/README-THIS-IS-TEMPORARY.md
deleted file mode 100644 (file)
index 3b69c0a..0000000
+++ /dev/null
@@ -1,157 +0,0 @@
-# codegen/coverage-experiments
-*<h2>THIS DIRECTORY IS TEMPORARY</h2>*
-
-This directory contains some work-in-progress (WIP) code used for experimental development and
-testing of Rust Coverage feature development.
-
-The code in this directory will be removed, or migrated into product tests, when the Rust
-Coverage feature is complete.
-
-[TOC]
-
-## Development Notes
-
-### config.toml
-
-config.toml probably requires (I should verify that intrinsic `llvm.instrprof.increment`
-code generation ONLY works with this config option):
-
-  profiler = true
-
-## First build
-
-```shell
-./x.py clean
-./x.py build -i --stage 1 src/libstd
-```
-
-## Incremental builds *IF POSSIBLE!*
-
-```shell
-./x.py build -i --stage 1 src/libstd --keep-stage 1
-```
-
-*Note: Some changes made for Rust Coverage required the full build (without `--keep-stage 1`), and in some cases, required `./x.py clean` first!. Occassionally I would get errors when building or when compiling a test program with `--Zinstrument-coverage` that work correctly only after a full clean and build.*
-
-## Compile a test program with LLVM coverage instrumentation
-
-*Note: This PR is still a work in progress. At the time of this writing, the `llvm.instrprof.increment` intrinsic is injected, and recognized by the LLVM code generation stage, but it does not appear to be included in the final binary. This is not surprising since other steps are still to be implemented, such as generating the coverage map. See the suggested additional `llvm` flags for ways to verify the `llvm` passes at least get the right intrinsic.*
-
-Suggested debug configuration to confirm Rust coverage features:
-```shell
-$ export RUSTC_LOG=rustc_codegen_llvm::intrinsic,rustc_mir::transform::instrument_coverage=debug
-```
-
-Ensure the new compiled `rustc` is used (the path below, relative to the `rust` code repository root, is an example only):
-
-```shell
-$ build/x86_64-unknown-linux-gnu/stage1/bin/rustc \
-  src/test/codegen/coverage-experiments/just_main.rs \
-  -Zinstrument-coverage
-```
-
-### About the test programs in coverage-experiments/src/
-
-The `coverage-experiments/src/` directory contains some sample (and very simple) Rust programs used to analyze Rust compiler output at various stages, with or without the Rust code coverage compiler option. For now, these are only used for the in-progress development and will be removed at a future date. (These are *not* formal test programs.)
-
-The src director may also contain some snapshots of mir output from experimentation, particularly if the saved snapshots highlight results that are important to the future development, individually or when compared with other output files.
-
-Be aware that some of the files and/or comments may be outdated.
-
-### Additional `llvm` flags (append to the `rustc` command)
-
-These optional flags generate additional files and/or terminal output. LLVM's `-print-before=all` should show the `instrprof.increment` intrinsic with arguments computed by the experimental Rust coverage feature code:
-
-```shell
-  --emit llvm-ir \
-  -Zverify-llvm-ir \
-  -Zprint-llvm-passes \
-  -Csave-temps \
-  -Cllvm-args=-print-before-all
-```
-
-### Additional flags for MIR analysis and transforms
-
-These optional flags generate a directory with many files representing the MIR as text (`.mir` files) and as a visual graph (`.dot` files) rendered by `graphviz`. (**Some IDEs, such as `VSCode` have `graphviz` extensions.**)
-
-```shell
-  -Zdump-mir=main \
-  -Zdump-mir-graphviz
-```
-
-### Flags I've used but appear to be irrelvant to `-Zinstrument-coverage` after all:
-```shell
-  # -Zprofile
-  # -Ccodegen-units=1
-  # -Cinline-threshold=0
-  # -Clink-dead-code
-  # -Coverflow-checks=off
-```
-
-## Run the test program compiled with code coverage instrumentation (maybe):
-
-As stated above, at the time of this writing, this work-in-progress seems to generate `llvm.instrprof.increment` intrinsic calls correctly, and are visibile in early `llvm` code generation passes, but are eventually stripped.
-
-The test program should run as expected, currently does not generate any coverage output.
-
-*Example:*
-
-```shell
-  $ src/test/codegen/coverage-experiments/just_main
-  hello world! (should be covered)
-```
-
-### Running the coverage-enabled `rustc` compiler in the `lldb` debugger:
-
-For example, to verify the intrinsic is codegen'ed, set breakpoint in `lldb` where it validates a certain instruction is the `llvm.instrprof.increment` instruction.
-
-First, update config.toml for debugging:
-
-```toml
-  [llvm]
-  optimize = false
-  release-debuginfo = true
-
-  [rust]
-  debug = true
-  debuginfo-level = 2
-```
-
-*(Note, in case this is relevant after all, I also have the following changes; but I don't think I need them:)*
-
-```toml
-  # Add and uncomment these if relevant/useful:
-  # codegen-units = 0
-  # python = '/usr/bin/python3.6'
-```
-
-Run the compiler with additional flags as needed:
-
-```shell
-lldb \
-  build/x86_64-unknown-linux-gnu/stage1/bin/rustc \
-  -- \
-  src/test/codegen/coverage-experiments/just_main.rs \
-  -Zinstrument-coverage \
-  -Zdump-mir=main \
-  -Zdump-mir-graphviz
-```
-
-Note the specific line numbers may be different:
-
-```c++
-(lldb) b lib/Transforms/Instrumentation/InstrProfiling.cpp:418
-(lldb) r
-
-Process 93855 stopped
-* thread #6, name = 'rustc', stop reason = breakpoint 2.1
-    frame #0: 0x00007fffedff7738 librustc_driver-5a0990d8d18fb2b4.so`llvm::InstrProfiling::lowerIntrinsics(this=0x00007fffcc001d40, F=0x00007fffe4552198) at InstrProfiling.cpp:418:23
-   415        auto Instr = I++;
-   416        InstrProfIncrementInst *Inc = castToIncrementInst(&*Instr);
-   417        if (Inc) {
--> 418          lowerIncrement(Inc);
-   419          MadeChange = true;
-   420        } else if (auto *Ind = dyn_cast<InstrProfValueProfileInst>(Instr)) {
-   421          lowerValueProfileInst(Ind);
-(lldb)
-```
\ No newline at end of file
diff --git a/src/test/codegen/coverage-experiments/src/coverage_injection_test.rs b/src/test/codegen/coverage-experiments/src/coverage_injection_test.rs
deleted file mode 100644 (file)
index 231da1d..0000000
+++ /dev/null
@@ -1,335 +0,0 @@
-/*                       */ use std::io::Error;
-/*                       */ use std::io::ErrorKind;
-/*                       */
-/*                       */ /// Align Rust counter increment with with:
-/*                       */ /// [‘llvm.instrprof.increment’ Intrinsic](https://llvm.org/docs/LangRef.html#llvm-instrprof-increment-intrinsic)
-/*                       */ ///
-/*                       */ /// declare void @llvm.instrprof.increment(i8* <name>, i64 <hash>, i32 <num-counters>, i32 <index>)
-/*                       */ ///
-/*                       */ /// The first argument is a pointer to a global variable containing the name of the entity
-/*                       */ /// being instrumented. This should generally be the (mangled) function name for a set of
-/*                       */ /// counters.
-/*                       */ ///
-/*                       */ /// The second argument is a hash value that can be used by the consumer of the profile data
-/*                       */ /// to detect changes to the instrumented source, and the third is the number of counters
-/*                       */ /// associated with name. It is an error if hash or num-counters differ between two
-/*                       */ /// instances of instrprof.increment that refer to the same name.
-/*                       */ ///
-/*                       */ /// The last argument refers to which of the counters for name should be incremented. It
-/*                       */ /// should be a value between 0 and num-counters.
-/*                       */ ///
-/*                       */ /// # Arguments
-/*                       */ ///
-/*                       */ /// `mangled_fn_name` - &'static ref to computed and injected static str, using:
-/*                       */ ///
-/*                       */ ///     ```
-/*                       */ ///     fn rustc_symbol_mangling::compute_symbol_name(
-/*                       */ ///         tcx: TyCtxt<'tcx>,
-/*                       */ ///         instance: Instance<'tcx>,
-/*                       */ ///         compute_instantiating_crate: impl FnOnce() -> CrateNum,
-/*                       */ ///     ) -> String
-/*                       */ ///     ```
-/*                       */ ///
-/*                       */ /// `source_version_hash` - Compute hash based that only changes if there are "significant"
-/*                       */ /// to control-flow inside the function.
-/*                       */ ///
-/*                       */ /// `num_counters` - The total number of counter calls [MAX(counter_index) + 1] within the
-/*                       */ /// function.
-/*                       */ ///
-/*                       */ /// `counter_index` - zero-based counter index scoped by the function. (Ordering of
-/*                       */ /// counters, relative to the source code location, is apparently not expected.)
-/*                       */ ///
-/*                       */ /// # Notes
-/*                       */ ///
-/*                       */ /// * The mangled_fn_name may not be computable until generics are monomorphized (see
-/*                       */ ///   parameters required by rustc_symbol_mangling::compute_symbol_name).
-/*                       */ /// * The version hash may be computable from AST analysis, and may not benefit from further
-/*                       */ ///   lowering.
-/*                       */ /// * num_counters depends on having already identified all counter insertion locations.
-/*                       */ /// * counter_index can be computed at time of counter insertion (incrementally).
-/*                       */ /// * Numeric parameters are signed to match the llvm increment intrinsic parameter types.
-/*                       */ fn __lower_incr_cov(_mangled_fn_name: &'static str, _fn_version_hash: i64, _num_counters: i32, _counter_index: i32) {
-/*                       */ }
-/*                       */
-/*                       */ /// A coverage counter implementation that will work as both an intermediate coverage
-/*                       */ /// counting and reporting implementation at the AST-level only--for debugging and
-/*                       */ /// development--but also serves as a "marker" to be replaced by calls to LLVM
-/*                       */ /// intrinsic coverage counter APIs during the lowering process.
-/*                       */ ///
-/*                       */ /// Calls to this function will be injected automatically into the AST. When LLVM intrinsics
-/*                       */ /// are enabled, the counter function calls that were injected into the AST serve as
-/*                       */ /// placeholders, to be replaced by an alternative, such as:
-/*                       */ ///
-/*                       */ ///     * direct invocation of the `llvm.instrprof.increment()` intrinsic; or
-/*                       */ ///     * the `__lower_incr_cov()` function, defined above, that would invoke the
-/*                       */ ///       `llvm.instrprof.increment()` intrinsic; or
-/*                       */ ///     * a similar expression wrapper, with the additional parameters (as defined above
-/*                       */ ///       for `__lower_incr_cov()`, that invokes `llvm.instrprof.increment()` and returns the
-/*                       */ ///       result of the wrapped expression)
-/*                       */ ///
-/*                       */ /// The first two options would require replacing the inlined wrapper call with something
-/*                       */ /// like:
-/*                       */ ///
-/*                       */ /// ```
-/*                       */ /// { let result = {expr}; __inlined_incr_cov(context, counter); result }
-/*                       */ /// ```
-/*                       */ ///
-/*                       */ /// But if the lowering process is already unwrapping the inlined call to `__incr_cov()`, then
-/*                       */ /// it may be a perfect opportunity to replace the function with one of these more
-/*                       */ /// direct methods.
-/*                       */ ///
-/*                       */ #[inline(always)]
-/*                       */ pub fn __incr_cov<T>(region_loc: &str, /*index: u32,*/ result: T) -> T {
-/*                       */     // Either call the intermediate non-llvm coverage counter API or
-/*                       */     // replace the call to this function with the expanded `__lower_incr_cov()` call.
-/*                       */
-/*                       */     // let _lock = increment_counter(counter);
-/*                       */     println!("{}", region_loc);
-/*                       */
-/*                       */     result
-/*                       */ }
-/*                       */
-/*                       */ /// Write a report identifying each incremented counter and the number of times each counter
-/*                       */ /// was incremented.
-/*                       */ fn __report() {
-/*                       */     println!("WRITE REPORT!");
-/*                       */ }
-/*                       */
-/*                       */ /// Increment the counter after evaluating the wrapped expression (see `__incr_cov()`), then
-/*                       */ /// write a report identifying each incremented counter and the number of times each counter
-/*                       */ /// was incremented.
-/*                       */ #[inline(always)]
-/*                       */ pub fn __incr_cov_and_report<T>(region_loc: &str, /*counter: u32,*/ result: T) -> T {
-/*                       */     __incr_cov(region_loc, /*counter,*/ ());
-/*                       */     __report();
-/*                       */     result
-/*                       */ }
-/*                       */
-/*                       */ macro_rules! from {
-/*                       */     ($from:expr) => { &format!("from: {}\n  to: {}:{}:{}", $from, file!(), line!(), column!()) };
-/*                       */ }
-/*                       */
-/*                       */ #[derive(Debug)]
-/*                       */ enum TestEnum {
-/*                       */     Red,
-/*                       */     Green,
-/*                       */     Blue,
-/*                       */ }
-/*                       */
-/*                       */ struct TestStruct {
-/*                       */     field: i32,
-/*                       */ }
-/*                       */
-/*                       */ // IMPORTANT! IS WRAPPING main() ENOUGH? OR DO I ALSO NEED TO WRAP THREAD FUNCTIONS, ASSUMING
-/*                       */ // THEY ARE STILL RUNNING WITH MAIN EXITS? (IF THEY CAN). NOT SURE HOW RUST HANDLES THAT.
-/*                       */
-/*                       */ // I SUSPECT USING THREAD_LOCAL COUNTERS MAY NOT ACTUALLY BE AN OPTIMIZATION OVER MUTEX LOCKS,
-/*                       */ // BUT MAYBE I SHOULD ASK.
-/*                       */
-/*                       */ impl TestStruct {
-/*    -                  */     fn new() -> Self {
-/*    ┃                  */         __incr_cov(from!("fn new()"),Self::new_with_value(31415)) // function-scoped counter index = 0
-/*    -                  */     }
-/*                       */
-/*    -                  */     fn new_with_value(field: i32) -> Self {
-/*    ┃                  */         __incr_cov(from!("fn new_with_value()"),Self {
-/*    ┃                  */             field,
-/*    ┃                  */         }) // function-scoped counter index = 0
-/*    -                  */     }
-/*                       */
-/*                       */     fn call_closure<F>(&self, closure: F) -> bool
-/*                       */     where
-/*                       */         F: FnOnce(
-/*                       */             i32,
-/*                       */         ) -> bool,
-/*    -                  */     {
-/*    ┃                  */         __incr_cov(from!("fn call_closure()"),closure(123)) // function-scoped counter index = 0
-/*    -                  */     }
-/*                       */
-/*    -                  */     fn various(&self) -> Result<(),Error> {
-/*    ┃                  */         use TestEnum::*;
-/*    ┃                  */         let mut color = Red;
-/*    ┃                  */         let _ = color;
-/*    ┃                  */         color = Blue;
-/*    ┃                  */         let _ = color;
-/*    ┃                  */         color = Green;
-/*    ┃                  */         match __incr_cov(from!("fn various"),color) { // function-scoped counter index = 0
-/*    :                  */
-/*    :                  */             // !!! RECORD SPAN FROM START OF INNERMOST CONTAINING BLOCK (THE FUNCTION IN THIS CASE) TO END OF MATCH EXPRESSION
-/*    :                  */             // If `match`, `while`, `loop`, `for`, `if`, etc. expression has a `return`, `break`, or `continue`
-/*    :                  */             // (if legal), then RECORD SPAN FROM START OF INNERMOST CONTAINING BLOCK TO END OF `return` EXPRESSION
-/*    :                  */             // If the expression includes lazy booleans, nest calls to `__incr_cov()`.
-/*    :   I              */             Red => __incr_cov(from!("Red => or end of MatchArmGuard expression inside pattern, if any"),println!("roses")),
-/*    :   -              */             Green => {
-/*    :   ┃              */                 let spidey = 100;
-/*    :   ┃              */                 let goblin = 50;
-/*    :   ┃              */                 // if spidey > goblin {__incr_cov(from!(""),{
-/*    :   ┃              */                 //     println!("what ev");
-/*    :   ┃              */                 // })}
-/*    :   ┃              */                 // ACTUALLY, WRAPPING THE ENTIRE IF BLOCK IN `__incr_cov` IS NOT A GREAT GENERAL RULE.
-/*    :   ┃              */                 // JUST INSERTING A `return`, `break`, or `continue` IN THAT BLOCK (without an intermediate condition)
-/*    :   ┃              */                 // MAKES THE `__incr_cov()` CALL UNREACHABLE!
-/*    :   ┃              */                 // MY ORIGINAL SOLUTION WORKS BETTER (WRAP LAST EXPRESSION OR AFTER LAST SEMICOLON STATEMENT IN BLOCK)
-/*    :   ┃              */                 // UNLESS THE EXPRESSION IS NOT A BLOCK.
-/*    :   ┃   -          */                 if __incr_cov(from!("Green => or end of MatchArmGuard expression inside pattern, if any"),spidey > goblin) {
-/*    :   :   ┃          */                     println!("spidey beats goblin");
-/*    :   :   ┃          */                     __incr_cov(from!("block start"),());
-/*    :   ┃   -          */                 } else if __incr_cov(from!("`else if` on this line"),spidey == goblin) {
-/*    :   :   ┃          */                     // COVERAGE NOTE: Do we mark only the expression span (that may be trivial, as in this case),
-/*    :   :   ┃          */                     // or associate it with the outer block, similar to how the `if` expression is associated with
-/*    :   :   ┃          */                     // the outer block? (Although it is a continuation, in a sense, it is discontiguous in this case,
-/*    :   :   ┃          */                     // so I think simpler to just make it its own coverage region.)
-/*    :   :   ┃          */                     println!("it's a draw");
-/*    :   :   ┃          */                     __incr_cov(from!("block start"),());
-/*    :   ┃   -   -   -  */                 } else if if __incr_cov(from!("`else if` on this line"),true) {
-/*    :   :       :   ┃  */                             // return __incr_cov(from!("after `if true`"),Ok(()));
-/*    :   :       :   ┃  */                             // ACTUALLY, BECAUSE OF `return`, WE DO NOT RECORD THE `if true` EVEN THOUGH WE COVERED IT.
-/*    :   :       :   ┃  */                             // IN FACT, IF THIS NESTED CONDITIONAL IN A CONDITIONAL EXPRESSION WAS AN `if` (WITHOUT PRECEDING ELSE)
-/*    :   :       :   ┃  */                             // WE WOULD NOT HAVE RECORDED THE COVERAGE OF STATEMENTS LEADING UP TO THE `if`, SO
-/*    :   :       :   ┃  */                             // IT SHOULD BE:
-/*  ┏-:---:-------:---<  */                             return __incr_cov(from!(""),Ok(()));
-/*  V :   :       :   :  */                             // NOTE THE `from` STRING IS SAME FOR THE `else if`s `__incr_cov` AND THIS `return`.
-/*    :   :       :   :  */                             // ONLY ONE OF THESE WILL EXECUTE, TO RECORD COVERAGE FROM THAT SPOT.
-/*    :   :       ┃   -  */                         } else {
-/*    :   :       :   I  */                             __incr_cov(from!("`else`"),false)
-/*    :   :   -   -      */                         } {
-/*    :   :   ┃          */                     println!("wierd science");
-/*    :   :   ┃          */                     __incr_cov(from!("block start"),());
-/*    :   ┃   -          */                 } else {
-/*    :   :   ┃          */                     println!("goblin wins");
-/*  ┏-:---:---<          */                     return __incr_cov(from!("`else`"),Ok(())); // THIS COUNTS LAST STATEMENT IN `else` BLOCK
-/*  V :   :   :          */                     // COVERAGE NOTE: When counting the span for `return`,
-/*    :   :   :          */                     // `break`, or `continue`, also report the outer spans
-/*    :   :   :          */                     // got this far--including this `else` block. Record
-/*    :   :   :          */                     // The start positions for those outer blocks, but:
-/*    :   :   :          */                     // * For the block containing the `return`, `break`, or
-/*    :   :   :          */                     //   `continue`, end report the end position is the
-/*    :   :   :          */                     //   start of the `return` span (or 1 char before it).
-/*    :   :   :          */                     // * Anything else?
-/*    :   ┃   -          */                 }
-/*    :   ┃   -          */                 // __incr_cov(from!(""),()); // DO NOT COUNT HERE IF NO STATEMENTS AFTER LAST `if` or `match`
-/*    :   -              */             },
-/*    :   I              */             Blue => __incr_cov(from!("Blue => or end of MatchArmGuard expression inside pattern, if any"),println!("violets")),
-/*    ┃                  */         }
-/*    ┃                  */
-/*    ┃                  */         let condition1 = true;
-/*    ┃                  */         let condition2 = false;
-/*    ┃                  */         let condition3 = true;
-/*    ┃                  */
-/*    ┃                  */         println!("Called `various()` for TestStruct with field={}", self.field);
-/*    ┃                  */
-/*    ┃   -              */         if __incr_cov(from!("after block end of prior `match` (or `if-else if-else`)"),condition1) {
-/*    :   ┃              */             println!("before while loop");
-/*    :   ┃              */             let mut countdown = 10;
-/*    :   ┃              */             __incr_cov(from!("block start"),()); // Must increment before repeated while text expression
-/*    :   :   I          */             while __incr_cov(from!("while test"), countdown > 0) { // span is just the while test expression
-/*    :   :   ┃          */                 println!("top of `while` loop");
-/*    :   :   ┃          */                 countdown -= 1;
-/*    :   :   ┃          */                 // __incr_cov(from!("while loop"),()); // Counter not needed, but span is computed as "while test" minus "block start"
-/*    :   :   ┃          */                                                        // If test expression is 11, and the outer block runs only once, 11-1 = 10
-/*    :   ┃   -          */             }
-/*    :   ┃              */             println!("before for loop");
-/*    :   ┃   -          */             for index in __incr_cov(from!("end of while"),0..10) {
-/*    :   :   ┃          */                 println!("top of `for` loop");
-/*    :   :   ┃   -      */                 if __incr_cov(from!("block start"),index == 8) {
-/*    :   :   :   ┃      */                     println!("before break");
-/*    :   :   :   ┃      */                     // note the following is not legal here:
-/*    :   :   :   ┃      */                     //   "can only break with a value inside `loop` or breakable block"
-/*    :   :   :   ┃      */                     // break __incr_cov(from!(""),());
-/*    :   :   :   ┃      */                     __incr_cov(from!("block start"),());
-/*    :   : ┏-----<      */                     break;
-/*    :   : V :   :      */
-/*    :   :   :   :      */                     // FIXME(richkadel): add examples with loop labels, breaking out of inner and outer loop to outer loop label, with expression.
-/*    :   :   :   :      */                     // May want to record both the span and the start position after the broken out block depdnding on label
-/*    :   :   ┃   -      */                 }
-/*    :   :   ┃          */                 println!("after `break` test");
-/*    :   :   ┃   -      */                 if __incr_cov(from!("block end of `if index == 8`"),condition2) {
-/*  ┏-:---:---:---<      */                     return __incr_cov(from!("block start"),Ok(()));
-/*  V :   :   ┃   -      */                 }
-/*    :   :   ┃          */
-/*    :   :   ┃          */                 // BECAUSE THE PREVIOUS COVERAGE REGION HAS A `return`, THEN
-/*    :   :   ┃          */                 // IF PREVIOUS COVERAGE REGION IS NOT COUNTED THEN OUTER REGION REACHED HERE.
-/*    :   :   ┃          */                 // ADD A COVERAGE REGION FOR THE SPAN FROM JUST AFTER PREVIOUS REGION TO END
-/*    :   :   ┃          */                 // OF OUTER SPAN, THEN TRUNCATE TO NEXT REGION NOT REACHED.
-/*    :   :   ┃   -      */                 if index % 3 == 2 { // NO __incr_cov() HERE BECAUSE NO STATEMENTS BETWEEN LAST CONDITIONAL BLOCK AND START OF THIS ONE
-/*    :   : Λ :   ┃      */                     __incr_cov(from!("block end of `if condition2`"),());
-/*    :   : ┗-----<      */                     continue;
-/*    :   :   ┃   -      */                 }
-/*    :   :   ┃          */                 println!("after `continue` test");
-/*    :   :   ┃          */                 // maybe add a runtime flag for a possible `return` here?
-/*    :   :   ┃          */                 __incr_cov(from!("for loop"),());
-/*    :   ┃   -          */             }
-/*    :   ┃              */             println!("after for loop");
-/*    :   ┃              */             let result = if { // START OF NEW CONDITIONAL EXPRESSION. NEXT "GUARANTEED" COUNTER SHOULD COUNT FROM END OF LAST CONDITIONAL EXPRESSION
-/*    :   ┃              */                               // A "GUARANTEED" COUNTER CALL IS ONE THAT WILL BE CALLED REGARDLESS OF OTHER CONDITIONS. THIS INCLUDES:
-/*    :   ┃              */                               //   * A CONDITIONAL EXPRESSION THAT IS NOT A BLOCK (OR ANOTHER CONDITIONAL STATEMENT, WHICH WOULD CONTAIN A BLOCK)
-/*    :   ┃              */                               //   * OR IF THE NEXT CONDITIONAL EXPRESSION IS A BLOCK OR CONDITIONAL STATEMENT, THEN THE FIRST "GUARANTEED" COUNTER IN THAT BLOCK
-/*    :   ┃              */                               //   * END OF BLOCK IF THE BLOCK DOES NOT HAVE INNER CONDITIONAL EXPRESSIONS
-/*    :   ┃              */                               //   * BRANCHING STATEMENTS (`return`, `break`, `continue`) BY EITHER WRAPPING THE BRANCH STATEMENT NON-BLOCK EXPRESSION,
-/*    :   ┃              */                               //     OR PREPENDING A COUNTER WITH EMPTY TUPLE IF NO EXPRESSION, OR IF EXPRESSION IS A BLOCK, THEN THE NEXT "GUARANTEED"
-/*    :   ┃              */                               //     COUNTER CALL WITHIN THAT BLOCK.
-/*    :   ┃              */                               //   BASICALLY, CARRY THE START OF COVERAGE SPAN FORWARD UNTIL THE GUARANTEED COUNTER IS FOUND
-/*    :   ┃              */                 println!("after result = if ...");
-/*    :   ┃       -      */                 if __incr_cov(from!("block end of `for` loop"),condition2) {
-/*    :   :       ┃      */                     println!("before first return");
-/*  ┏-:---:-------<      */                     return __incr_cov(from!("block start"),Ok(()));
-/*  V :   :       -      */                 } else if __incr_cov(from!("`else`"),condition3) {
-/*    :   :       ┃      */                     // THE ABOVE COUNTER IS _NOT_ REALLY NECESSARY IF EXPRESSION IS GUARANTEED TO EXECUTE.
-/*    :   :       ┃      */                     // IF WE GET COUNTER IN `else if` BLOCK WE COVERED EXPRESSION.
-/*    :   :       ┃      */                     // IF WE GET TO ANY REMAINING `else` or `else if` BLOCK WE KNOW WE EVALUATED THIS CONDITION
-/*    :   :       ┃      */                     // AND ALL OTHERS UP TO THE EXECUTED BLOCK. BUT THE SPAN WOULD HAVE "HOLES" FOR UNEXECUTED BLOCKS.
-/*    :   :       ┃      */                     println!("not second return");
-/*  ┏-:---:-------<      */                     return __incr_cov(from!("block start"),Ok(()));
-/*  V :   :       -      */                 } else {
-/*    :   :       ┃      */                     println!("not returning");
-/*    :   :       ┃      */                     __incr_cov(from!("block start"),false)
-/*    :   :       -      */                 }
-/*    :   ┃              */                 // NO COUNTER HERE BECAUSE NO STATEMENTS AFTER CONDITIONAL BLOCK
-/*    :   ┃   -          */             } {
-/*    :   :   ┃          */                 println!("branched condition returned true");
-/*    :   :   ┃          */                 __incr_cov(from!(""),Ok(()))
-/*    :   ┃   -          */             } else if self.call_closure(
-/*    :   :       -      */                     |closure_param| __incr_cov(from!(""),
-/*    :   :       ┃   -  */                         if condition3 {
-/*    :   :       :   ┃  */                             println!("in closure, captured condition said to print the param {}", closure_param);
-/*    :   :       :   ┃  */                             __incr_cov(from!(""),false)
-/*    :   :       ┃   -  */                         } else {
-/*    :   :       :   ┃  */                             println!("in closure, captured condition was false");
-/*    :   :       :   ┃  */                             __incr_cov(from!(""),true)
-/*    :   :       ┃   -  */                         }
-/*    :   :       -      */                     )
-/*    :   :   -          */                 ) {
-/*    :   :   ┃          */                 println!("closure returned true");
-/*    :   :   ┃          */                 __incr_cov(from!(""),Err(Error::new(ErrorKind::Other, "Result is error if closure returned true")))
-/*    :   ┃   -          */             } else {
-/*    :   :   ┃          */                 println!("closure returned false");
-/*    :   :   ┃          */                 __incr_cov(from!(""),Err(Error::new(ErrorKind::Other, "Result is error if closure returned false")))
-/*    :   ┃   -          */             };
-/*    :   ┃              */             println!("bottom of function might be skipped if early `return`");
-/*    :   ┃              */             __incr_cov(from!("if condition1"),result)
-/*    ┃   -              */         } else {
-/*    :   ┃              */             println!("skipping everything in `various()`");
-/*    :   ┃              */             __incr_cov(from!(""),Ok(()))
-/*    ┃   -              */         }
-/*    ┃   -              */         // __incr_cov(from!(""),0) // DO NOT COUNT IF NO STATEMENTS AFTER CONDITIONAL BLOCK. ALL COVERAGE IS ALREADY COUNTED
-/*    -                  */     }
-/*                       */ }
-/*                       */
-/*    -                  */ fn main() -> Result<(), std::io::Error> {
-/*    ┃                  */     //let mut status: u8 = 2;
-/*    ┃                  */     let mut status: u8 = 1;
-/*    :       -          */     let result = if status < 2 &&
-/*    :       ┃          */             __incr_cov(from!(""),{
-/*    :       ┃          */                 status -= 1;
-/*    :       ┃          */                 status == 0
-/*    :   -   -          */             }) {
-/*    :   ┃              */         let test_struct = TestStruct::new_with_value(100);
-/*    :   ┃              */         let _ = test_struct.various();
-/*  ┏-:---<              */         return __incr_cov_and_report(from!(""),Err(Error::new(ErrorKind::Other, format!("Error status {}", status))))
-/*  V :   -              */     } else {
-/*    :   ┃              */         let test_struct = TestStruct::new();
-/*    :   ┃              */         __incr_cov(from!(""),test_struct.various())
-/*    :   -              */     };
-/*    ┃                  */     println!("done");
-/*    ┃                  */     __incr_cov_and_report(from!(""),result) // function-scoped counter index = 0
-/*    -                  */ }
\ No newline at end of file
diff --git a/src/test/codegen/coverage-experiments/src/coverage_injection_test2.rs b/src/test/codegen/coverage-experiments/src/coverage_injection_test2.rs
deleted file mode 100644 (file)
index 8f4399a..0000000
+++ /dev/null
@@ -1,320 +0,0 @@
-/*                       */ use std::io::Error;
-/*                       */ use std::io::ErrorKind;
-/*                       */
-/*                       */ /// Align Rust counter increment with with:
-/*                       */ /// [‘llvm.instrprof.increment’ Intrinsic](https://llvm.org/docs/LangRef.html#llvm-instrprof-increment-intrinsic)
-/*                       */ ///
-/*                       */ /// declare void @llvm.instrprof.increment(i8* <name>, i64 <hash>, i32 <num-counters>, i32 <index>)
-/*                       */ ///
-/*                       */ /// The first argument is a pointer to a global variable containing the name of the entity
-/*                       */ /// being instrumented. This should generally be the (mangled) function name for a set of
-/*                       */ /// counters.
-/*                       */ ///
-/*                       */ /// The second argument is a hash value that can be used by the consumer of the profile data
-/*                       */ /// to detect changes to the instrumented source, and the third is the number of counters
-/*                       */ /// associated with name. It is an error if hash or num-counters differ between two
-/*                       */ /// instances of instrprof.increment that refer to the same name.
-/*                       */ ///
-/*                       */ /// The last argument refers to which of the counters for name should be incremented. It
-/*                       */ /// should be a value between 0 and num-counters.
-/*                       */ ///
-/*                       */ /// # Arguments
-/*                       */ ///
-/*                       */ /// `mangled_fn_name` - &'static ref to computed and injected static str, using:
-/*                       */ ///
-/*                       */ ///     ```
-/*                       */ ///     fn rustc_symbol_mangling::compute_symbol_name(
-/*                       */ ///         tcx: TyCtxt<'tcx>,
-/*                       */ ///         instance: Instance<'tcx>,
-/*                       */ ///         compute_instantiating_crate: impl FnOnce() -> CrateNum,
-/*                       */ ///     ) -> String
-/*                       */ ///     ```
-/*                       */ ///
-/*                       */ /// `source_version_hash` - Compute hash based that only changes if there are "significant"
-/*                       */ /// to control-flow inside the function.
-/*                       */ ///
-/*                       */ /// `num_counters` - The total number of counter calls [MAX(counter_index) + 1] within the
-/*                       */ /// function.
-/*                       */ ///
-/*                       */ /// `counter_index` - zero-based counter index scoped by the function. (Ordering of
-/*                       */ /// counters, relative to the source code location, is apparently not expected.)
-/*                       */ ///
-/*                       */ /// # Notes
-/*                       */ ///
-/*                       */ /// * The mangled_fn_name may not be computable until generics are monomorphized (see
-/*                       */ ///   parameters required by rustc_symbol_mangling::compute_symbol_name).
-/*                       */ /// * The version hash may be computable from AST analysis, and may not benefit from further
-/*                       */ ///   lowering.
-/*                       */ /// * num_counters depends on having already identified all counter insertion locations.
-/*                       */ /// * counter_index can be computed at time of counter insertion (incrementally).
-/*                       */ /// * Numeric parameters are signed to match the llvm increment intrinsic parameter types.
-/*                       */ fn __lower_incr_cov(_mangled_fn_name: &'static str, _fn_version_hash: i64, _num_counters: i32, _counter_index: i32) {
-/*                       */ }
-/*                       */
-/*                       */ /// A coverage counter implementation that will work as both an intermediate coverage
-/*                       */ /// counting and reporting implementation at the AST-level only--for debugging and
-/*                       */ /// development--but also serves as a "marker" to be replaced by calls to LLVM
-/*                       */ /// intrinsic coverage counter APIs during the lowering process.
-/*                       */ ///
-/*                       */ /// Calls to this function will be injected automatically into the AST. When LLVM intrinsics
-/*                       */ /// are enabled, the counter function calls that were injected into the AST serve as
-/*                       */ /// placeholders, to be replaced by an alternative, such as:
-/*                       */ ///
-/*                       */ ///     * direct invocation of the `llvm.instrprof.increment()` intrinsic; or
-/*                       */ ///     * the `__lower_incr_cov()` function, defined above, that would invoke the
-/*                       */ ///       `llvm.instrprof.increment()` intrinsic; or
-/*                       */ ///     * a similar expression wrapper, with the additional parameters (as defined above
-/*                       */ ///       for `__lower_incr_cov()`, that invokes `llvm.instrprof.increment()` and returns the
-/*                       */ ///       result of the wrapped expression)
-/*                       */ ///
-/*                       */ /// The first two options would require replacing the inlined wrapper call with something
-/*                       */ /// like:
-/*                       */ ///
-/*                       */ /// ```
-/*                       */ /// { let result = {expr}; __inlined_incr_cov(context, counter); result }
-/*                       */ /// ```
-/*                       */ ///
-/*                       */ /// But if the lowering process is already unwrapping the inlined call to `__incr_cov()`, then
-/*                       */ /// it may be a perfect opportunity to replace the function with one of these more
-/*                       */ /// direct methods.
-/*                       */ ///
-/*                       */ #[inline(always)]
-/*                       */ pub fn __incr_cov(region_loc: &str) {
-/*                       */     // Either call the intermediate non-llvm coverage counter API or
-/*                       */     // replace the call to this function with the expanded `__lower_incr_cov()` call.
-/*                       */
-/*                       */     // let _lock = increment_counter(counter);
-/*                       */     println!("{}", region_loc);
-/*                       */ }
-/*                       */
-/*                       */ /// Write a report identifying each incremented counter and the number of times each counter
-/*                       */ /// was incremented.
-/*                       */ fn __report() {
-/*                       */     println!("WRITE REPORT!");
-/*                       */ }
-/*                       */
-/*                       */ macro_rules! from {
-/*                       */     ($from:expr) => { &format!("from: {}\n  to: {}:{}:{}", $from, file!(), line!(), column!()) };
-/*                       */ }
-/*                       */
-/*                       */ #[derive(Debug)]
-/*                       */ enum TestEnum {
-/*                       */     Red,
-/*                       */     Green,
-/*                       */     Blue,
-/*                       */ }
-/*                       */
-/*                       */ struct TestStruct {
-/*                       */     field: i32,
-/*                       */ }
-/*                       */
-/*                       */ // IMPORTANT! IS WRAPPING main() ENOUGH? OR DO I ALSO NEED TO WRAP THREAD FUNCTIONS, ASSUMING
-/*                       */ // THEY ARE STILL RUNNING WITH MAIN EXITS? (IF THEY CAN). NOT SURE HOW RUST HANDLES THAT.
-/*                       */
-/*                       */ // I SUSPECT USING THREAD_LOCAL COUNTERS MAY NOT ACTUALLY BE AN OPTIMIZATION OVER MUTEX LOCKS,
-/*                       */ // BUT MAYBE I SHOULD ASK.
-/*                       */
-/*                       */ impl TestStruct {
-/*    -                  */     fn new() -> Self {
-/*    ┃                  */         let __result = Self::new_with_value(31415); // function-scoped counter index = 0
-/*    ┃                  */         __incr_cov(from!("fn new()"));
-/*    ┃                  */         __result
-/*    -                  */     }
-/*                       */
-/*    -                  */     fn new_with_value(field: i32) -> Self {
-/*    ┃                  */         let __result = Self {
-/*    ┃                  */             field,
-/*    ┃                  */         };
-/*    ┃                  */         __incr_cov(from!("fn new_with_value()")); // function-scoped counter index = 0
-/*    ┃                  */         __result
-/*    -                  */     }
-/*                       */
-/*                       */     fn call_closure<F>(&self, closure: F) -> bool
-/*                       */     where
-/*                       */         F: FnOnce(
-/*                       */             i32,
-/*                       */         ) -> bool,
-/*    -                  */     {
-/*    ┃                  */         let __result = closure(123);
-/*    ┃                  */         __incr_cov(from!("fn call_closure()")); // function-scoped counter index = 0
-/*    ┃                  */         __result
-/*    -                  */     }
-/*                       */
-/*    -                  */     fn various(&self) -> Result<(),Error> {
-/*    ┃                  */         use TestEnum::*;
-/*    ┃                  */         let mut color = Red;
-/*    ┃                  */         let _ = color;
-/*    ┃                  */         color = Blue;
-/*    ┃                  */         let _ = color;
-/*    ┃                  */         color = Green;
-/*    ┃                  */         match { let __result = color; __incr_cov(from!("fn various")); __result } { // function-scoped counter index = 0
-/*    :                  */
-/*    :                  */             // !!! RECORD SPAN FROM START OF INNERMOST CONTAINING BLOCK (THE FUNCTION IN THIS CASE) TO END OF MATCH EXPRESSION
-/*    :                  */             // If `match`, `while`, `loop`, `for`, `if`, etc. expression has a `return`, `break`, or `continue`
-/*    :                  */             // (if legal), then RECORD SPAN FROM START OF INNERMOST CONTAINING BLOCK TO END OF `return` EXPRESSION
-/*    :                  */             // If the expression includes lazy booleans, nest calls to `__incr_cov()`.
-/*    :   I              */             Red => {println!("roses"); __incr_cov(from!("Red => or end of MatchArmGuard expression inside pattern, if any"));}
-/*    :   -              */             Green => {
-/*    :   ┃              */                 let spidey = 100;
-/*    :   ┃              */                 let goblin = 50;
-/*    :   ┃              */                 // if spidey > goblin {__incr_cov(from!(""),{
-/*    :   ┃              */                 //     println!("what ev");
-/*    :   ┃              */                 // })}
-/*    :   ┃              */                 // ACTUALLY, WRAPPING THE ENTIRE IF BLOCK IN `__incr_cov` IS NOT A GREAT GENERAL RULE.
-/*    :   ┃              */                 // JUST INSERTING A `return`, `break`, or `continue` IN THAT BLOCK (without an intermediate condition)
-/*    :   ┃              */                 // MAKES THE `__incr_cov()` CALL UNREACHABLE!
-/*    :   ┃              */                 // MY ORIGINAL SOLUTION WORKS BETTER (WRAP LAST EXPRESSION OR AFTER LAST SEMICOLON STATEMENT IN BLOCK)
-/*    :   ┃              */                 // UNLESS THE EXPRESSION IS NOT A BLOCK.
-/*    :   ┃   -          */                 if { let __result = spidey > goblin; __incr_cov(from!("Green => or end of MatchArmGuard expression inside pattern, if any")); __result } {
-/*    :   :   ┃          */                     println!("spidey beats goblin");
-/*    :   :   ┃          */                     __incr_cov(from!("block start"));
-/*    :   ┃   -          */                 } else if { let __result = spidey == goblin; __incr_cov(from!("`else if` on this line")); __result } {
-/*    :   :   ┃          */                     // COVERAGE NOTE: Do we mark only the expression span (that may be trivial, as in this case),
-/*    :   :   ┃          */                     // or associate it with the outer block, similar to how the `if` expression is associated with
-/*    :   :   ┃          */                     // the outer block? (Although it is a continuation, in a sense, it is discontiguous in this case,
-/*    :   :   ┃          */                     // so I think simpler to just make it its own coverage region.)
-/*    :   :   ┃          */                     println!("it's a draw");
-/*    :   :   ┃          */                     __incr_cov(from!("block start"));
-/*    :   ┃   -   -   -  */                 } else if if { let __result = true; __incr_cov(from!("`else if` on this line")); __result } {
-/*    :   :       :   ┃  */                             // return __incr_cov(from!("after `if true`"),Ok(()));
-/*    :   :       :   ┃  */                             // ACTUALLY, BECAUSE OF `return`, WE DO NOT RECORD THE `if true` EVEN THOUGH WE COVERED IT.
-/*    :   :       :   ┃  */                             // IN FACT, IF THIS NESTED CONDITIONAL IN A CONDITIONAL EXPRESSION WAS AN `if` (WITHOUT PRECEDING ELSE)
-/*    :   :       :   ┃  */                             // WE WOULD NOT HAVE RECORDED THE COVERAGE OF STATEMENTS LEADING UP TO THE `if`, SO
-/*    :   :       :   ┃  */                             // IT SHOULD BE:
-/*  ┏-:---:-------:---<  */                             return { let __result = Ok(()); __incr_cov(from!("")); __result };
-/*  V :   :       :   :  */                             // NOTE THE `from` STRING IS SAME FOR THE `else if`s `__incr_cov` AND THIS `return`.
-/*    :   :       :   :  */                             // ONLY ONE OF THESE WILL EXECUTE, TO RECORD COVERAGE FROM THAT SPOT.
-/*    :   :       ┃   -  */                         } else {
-/*    :   :       :   I  */                             { let __result = false; __incr_cov(from!("`else`")); __result }
-/*    :   :   -   -      */                         } {
-/*    :   :   ┃          */                     println!("wierd science");
-/*    :   :   ┃          */                     __incr_cov(from!("block start"));
-/*    :   ┃   -          */                 } else {
-/*    :   :   ┃          */                     println!("goblin wins");
-/*  ┏-:---:---<          */                     return { let __result = Ok(()); __incr_cov(from!("`else`")); __result }; // THIS COUNTS LAST STATEMENT IN `else` BLOCK
-/*  V :   :   :          */                     // COVERAGE NOTE: When counting the span for `return`,
-/*    :   :   :          */                     // `break`, or `continue`, also report the outer spans
-/*    :   :   :          */                     // got this far--including this `else` block. Record
-/*    :   :   :          */                     // The start positions for those outer blocks, but:
-/*    :   :   :          */                     // * For the block containing the `return`, `break`, or
-/*    :   :   :          */                     //   `continue`, end report the end position is the
-/*    :   :   :          */                     //   start of the `return` span (or 1 char before it).
-/*    :   :   :          */                     // * Anything else?
-/*    :   ┃   -          */                 }
-/*    :   ┃   -          */                 // __incr_cov(from!("")); // DO NOT COUNT HERE IF NO STATEMENTS AFTER LAST `if` or `match`
-/*    :   -              */             },
-/*    :   I              */             Blue => { println!("violets"); __incr_cov(from!("Blue => or end of MatchArmGuard expression inside pattern, if any")); }
-/*    ┃                  */         }
-/*    ┃                  */
-/*    ┃                  */         let condition1 = true;
-/*    ┃                  */         let condition2 = false;
-/*    ┃                  */         let condition3 = true;
-/*    ┃                  */
-/*    ┃                  */         println!("Called `various()` for TestStruct with field={}", self.field);
-/*    ┃                  */
-/*    ┃   -              */         if { let __result = condition1; __incr_cov(from!("after block end of prior `match` (or `if-else if-else`)")); __result } {
-/*    :   ┃              */             println!("before for loop");
-/*    :   ┃   -          */             for index in { let __result = 0..10; __incr_cov(from!("block start")); __result } {
-/*    :   :   ┃          */                 println!("top of `for` loop");
-/*    :   :   ┃   -      */                 if { let __result = index == 8; __incr_cov(from!("block start")); __result } {
-/*    :   :   :   ┃      */                     println!("before break");
-/*    :   :   :   ┃      */                     // note the following is not legal here:
-/*    :   :   :   ┃      */                     //   "can only break with a value inside `loop` or breakable block"
-/*    :   :   :   ┃      */                     // break __incr_cov(from!(""));
-/*    :   :   :   ┃      */                     __incr_cov(from!("block start"));
-/*    :   : ┏-----<      */                     break;
-/*    :   : V :   :      */
-/*    :   :   :   :      */                     // FIXME(richkadel): add examples with loop labels, breaking out of inner and outer loop to outer loop label, with expression.
-/*    :   :   :   :      */                     // May want to record both the span and the start position after the broken out block depdnding on label
-/*    :   :   ┃   -      */                 }
-/*    :   :   ┃          */                 println!("after `break` test");
-/*    :   :   ┃   -      */                 if { let __result = condition2; __incr_cov(from!("block end of `if index == 8`")); __result } {
-/*  ┏-:---:---:---<      */                     return { let __result = Ok(()); __incr_cov(from!("block start")); __result };
-/*  V :   :   ┃   -      */                 }
-/*    :   :   ┃          */
-/*    :   :   ┃          */                 // BECAUSE THE PREVIOUS COVERAGE REGION HAS A `return`, THEN
-/*    :   :   ┃          */                 // IF PREVIOUS COVERAGE REGION IS NOT COUNTED THEN OUTER REGION REACHED HERE.
-/*    :   :   ┃          */                 // ADD A COVERAGE REGION FOR THE SPAN FROM JUST AFTER PREVIOUS REGION TO END
-/*    :   :   ┃          */                 // OF OUTER SPAN, THEN TRUNCATE TO NEXT REGION NOT REACHED.
-/*    :   :   ┃   -      */                 if index % 3 == 2 { // NO __incr_cov() HERE BECAUSE NO STATEMENTS BETWEEN LAST CONDITIONAL BLOCK AND START OF THIS ONE
-/*    :   : Λ :   ┃      */                     __incr_cov(from!("block end of `if condition2`"));
-/*    :   : ┗-----<      */                     continue;
-/*    :   :   ┃   -      */                 }
-/*    :   :   ┃          */                 println!("after `continue` test");
-/*    :   :   ┃          */                 // maybe add a runtime flag for a possible `return` here?
-/*    :   :   ┃          */                 __incr_cov(from!(""));
-/*    :   ┃   -          */             }
-/*    :   ┃              */             println!("after for loop");
-/*    :   ┃              */             let result = if { // START OF NEW CONDITIONAL EXPRESSION. NEXT "GUARANTEED" COUNTER SHOULD COUNT FROM END OF LAST CONDITIONAL EXPRESSION
-/*    :   ┃              */                               // A "GUARANTEED" COUNTER CALL IS ONE THAT WILL BE CALLED REGARDLESS OF OTHER CONDITIONS. THIS INCLUDES:
-/*    :   ┃              */                               //   * A CONDITIONAL EXPRESSION THAT IS NOT A BLOCK (OR ANOTHER CONDITIONAL STATEMENT, WHICH WOULD CONTAIN A BLOCK)
-/*    :   ┃              */                               //   * OR IF THE NEXT CONDITIONAL EXPRESSION IS A BLOCK OR CONDITIONAL STATEMENT, THEN THE FIRST "GUARANTEED" COUNTER IN THAT BLOCK
-/*    :   ┃              */                               //   * END OF BLOCK IF THE BLOCK DOES NOT HAVE INNER CONDITIONAL EXPRESSIONS
-/*    :   ┃              */                               //   * BRANCHING STATEMENTS (`return`, `break`, `continue`) BY EITHER WRAPPING THE BRANCH STATEMENT NON-BLOCK EXPRESSION,
-/*    :   ┃              */                               //     OR PREPENDING A COUNTER WITH EMPTY TUPLE IF NO EXPRESSION, OR IF EXPRESSION IS A BLOCK, THEN THE NEXT "GUARANTEED"
-/*    :   ┃              */                               //     COUNTER CALL WITHIN THAT BLOCK.
-/*    :   ┃              */                               //   BASICALLY, CARRY THE START OF COVERAGE SPAN FORWARD UNTIL THE GUARANTEED COUNTER IS FOUND
-/*    :   ┃              */                 println!("after result = if ...");
-/*    :   ┃       -      */                 if { let __result = condition2; __incr_cov(from!("block end of `for` loop")); __result } {
-/*    :   :       ┃      */                     println!("before first return");
-/*  ┏-:---:-------<      */                     return { let __result = Ok(()); __incr_cov(from!("block start")); __result };
-/*  V :   :       -      */                 } else if { let __result = condition3; __incr_cov(from!("`else`")); __result } {
-/*    :   :       ┃      */                     // THE ABOVE COUNTER IS _NOT_ REALLY NECESSARY IF EXPRESSION IS GUARANTEED TO EXECUTE.
-/*    :   :       ┃      */                     // IF WE GET COUNTER IN `else if` BLOCK WE COVERED EXPRESSION.
-/*    :   :       ┃      */                     // IF WE GET TO ANY REMAINING `else` or `else if` BLOCK WE KNOW WE EVALUATED THIS CONDITION
-/*    :   :       ┃      */                     // AND ALL OTHERS UP TO THE EXECUTED BLOCK. BUT THE SPAN WOULD HAVE "HOLES" FOR UNEXECUTED BLOCKS.
-/*    :   :       ┃      */                     println!("not second return");
-/*  ┏-:---:-------<      */                     return { let __result = Ok(()); __incr_cov(from!("block start")); __result };
-/*  V :   :       -      */                 } else {
-/*    :   :       ┃      */                     println!("not returning");
-/*    :   :       ┃      */                     { let __result = false; __incr_cov(from!("block start")); __result }
-/*    :   :       -      */                 }
-/*    :   ┃              */                 // NO COUNTER HERE BECAUSE NO STATEMENTS AFTER CONDITIONAL BLOCK
-/*    :   ┃   -          */             } {
-/*    :   :   ┃          */                 println!("branched condition returned true");
-/*    :   :   ┃          */                 { let __result = Ok(()); __incr_cov(from!("")); __result }
-/*    :   ┃   -          */             } else if self.call_closure(
-/*    :   :       -      */                     |closure_param| {
-/*    :   :       ┃   -  */                         let __result = if condition3 {
-/*    :   :       :   ┃  */                             println!("in closure, captured condition said to print the param {}", closure_param);
-/*    :   :       :   ┃  */                             { let __result = false; __incr_cov(from!("")); __result }
-/*    :   :       ┃   -  */                         } else {
-/*    :   :       :   ┃  */                             println!("in closure, captured condition was false");
-/*    :   :       :   ┃  */                             { let __result = true; __incr_cov(from!("")); __result }
-/*    :   :       ┃   -  */                         };
-/*    :   :       -      */                         __incr_cov(from!("")); __result }
-/*    :   :   -          */                 ) {
-/*    :   :   ┃          */                 println!("closure returned true");
-/*    :   :   ┃          */                 { let __result = Err(Error::new(ErrorKind::Other, "Result is error if closure returned true")); __incr_cov(from!("")); __result }
-/*    :   ┃   -          */             } else {
-/*    :   :   ┃          */                 println!("closure returned false");
-/*    :   :   ┃          */                 { let __result = Err(Error::new(ErrorKind::Other, "Result is error if closure returned false")); __incr_cov(from!("")); __result }
-/*    :   ┃   -          */             };
-/*    :   ┃              */             println!("bottom of function might be skipped if early `return`");
-/*    :   ┃              */             { let __result = result; __incr_cov(from!("if condition1")); __result }
-/*    ┃   -              */         } else {
-/*    :   ┃              */             println!("skipping everything in `various()`");
-/*    :   ┃              */             { let __result = Ok(()); __incr_cov(from!("")); __result }
-/*    ┃   -              */         }
-/*    ┃   -              */         // __incr_cov(from!(""),0) // DO NOT COUNT IF NO STATEMENTS AFTER CONDITIONAL BLOCK. ALL COVERAGE IS ALREADY COUNTED
-/*    -                  */     }
-/*                       */ }
-/*                       */
-/*    -                  */ fn main() -> Result<(), std::io::Error> {
-/*    ┃                  */     //let mut status: u8 = 2;
-/*    ┃                  */     let mut status: u8 = 1;
-/*    :       -          */     let result = if status < 2 &&
-/*    :       ┃          */             { let __result = {
-/*    :       ┃          */                 status -= 1;
-/*    :       ┃          */                 status == 0
-/*    :   -   -          */             }; __incr_cov(from!("")); __result } {
-/*    :   ┃              */         let test_struct = TestStruct::new_with_value(100);
-/*    :   ┃              */         let _ = test_struct.various();
-/*  ┏-:---<              */         return { let __result = Err(Error::new(ErrorKind::Other, format!("Error status {}", status))); __incr_cov(from!("")); __report(); __result }
-/*  V :   -              */     } else {
-/*    :   ┃              */         let test_struct = TestStruct::new();
-/*    :   ┃              */         { let __result = test_struct.various(); __incr_cov(from!("")); __result }
-/*    :   -              */     };
-/*    ┃                  */     println!("done");
-/*    ┃                  */     { let __result = result; __incr_cov(from!("")); __report(); __result }
-/*    -                  */ }
\ No newline at end of file
diff --git a/src/test/codegen/coverage-experiments/src/coverage_injection_test_alt.rs b/src/test/codegen/coverage-experiments/src/coverage_injection_test_alt.rs
deleted file mode 100644 (file)
index 20c4835..0000000
+++ /dev/null
@@ -1,362 +0,0 @@
-/*                       */ use std::io::Error;
-/*                       */ use std::io::ErrorKind;
-/*                       */
-/*                       */ /// Align Rust counter increment with with:
-/*                       */ /// [‘llvm.instrprof.increment’ Intrinsic](https://llvm.org/docs/LangRef.html#llvm-instrprof-increment-intrinsic)
-/*                       */ ///
-/*                       */ /// declare void @llvm.instrprof.increment(i8* <name>, i64 <hash>, i32 <num-counters>, i32 <index>)
-/*                       */ ///
-/*                       */ /// The first argument is a pointer to a global variable containing the name of the entity
-/*                       */ /// being instrumented. This should generally be the (mangled) function name for a set of
-/*                       */ /// counters.
-/*                       */ ///
-/*                       */ /// The second argument is a hash value that can be used by the consumer of the profile data
-/*                       */ /// to detect changes to the instrumented source, and the third is the number of counters
-/*                       */ /// associated with name. It is an error if hash or num-counters differ between two
-/*                       */ /// instances of instrprof.increment that refer to the same name.
-/*                       */ ///
-/*                       */ /// The last argument refers to which of the counters for name should be incremented. It
-/*                       */ /// should be a value between 0 and num-counters.
-/*                       */ ///
-/*                       */ /// # Arguments
-/*                       */ ///
-/*                       */ /// `mangled_fn_name` - &'static ref to computed and injected static str, using:
-/*                       */ ///
-/*                       */ ///     ```
-/*                       */ ///     fn rustc_symbol_mangling::compute_symbol_name(
-/*                       */ ///         tcx: TyCtxt<'tcx>,
-/*                       */ ///         instance: Instance<'tcx>,
-/*                       */ ///         compute_instantiating_crate: impl FnOnce() -> CrateNum,
-/*                       */ ///     ) -> String
-/*                       */ ///     ```
-/*                       */ ///
-/*                       */ /// `source_version_hash` - Compute hash based that only changes if there are "significant"
-/*                       */ /// to control-flow inside the function.
-/*                       */ ///
-/*                       */ /// `num_counters` - The total number of counter calls [MAX(counter_index) + 1] within the
-/*                       */ /// function.
-/*                       */ ///
-/*                       */ /// `counter_index` - zero-based counter index scoped by the function. (Ordering of
-/*                       */ /// counters, relative to the source code location, is apparently not expected.)
-/*                       */ ///
-/*                       */ /// # Notes
-/*                       */ ///
-/*                       */ /// * The mangled_fn_name may not be computable until generics are monomorphized (see
-/*                       */ ///   parameters required by rustc_symbol_mangling::compute_symbol_name).
-/*                       */ /// * The version hash may be computable from AST analysis, and may not benefit from further
-/*                       */ ///   lowering.
-/*                       */ /// * num_counters depends on having already identified all counter insertion locations.
-/*                       */ /// * counter_index can be computed at time of counter insertion (incrementally).
-/*                       */ /// * Numeric parameters are signed to match the llvm increment intrinsic parameter types.
-/*                       */ fn __lower_incr_cov(_mangled_fn_name: &'static str, _fn_version_hash: i64, _num_counters: i32, _counter_index: i32) {
-/*                       */ }
-/*                       */
-/*                       */ /// A coverage counter implementation that will work as both an intermediate coverage
-/*                       */ /// counting and reporting implementation at the AST-level only--for debugging and
-/*                       */ /// development--but also serves as a "marker" to be replaced by calls to LLVM
-/*                       */ /// intrinsic coverage counter APIs during the lowering process.
-/*                       */ ///
-/*                       */ /// Calls to this function will be injected automatically into the AST. When LLVM intrinsics
-/*                       */ /// are enabled, the counter function calls that were injected into the AST serve as
-/*                       */ /// placeholders, to be replaced by an alternative, such as:
-/*                       */ ///
-/*                       */ ///     * direct invocation of the `llvm.instrprof.increment()` intrinsic; or
-/*                       */ ///     * the `__lower_incr_cov()` function, defined above, that would invoke the
-/*                       */ ///       `llvm.instrprof.increment()` intrinsic; or
-/*                       */ ///     * a similar expression wrapper, with the additional parameters (as defined above
-/*                       */ ///       for `__lower_incr_cov()`, that invokes `llvm.instrprof.increment()` and returns the
-/*                       */ ///       result of the wrapped expression)
-/*                       */ ///
-/*                       */ /// The first two options would require replacing the inlined wrapper call with something
-/*                       */ /// like:
-/*                       */ ///
-/*                       */ /// ```
-/*                       */ /// { let result = {expr}; __inlined_incr_cov(context, counter); result }
-/*                       */ /// ```
-/*                       */ ///
-/*                       */ /// But if the lowering process is already unwrapping the inlined call to `__incr_cov()`, then
-/*                       */ /// it may be a perfect opportunity to replace the function with one of these more
-/*                       */ /// direct methods.
-/*                       */ ///
-/*                       */ #[inline(always)]
-/*                       */ pub fn __incr_cov(region_loc: &str, /*index: u32,*/) {
-/*                       */     // Either call the intermediate non-llvm coverage counter API or
-/*                       */     // replace the call to this function with the expanded `__lower_incr_cov()` call.
-/*                       */
-/*                       */     // let _lock = increment_counter(counter);
-/*                       */     println!("{}", region_loc);
-/*                       */ }
-/*                       */
-/*                       */ /// Write a report identifying each incremented counter and the number of times each counter
-/*                       */ /// was incremented.
-/*                       */ fn __report() {
-/*                       */     println!("WRITE REPORT!");
-/*                       */ }
-/*                       */
-/*                       */ /// Increment the counter after evaluating the wrapped expression (see `__incr_cov()`), then
-/*                       */ /// write a report identifying each incremented counter and the number of times each counter
-/*                       */ /// was incremented.
-/*                       */ #[inline(always)]
-/*                       */ pub fn __incr_cov_and_report<T>(region_loc: &str, /*counter: u32,*/ result: T) -> T {
-/*                       */     __incr_cov(region_loc, /*counter,*/);
-/*                       */     __report();
-/*                       */     result
-/*                       */ }
-/*                       */
-/*                       */ macro_rules! from {
-/*                       */     ($from:expr) => { &format!("from: {}\n  to: {}:{}:{}", $from, file!(), line!(), column!()) };
-/*                       */ }
-/*                       */
-/*                       */ macro_rules! to {
-/*                       */     ($to:expr) => { &format!("to: {}\n  to: {}:{}:{}", $to, file!(), line!(), column!()) };
-/*                       */ }
-/*                       */
-/*                       */ #[derive(Debug)]
-/*                       */ enum TestEnum {
-/*                       */     Red,
-/*                       */     Green,
-/*                       */     Blue,
-/*                       */ }
-/*                       */
-/*                       */ struct TestStruct {
-/*                       */     field: i32,
-/*                       */ }
-/*                       */
-/*                       */ // IMPORTANT! IS WRAPPING main() ENOUGH? OR DO I ALSO NEED TO WRAP THREAD FUNCTIONS, ASSUMING
-/*                       */ // THEY ARE STILL RUNNING WITH MAIN EXITS? (IF THEY CAN). NOT SURE HOW RUST HANDLES THAT.
-/*                       */
-/*                       */ // I SUSPECT USING THREAD_LOCAL COUNTERS MAY NOT ACTUALLY BE AN OPTIMIZATION OVER MUTEX LOCKS,
-/*                       */ // BUT MAYBE I SHOULD ASK.
-/*                       */
-/*                       */ impl TestStruct {
-/*    -                  */     fn new() -> Self {
-/*    ┃                  */         __incr_cov(to!("end of fn new()")); // function-scoped counter index = 0
-/*    ┃                  */         Self::new_with_value(31415)
-/*    -                  */     }
-/*                       */
-/*    -                  */     fn new_with_value(field: i32) -> Self {
-/*    ┃                  */         __incr_cov(to!("end of fn new_with_value()")); // function-scoped counter index = 0
-/*    ┃                  */         Self {
-/*    ┃                  */             field,
-/*    ┃                  */         }
-/*    -                  */     }
-/*                       */
-/*                       */     fn call_closure<F>(&self, closure: F) -> bool
-/*                       */     where
-/*                       */         F: FnOnce(
-/*                       */             i32,
-/*                       */         ) -> bool,
-/*    -                  */     {
-/*    ┃                  */         __incr_cov(to!("end of fn call_closure()")); // function-scoped counter index = 0
-/*    ┃                  */         closure(123)
-/*    -                  */     }
-/*                       */
-/*    -                  */     fn various(&self) -> Result<(),Error> {
-/*    ┃                  */         __incr_cov(to!("just before next branch: after `match color`: pattern selection"));
-/*    ┃                  */         use TestEnum::*;
-/*    ┃                  */         let mut color = Red;
-/*    ┃                  */         let _ = color;
-/*    ┃                  */         color = Blue;
-/*    ┃                  */         let _ = color;
-/*    ┃                  */         color = Green;
-/*    ┃                  */         match color { // function-scoped counter index = 0
-/*    :                  */
-/*    :                  */             // !!! RECORD SPAN FROM START OF INNERMOST CONTAINING BLOCK (THE FUNCTION IN THIS CASE) TO END OF MATCH EXPRESSION
-/*    :                  */             // If `match`, `while`, `loop`, `for`, `if`, etc. expression has a `return`, `break`, or `continue`
-/*    :                  */             // (if legal), then RECORD SPAN FROM START OF INNERMOST CONTAINING BLOCK TO END OF `return` EXPRESSION
-/*    :                  */             // If the expression includes lazy booleans, nest calls to `__incr_cov()`.
-/*    :   -              */             Red => {
-/*    :   ┃              */                 __incr_cov(to!("end of matched Red"));
-/*    :   ┃              */                 println!("roses");
-/*    :   -              */             }
-/*    :   -              */             Green => {
-/*    :   ┃              */                 __incr_cov(to!("just before next branch: after `if spidey > goblin`"));
-/*    :   ┃              */                 let spidey = 100;
-/*    :   ┃              */                 let goblin = 50;
-/*    :   ┃              */                 // if spidey > goblin {__incr_cov(from!(""),{
-/*    :   ┃              */                 //     println!("what ev");
-/*    :   ┃              */                 // })}
-/*    :   ┃              */                 // ACTUALLY, WRAPPING THE ENTIRE IF BLOCK IN `__incr_cov` IS NOT A GREAT GENERAL RULE.
-/*    :   ┃              */                 // JUST INSERTING A `return`, `break`, or `continue` IN THAT BLOCK (without an intermediate condition)
-/*    :   ┃              */                 // MAKES THE `__incr_cov()` CALL UNREACHABLE!
-/*    :   ┃              */                 // MY ORIGINAL SOLUTION WORKS BETTER (WRAP LAST EXPRESSION OR AFTER LAST SEMICOLON STATEMENT IN BLOCK)
-/*    :   ┃              */                 // UNLESS THE EXPRESSION IS NOT A BLOCK.
-/*    :   ┃   -          */                 if spidey > goblin {
-/*    :   :   ┃          */                     __incr_cov(to!("end of if block, if no earlier branch in this scope"));
-/*    :   :   ┃          */                     println!("spidey beats goblin");
-/*    :   :   ┃          */
-/*    :   ┃   -          */                 } else if {
-/*    :   :   :          */                     // Make sure we can't compute the coverage count here.
-/*    :   :   :          */                     // We know the expression executed if the previous if block DID NOT
-/*    :   :   :          */                     // execute, and either this `else if` block does execute OR any subsequent
-/*    :   :   :          */                     // `else if` or `else` blocks execute, OR none of the blocks in the
-/*    :   :   :          */                     // `if`, `else if` or `else` blocks execute.
-/*    :   :   :          */                     // `if`, `else if` or `else` blocks execute.
-/*    :   :   ┃          */                     __incr_cov(to!("end of `else if spidey == goblin` expression"));
-/*    :   :   ┃          */                     spidey == goblin
-/*    :   ┃   -          */                 } {
-/*    :   :   ┃          */                     __incr_cov(to!("end of if block, if no earlier branch in this scope"));
-/*    :   :   ┃          */                     // COVERAGE NOTE: Do we mark only the expression span (that may be trivial, as in this case),
-/*    :   :   ┃          */                     // or associate it with the outer block, similar to how the `if` expression is associated with
-/*    :   :   ┃          */                     // the outer block? (Although it is a continuation, in a sense, it is discontiguous in this case,
-/*    :   :   ┃          */                     // so I think simpler to just make it its own coverage region.)
-/*    :   :   ┃          */                     println!("it's a draw");
-/*    :   :   ┃          */
-/*    :   ┃   -   -   -  */                 } else if {
-/*    :   :   ┃          */                         __incr_cov(to!("end of `if true`"));
-/*    :   ┃   -   -   -  */                         if true {
-/*    :   :       :   ┃  */                             __incr_cov(to!("end of `return Ok(())`"));
-/*  ┏-:---:-------:---<  */                             return Ok(());
-/*  V :   :       ┃   -  */                         } else {
-/*    :   :       :   ┃  */                             // __incr_cov(to!("end of else block"));
-/*    :   :       :   ┃  */                             // computed counter expression
-/*    :   :       :   ┃  */                             false
-/*    :   :       :   -  */                         }
-/*    :   :   -   -   -  */                     } {
-/*    :   :   ┃          */                     __incr_cov(to!("end of if block"));
-/*    :   :   ┃          */                     println!("wierd science");
-/*    :   ┃   -          */                 } else {
-/*    :   :   ┃          */                     // __incr_cov(to!("end of `return Ok(())"));
-/*    :   :   ┃          */                     // counter expression: (start of Green match arm) - (if spidey > goblin) - (previous `} else if {`)
-/*    :   :   ┃          */                     println!("goblin wins");
-/*  ┏-:---:---<          */                     return Ok(()); // THIS COUNTS LAST STATEMENT IN `else` BLOCK
-/*  V :   :   :          */                     // COVERAGE NOTE: When counting the span for `return`,
-/*    :   :   :          */                     // `break`, or `continue`, also report the outer spans
-/*    :   :   :          */                     // got this far--including this `else` block. Record
-/*    :   :   :          */                     // The start positions for those outer blocks, but:
-/*    :   :   :          */                     // * For the block containing the `return`, `break`, or
-/*    :   :   :          */                     //   `continue`, end report the end position is the
-/*    :   :   :          */                     //   start of the `return` span (or 1 char before it).
-/*    :   :   :          */                     // * Anything else?
-/*    :   ┃   -          */                 }
-/*    :   :              */                 // __incr_cov(to!("end of matched Green"));
-/*    :   :              */                 //  // DO NOT COUNT HERE IF NO STATEMENTS AFTER LAST `if` or `match`
-/*    :   -              */             },
-/*    :   -              */             Blue => {
-/*    :   ┃              */                 __incr_cov(to!("end of matched Blue"));
-/*    :   ┃              */                 println!("violets");
-/*    :   -              */             }
-/*    ┃                  */         }
-/*    ┃                  */         __incr_cov(to!("just before next branch: after `if condition1` (HIR: 'match condition1')"));
-/*    ┃                  */
-/*    ┃                  */         let condition1 = true;
-/*    ┃                  */         let condition2 = false;
-/*    ┃                  */         let condition3 = true;
-/*    ┃                  */
-/*    ┃                  */         println!("Called `various()` for TestStruct with field={}", self.field);
-/*    ┃                  */
-/*    ┃   -              */         if condition1 {
-/*    :   ┃              */             println!("before while loop");
-/*    :   ┃              */             let mut countdown = 10;
-/*    :   ┃              */              // Must increment before repeated while text expression
-/*    :   :   I          */             while  countdown > 0 { // span is just the while test expression
-/*    :   :   ┃          */                 println!("top of `while` loop");
-/*    :   :   ┃          */                 countdown -= 1;
-/*    :   :   ┃          */                 //  // Counter not needed, but span is computed as "while test" minus "block start"
-/*    :   :   ┃          */                                                        // If test expression is 11, and the outer block runs only once, 11-1 = 10
-/*    :   ┃   -          */             }
-/*    :   ┃              */             println!("before for loop");
-/*    :   ┃   -          */             for index in 0..10 {
-/*    :   :   ┃          */                 println!("top of `for` loop");
-/*    :   :   ┃   -      */                 if index == 8 {
-/*    :   :   :   ┃      */                     println!("before break");
-/*    :   :   :   ┃      */                     // note the following is not legal here:
-/*    :   :   :   ┃      */                     //   "can only break with a value inside `loop` or breakable block"
-/*    :   :   :   ┃      */                     // break
-/*    :   :   :   ┃      */
-/*    :   : ┏-----<      */                     break;
-/*    :   : V :   :      */
-/*    :   :   :   :      */                     // FIXME(richkadel): add examples with loop labels, breaking out of inner and outer loop to outer loop label, with expression.
-/*    :   :   :   :      */                     // May want to record both the span and the start position after the broken out block depdnding on label
-/*    :   :   ┃   -      */                 }
-/*    :   :   ┃          */                 println!("after `break` test");
-/*    :   :   ┃   -      */                 if condition2 {
-/*  ┏-:---:---:---<      */                     return Ok(());
-/*  V :   :   ┃   -      */                 }
-/*    :   :   ┃          */
-/*    :   :   ┃          */                 // BECAUSE THE PREVIOUS COVERAGE REGION HAS A `return`, THEN
-/*    :   :   ┃          */                 // IF PREVIOUS COVERAGE REGION IS NOT COUNTED THEN OUTER REGION REACHED HERE.
-/*    :   :   ┃          */                 // ADD A COVERAGE REGION FOR THE SPAN FROM JUST AFTER PREVIOUS REGION TO END
-/*    :   :   ┃          */                 // OF OUTER SPAN, THEN TRUNCATE TO NEXT REGION NOT REACHED.
-/*    :   :   ┃   -      */                 if index % 3 == 2 { // NO __incr_cov() HERE BECAUSE NO STATEMENTS BETWEEN LAST CONDITIONAL BLOCK AND START OF THIS ONE
-/*    :   : Λ :   ┃      */
-/*    :   : ┗-----<      */                     continue;
-/*    :   :   ┃   -      */                 }
-/*    :   :   ┃          */                 println!("after `continue` test");
-/*    :   :   ┃          */                 // maybe add a runtime flag for a possible `return` here?
-/*    :   :   ┃          */
-/*    :   ┃   -          */             }
-/*    :   ┃              */             println!("after for loop");
-/*    :   ┃              */             let result = if { // START OF NEW CONDITIONAL EXPRESSION. NEXT "GUARANTEED" COUNTER SHOULD COUNT FROM END OF LAST CONDITIONAL EXPRESSION
-/*    :   ┃              */                               // A "GUARANTEED" COUNTER CALL IS ONE THAT WILL BE CALLED REGARDLESS OF OTHER CONDITIONS. THIS INCLUDES:
-/*    :   ┃              */                               //   * A CONDITIONAL EXPRESSION THAT IS NOT A BLOCK (OR ANOTHER CONDITIONAL STATEMENT, WHICH WOULD CONTAIN A BLOCK)
-/*    :   ┃              */                               //   * OR IF THE NEXT CONDITIONAL EXPRESSION IS A BLOCK OR CONDITIONAL STATEMENT, THEN THE FIRST "GUARANTEED" COUNTER IN THAT BLOCK
-/*    :   ┃              */                               //   * END OF BLOCK IF THE BLOCK DOES NOT HAVE INNER CONDITIONAL EXPRESSIONS
-/*    :   ┃              */                               //   * BRANCHING STATEMENTS (`return`, `break`, `continue`) BY EITHER WRAPPING THE BRANCH STATEMENT NON-BLOCK EXPRESSION,
-/*    :   ┃              */                               //     OR PREPENDING A COUNTER WITH EMPTY TUPLE IF NO EXPRESSION, OR IF EXPRESSION IS A BLOCK, THEN THE NEXT "GUARANTEED"
-/*    :   ┃              */                               //     COUNTER CALL WITHIN THAT BLOCK.
-/*    :   ┃              */                               //   BASICALLY, CARRY THE START OF COVERAGE SPAN FORWARD UNTIL THE GUARANTEED COUNTER IS FOUND
-/*    :   ┃              */                 println!("after result = if ...");
-/*    :   ┃       -      */                 if condition2 {
-/*    :   :       ┃      */                     println!("before first return");
-/*  ┏-:---:-------<      */                     return Ok(());
-/*  V :   :       -      */                 } else if condition3 {
-/*    :   :       ┃      */                     // THE ABOVE COUNTER IS _NOT_ REALLY NECESSARY IF EXPRESSION IS GUARANTEED TO EXECUTE.
-/*    :   :       ┃      */                     // IF WE GET COUNTER IN `else if` BLOCK WE COVERED EXPRESSION.
-/*    :   :       ┃      */                     // IF WE GET TO ANY REMAINING `else` or `else if` BLOCK WE KNOW WE EVALUATED THIS CONDITION
-/*    :   :       ┃      */                     // AND ALL OTHERS UP TO THE EXECUTED BLOCK. BUT THE SPAN WOULD HAVE "HOLES" FOR UNEXECUTED BLOCKS.
-/*    :   :       ┃      */                     println!("not second return");
-/*  ┏-:---:-------<      */                     return Ok(());
-/*  V :   :       -      */                 } else {
-/*    :   :       ┃      */                     println!("not returning");
-/*    :   :       ┃      */                     false
-/*    :   :       -      */                 }
-/*    :   ┃              */                 // NO COUNTER HERE BECAUSE NO STATEMENTS AFTER CONDITIONAL BLOCK
-/*    :   ┃   -          */             } {
-/*    :   :   ┃          */                 println!("branched condition returned true");
-/*    :   :   ┃          */                 Ok(())
-/*    :   ┃   -          */             } else if self.call_closure(
-/*    :   :       -      */                     |closure_param|
-/*    :   :       ┃   -  */                         if condition3 {
-/*    :   :       :   ┃  */                             println!("in closure, captured condition said to print the param {}", closure_param);
-/*    :   :       :   ┃  */                             false
-/*    :   :       ┃   -  */                         } else {
-/*    :   :       :   ┃  */                             println!("in closure, captured condition was false");
-/*    :   :       :   ┃  */                             true
-/*    :   :       ┃   -  */                         }
-/*    :   :       -      */
-/*    :   :   -          */                 ) {
-/*    :   :   ┃          */                 println!("closure returned true");
-/*    :   :   ┃          */                 Err(Error::new(ErrorKind::Other, "Result is error if closure returned true"))
-/*    :   ┃   -          */             } else {
-/*    :   :   ┃          */                 println!("closure returned false");
-/*    :   :   ┃          */                 Err(Error::new(ErrorKind::Other, "Result is error if closure returned false"))
-/*    :   ┃   -          */             };
-/*    :   ┃              */             println!("bottom of function might be skipped if early `return`");
-/*    :   ┃              */             result
-/*    ┃   -              */         } else {
-/*    :   ┃              */             println!("skipping everything in `various()`");
-/*    :   ┃              */             Ok(())
-/*    ┃   -              */         }
-/*    ┃   -              */         // 0 // DO NOT COUNT IF NO STATEMENTS AFTER CONDITIONAL BLOCK. ALL COVERAGE IS ALREADY COUNTED
-/*    -                  */     }
-/*                       */ }
-/*                       */
-/*    -                  */ fn main() -> Result<(), std::io::Error> {
-/*    ┃                  */     //let mut status: u8 = 2;
-/*    ┃                  */     let mut status: u8 = 1;
-/*    :       -          */     let result = if status < 2 &&
-/*    :       ┃          */             {
-/*    :       ┃          */                 status -= 1;
-/*    :       ┃          */                 status == 0
-/*    :   -   -          */             } {
-/*    :   ┃              */         let test_struct = TestStruct::new_with_value(100);
-/*    :   ┃              */         let _ = test_struct.various();
-/*  ┏-:---<              */         return __incr_cov_and_report(from!(""),Err(Error::new(ErrorKind::Other, format!("Error status {}", status))))
-/*  V :   -              */     } else {
-/*    :   ┃              */         let test_struct = TestStruct::new();
-/*    :   ┃              */         test_struct.various()
-/*    :   -              */     };
-/*    ┃                  */     println!("done");
-/*    ┃                  */     __incr_cov_and_report(from!(""),result) // function-scoped counter index = 0
-/*    -                  */ }
\ No newline at end of file
diff --git a/src/test/codegen/coverage-experiments/src/drop_trait.rs b/src/test/codegen/coverage-experiments/src/drop_trait.rs
deleted file mode 100644 (file)
index 75400e0..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-#[inline(always)]
-pub fn __incr_cov<T>(_region_loc: &str, result: T) -> T {
-    result
-}
-
-struct Firework {
-    _strength: i32,
-}
-
-impl Drop for Firework {
-    fn drop(&mut self) {
-        __incr_cov("start of drop()", ());
-    }
-}
-
-fn main() -> Result<(),u8> {
-    let _firecracker = Firework { _strength: 1 };
-
-    if __incr_cov("start of main()", true) {
-        return __incr_cov("if true", { let _t = Err(1); _t });
-    }
-
-    let _tnt = Firework { _strength: 100 };
-    Ok(())
-}
\ No newline at end of file
diff --git a/src/test/codegen/coverage-experiments/src/drop_trait_with_comments_prints.rs b/src/test/codegen/coverage-experiments/src/drop_trait_with_comments_prints.rs
deleted file mode 100644 (file)
index de9f5d5..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-//
-//
-//
-// It's interesting to speculate if there is a way to leverage the Drop trait functionality
-// to increment counters when a scope is closed, but I don't think it would help "out of the box".
-//
-// A `return` or `break` with expression might not need a temp value expression wrapper
-// such as `return { let _t = result_expression; __incr_counter(...); _t };`
-//
-//    ... **if** the __incr_counter() was somehow called from a "drop()" trait function.
-//
-// The problem is, since the drop call is automatic, there is no way to have argument variants
-// depending on where the drop() occurs (e.g., from a `return` statement vs. from the end of
-// the function). We need 2 different code regions though.
-//
-//
-//
-//
-
-#[inline(always)]
-pub fn __incr_cov<T>(_region_loc: &str, /*index: u32,*/ result: T) -> T {
-    // println!("from: {}", _region_loc);
-    result
-}
-
-struct Firework {
-    strength: i32,
-}
-
-impl Drop for Firework {
-    fn drop(&mut self) {
-        println!("BOOM times {}!!!", self.strength);
-        __incr_cov("start of drop()", ());
-    }
-}
-
-fn main() -> Result<(),u8> {
-    let _firecracker = Firework { strength: 1 };
-
-    if __incr_cov("start of main()", true) {
-        return __incr_cov("if true", { let _t = Err(1); println!("computing return value"); _t });
-    }
-
-    let _tnt = Firework { strength: 100 };
-    // __incr_cov("after if block", Ok(())) // CAN USE COUNTER EXPRESSION: "start of drop()" - "if true"
-    Ok(())
-}
-
-// OUTPUT WHEN RUNNING THIS PROGRAM IS AS EXPECTED:
-
-// computing return value
-// BOOM times 1!!!
-// Error: 1
diff --git a/src/test/codegen/coverage-experiments/src/for.rs b/src/test/codegen/coverage-experiments/src/for.rs
deleted file mode 100644 (file)
index 3f44c38..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-#[inline(always)]
-pub fn __incr_cov<T>(_region_loc: &str, /*index: u32,*/ result: T) -> T {
-    result
-}
-
-fn main() {
-    for countdown in __incr_cov("start", 10..0) {
-        let _ = countdown;
-        __incr_cov("top of for", ());
-    }
-}
-
-// LOWERED TO HIR:
-//
-// fn main() {
-//   {
-//       let _t =
-//           match ::std::iter::IntoIterator::into_iter(__incr_cov("start",
-//                                                                 ::std::ops::Range{start:
-//                                                                                       10,
-//                                                                                   end:
-//                                                                                       0,}))
-//               {
-//               mut iter =>
-//               loop  {
-//                   let mut __next;
-//                   match ::std::iter::Iterator::next(&mut iter) {
-//                       ::std::option::Option::Some(val) =>
-//                       __next = val,
-//                       ::std::option::Option::None => break ,
-//                   }
-//                   let countdown = __next;
-//                   {
-//                       let _ = countdown;
-//                       __incr_cov("top of for", ());
-//                   }
-//               },
-//           };
-//       _t
-//   }
-// }
\ No newline at end of file
diff --git a/src/test/codegen/coverage-experiments/src/for_with_comments.rs b/src/test/codegen/coverage-experiments/src/for_with_comments.rs
deleted file mode 100644 (file)
index 03d11b2..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*                   */ #[inline(always)]
-/*                   */ pub fn __incr_cov<T>(_region_loc: &str, /*index: u32,*/ result: T) -> T {
-/*                   */     result
-/*                   */ }
-/*                   */
-/*    -              */ fn main() {
-/*    :   I          */     for countdown in __incr_cov("start", 10..0) { // span is just the while test expression
-/*    :   ┃          */         let _ = countdown;
-/*    :   ┃          */         __incr_cov("top of for", ());
-/*    ┃   -          */     }
-/*    -              */ }
-
-
-// -Z unpretty=val -- present the input source, unstable (and less-pretty) variants;
-// valid types are any of the types for `--pretty`, as well as:
-// `expanded`, `expanded,identified`,
-// `expanded,hygiene` (with internal representations),
-// `everybody_loops` (all function bodies replaced with `loop {}`),
-// `hir` (the HIR), `hir,identified`,
-// `hir,typed` (HIR with types for each node),
-// `hir-tree` (dump the raw HIR),
-// `mir` (the MIR), or `mir-cfg` (graphviz formatted MIR)
-
-// argument to `pretty` must be one of `normal`, `expanded`, `identified`, or `expanded,identified`
diff --git a/src/test/codegen/coverage-experiments/src/if.rs b/src/test/codegen/coverage-experiments/src/if.rs
deleted file mode 100644 (file)
index ad50f6b..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-#![feature(core_intrinsics)]
-
-pub fn __llvm_incr_counter(_region_loc: &str) {
-}
-
-#[inline(always)]
-pub fn __incr_cov<T>(region_loc: &str, result: T) -> T {
-    __llvm_incr_counter(region_loc);
-    result
-}
-
-static TEST_FUNC_NAME: &'static [u8; 6] = b"main()";
-
-fn main() {
-    let mut countdown = 10;
-    if __incr_cov("start", countdown > 0) {
-
-
-        // // TEST CALLING INTRINSIC:
-        unsafe { core::intrinsics::instrprof_increment(TEST_FUNC_NAME as *const u8, 1234 as u64, 314 as u32, 31 as u32) };
-        // // Results in:
-        // //   LLVM ERROR: Cannot select: intrinsic %llvm.instrprof.increment
-        // // I may need to pass one or more of the following flags (or equivalent opts) to LLVM to enable this:
-        // //   -fprofile-instr-generate -fcoverage-mapping
-
-
-        countdown -= 1;
-        __incr_cov("if block",());
-    } else if countdown > 5 {
-        countdown -= 2;
-        __incr_cov("else if block",());
-    } else {
-        countdown -= 3;
-    }
-
-    let mut countdown = 10;
-    if { let _tcov = countdown > 0; __llvm_incr_counter("start", ); _tcov } {
-        countdown -= 1;
-        __incr_cov("if block",());
-    } else if countdown > 5 {
-        countdown -= 2;
-        __incr_cov("else if block",());
-    } else {
-        countdown -= 3;
-    }
-}
-
-// NOTE: hir REDUNDANTLY lowers the manually inlined counter in the second if block to:
-//
-// match {
-//   let _t =
-//       {
-//           let _tcov = countdown > 0;
-//           __llvm_incr_counter("start");
-//           _tcov
-//       };
-//   _t
-// } {
-
-// I don't know if optimization phases will fix this or not.
-// Otherwise, a more optimal (but definitely special case) way to handle this would be
-// to inject the counter between the hir-introduced temp `_t` assignment and the block result
-// line returning `_t`:
-//
-// match {
-//   let _t = countdown > 0;
-//   __llvm_incr_counter("start"); // <-- the only thing inserted for coverage here
-//   _t
-// }
-//
-// UNFORTUNATELY THIS IS NOT A PATTERN WE CAN ALWAYS LEVERAGE, FOR EXPRESSIONS THAT HAVE VALUES
-// WHERE WE NEED TO INJECT THE COUNTER AFTER THE EXPRESSION BUT BEFORE IT IS USED.
-//
-// IT DOES APPEAR TO BE THE CASE FOR WHILE EXPRESSIONS, (BECOMES loop { match { let _t = condition; _t} { true => {...} _ => break, }})
-// AND IS TRUE FOR IF EXPRESSIONS AS NOTED
-// BUT NOT FOR RETURN STATEMENT (and I'm guessing not for loop { break value; } ? )
-//
-// AND NOT FOR LAZY BOOLEAN EXPRESSIONS!
-//
-// AND NOT FOR MATCH EXPRESSIONS IN THE ORIGINAL SOURCE!
\ No newline at end of file
diff --git a/src/test/codegen/coverage-experiments/src/if_with_comments.rs b/src/test/codegen/coverage-experiments/src/if_with_comments.rs
deleted file mode 100644 (file)
index 267e7bc..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*                   */ #[inline(always)]
-/*                   */ pub fn __incr_cov<T>(_region_loc: &str, /*index: u32,*/ result: T) -> T {
-/*                   */     result
-/*                   */ }
-/*                   */
-/*    -              */ fn main() {
-/*    ┃              */     let mut countdown = 10;
-/*    :   I          */     if __incr_cov("start", countdown > 0) { // span is from start of main()
-/*    :   ┃          */         countdown -= 1;
-/*    :   ┃          */         __incr_cov("if block",());
-/*    ┃   -          */     }
-
-    let mut countdown = 10;
-    if __incr_cov("start", countdown > 0) {
-        countdown -= 1;
-        __incr_cov("if block",());
-    } else if countdown > 5 { // counter expression "start" - "if block"
-        countdown -= 2;
-        __incr_cov("else if block",());
-    } else {
-        countdown -= 3;
-        // __incr_cov("else block",()); // counter expression (countdown > 5 counter expression) - "else if block"
-                                        // PLACED AT END OF ELSE BLOCK OR START OF FIRST CONDITIONAL BLOCK, IF ANY (PRESUMING POSSIBLE EARLY EXIT).
-                                        // IF WE CAN GUARANTEE NO EARLY EXIT IN THIS BLOCK, THEN AT THE END IS FINE EVEN IF ELSE BLOCK CONTAINS OTHER CONDITIONS.
-    }
-
-/*    -              */ }
-
-// -Z unpretty=val -- present the input source, unstable (and less-pretty) variants;
-// valid types are any of the types for `--pretty`, as well as:
-// `expanded`, `expanded,identified`,
-// `expanded,hygiene` (with internal representations),
-// `everybody_loops` (all function bodies replaced with `loop {}`),
-// `hir` (the HIR), `hir,identified`,
-// `hir,typed` (HIR with types for each node),
-// `hir-tree` (dump the raw HIR),
-// `mir` (the MIR), or `mir-cfg` (graphviz formatted MIR)
-
-// argument to `pretty` must be one of `normal`, `expanded`, `identified`, or `expanded,identified`
diff --git a/src/test/codegen/coverage-experiments/src/increment_intrinsic.rs b/src/test/codegen/coverage-experiments/src/increment_intrinsic.rs
deleted file mode 100644 (file)
index d4708cd..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#![feature(core_intrinsics)]
-
-pub fn not_instrprof_increment(_hash: u64, _num_counters: u32, _index: u32) {
-}
-
-fn main() {
-    // COMPARE THIS WITH INTRINSIC INSERTION
-    //not_instrprof_increment(1234 as u64, 314 as u32, 31 as u32);
-
-    unsafe { core::intrinsics::instrprof_increment(1234 as u64, 314 as u32, 31 as u32) };
-}
\ No newline at end of file
diff --git a/src/test/codegen/coverage-experiments/src/just_main.rs b/src/test/codegen/coverage-experiments/src/just_main.rs
deleted file mode 100644 (file)
index 081e5d7..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-fn main() {
-    println!("hello world! (should be covered)");
-}
diff --git a/src/test/codegen/coverage-experiments/src/lazy_boolean.rs b/src/test/codegen/coverage-experiments/src/lazy_boolean.rs
deleted file mode 100644 (file)
index 263277c..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-pub fn __llvm_incr_counter(_region_loc: &str) {
-}
-
-#[inline(always)]
-pub fn __incr_cov<T>(region_loc: &str, result: T) -> T {
-    __llvm_incr_counter(region_loc);
-    result
-}
-
-fn main() {
-    let a = 1;
-    let b = 10;
-    let c = 100;
-    let _result = __incr_cov("start", a < b) || __incr_cov("or", b < c);
-
-    let _result = { let _t = a < b; __llvm_incr_counter("start"); _t } || { let _t = b < c; __llvm_incr_counter("start"); _t };
-}
\ No newline at end of file
diff --git a/src/test/codegen/coverage-experiments/src/loop_break_value.rs b/src/test/codegen/coverage-experiments/src/loop_break_value.rs
deleted file mode 100644 (file)
index 76caa83..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-pub fn __llvm_incr_counter(_region_loc: &str) {
-}
-
-#[inline(always)]
-pub fn __incr_cov<T>(region_loc: &str, result: T) -> T {
-    __llvm_incr_counter(region_loc);
-    result
-}
-
-fn main() {
-    __incr_cov("start", ());
-    let _result = loop {
-        break __incr_cov("top of loop", true);
-    };
-}
\ No newline at end of file
diff --git a/src/test/codegen/coverage-experiments/src/match.rs b/src/test/codegen/coverage-experiments/src/match.rs
deleted file mode 100644 (file)
index afbb208..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-pub fn __llvm_incr_counter(_region_loc: &str) {
-}
-
-#[inline(always)]
-pub fn __incr_cov<T>(region_loc: &str, result: T) -> T {
-    __llvm_incr_counter(region_loc);
-    result
-}
-
-fn main() {
-    let a = 1;
-    let b = 10;
-    let _result = match a < b {
-        true => true,
-        _ => false,
-    };
-
-    let _result = match __incr_cov("end of first match", a < b) {
-        true => __incr_cov("matched true", true),
-        _ => false, // counter expression "end of first match" - "matched true"
-    };
-}
\ No newline at end of file
diff --git a/src/test/codegen/coverage-experiments/src/match_with_increment.rs b/src/test/codegen/coverage-experiments/src/match_with_increment.rs
deleted file mode 100644 (file)
index f618b37..0000000
+++ /dev/null
@@ -1,305 +0,0 @@
-#![feature(core_intrinsics)]
-//static TEST_FUNC_NAME: &'static [u8; 7] = b"main()\0";
-  static TEST_FUNC_NAME: &'static [u8; 6] = b"main()";
-fn main() {
-    let a = 1;
-    let b = 10;
-    let _result = match {
-        let _t = a < b;
-        unsafe { core::intrinsics::instrprof_increment(TEST_FUNC_NAME as *const u8, 1234 as u64, 3 as u32, 0 as u32) };
-        _t
-    } {
-        true => {
-            let _t = true;
-            unsafe { core::intrinsics::instrprof_increment(TEST_FUNC_NAME as *const u8, 1234 as u64, 3 as u32, 1 as u32) };
-            _t
-        }
-        _ => false,
-    };
-}
-
-/*
-
-I NEED TO INSERT THE instrprof_increment() CALL:
-
-  1. JUST BEFORE THE switchInt(_4) (because we haven't counted entering the function main() yet, deferring that to "JUST BEFORE FIRST BRANCH")
-  2. SOME TIME AFTER THE switchInt(_4), AND JUST BEFORE ANOTHER BRANCH (in this case, before "goto")
-  2.a. NOT BEFORE BOTH GOTO'S AFTER switchInt(_4) (because one can be calculated by counter expression), BUT PERHAPS INSERT A noop PLACEHOLDER
-       AS A MARKER TO INCLUDE THE COVERAGE REGION AND REFERENCE THE COUNTERS TO BE SUBTRACTED (AND/OR SUMMED)?
-
-    WHY DEFER INSERTING COUNTERS TO "JUST BEFORE FIRST BRANCH"? We can ignore panic/unwind() and only count if the coverage region ACTUALLY
-    executed in entirety. BUT IS THAT NECESSARY? IS IT MUCH EASIER TO INSERT COUNTERS AT THE TOP OF A REGION THAT MUST EXECUTE IN ENTIRETY IF
-    PANIC DOES NOT OCCUR? AND WHAT IF WE ADD SUPPORT FOR PANIC UNWIND (later)?
-
-    IS THERE A BENEFIT OF THE DEFERRED APPROACH WHEN CONSIDERING EXPRESSIONS MAY HAVE EARLY RETURNS? (BECAUSE, WE STILL NEED TO COUNT THE REGION
-    LEADING UP TO THE EXPRESSION ANYWAY)
-
-=================================================
-=================================================
-
-To inject an intrinsic after computing a final expression value of a coverage region:
-
-Replace the following basic block end (last statement plus terminator):
-
-... <statements to compute _4> ...
-StorageLive(_4)
-StorageLive(_5)
-_5 = _1
-StorageLive(_6)
-_6 = _2
-_4 = Lt(move _5, move _6)
-StorageDead(_6)
-StorageDead(_5)
-                             <------ to insert instrprof_increment() here
-FakeRead(ForMatchedPlace, _4)
---------------------------------------------------------------------------------------
-switchInt(_4)
-
-
-=================================================
-Insert call to intrinsic with:
-
-StorageLive(_4)        # _4 is now meant for deferred FakeRead(ForMatchdPlace, _4) in BasicBlock after increment() call
-StorageLive(_5)                 # Unchanged except _4 is now _5
-StorageLive(_6)                 # Unchanged except _5 is now _6
-_6 = _1                         # Unchanged except _5 is now _6
-StorageLive(_7)                 # Unchanged except _6 is now _7
-_7 = _2                         # Unchanged except _6 is now _7
-_5 = Lt(move _6, move _7)       # Unchanged except _4, _5, _6 is now _5, _6, _7
-StorageDead(_7)                 # Unchanged except _6 is now _7
-StorageDead(_6)                 # Unchanged except _5 is now _6
-
-FakeRead(ForLet, _5)   # CHANGED ForMatchedPlace to ForLet
-
-> # ALL NEW AND NECESSARY TO CALL instrprof_increment()
-> StorageLive(_8)        # ?? stores function pointer to instrprof_increment function?
-> StorageLive(_9)
-> StorageLive(_10)
-> StorageLive(_11)
-> _11 = const {alloc1+0: &&[u8; 6]}
-> _10 = &raw const (*(*_11))
-> _9 = move _10 as *const u8 (Pointer(ArrayToPointer))
-> StorageDead(_10)
-> StorageLive(_12)
-> _12 = const 1234u64
-> StorageLive(_13)
-> _13 = const 3u32
-> StorageLive(_14)
-> _14 = const 0u32
-> --------------------------------------------------------------------------------------
-> _8 = const std::intrinsics::instrprof_increment(move _9, move _12, move _13, move _14)
->
-> -> return
->
-> StorageDead(_14)
-> StorageDead(_13)
-> StorageDead(_12)
-> StorageDead(_9)
-> StorageDead(_11)
-> StorageDead(_8)
-
-_4 = _5                         # ARE THESE LINES REDUNDANT? CAN I JUST PASS _5 DIRECTLY TO FakeRead()?
-StorageDead(_5)                 # DROP "_t" temp result of `let _t = a < b`
-                                # (NOTE THAT IF SO, I CAN REMOVE _5 altogether, and use _4, which coincidentally makes less changes)
-                                # SEE BELOW
-
-FakeRead(ForMatchedPlace, _4)   # Unchanged
---------------------------------------------------------------------------------------
-switchInt(_4)                   # Unchanged
-
-
-=================================================
-Can I skip the extra variable and insert call to intrinsic with:
-
-StorageLive(_4)             # Unchanged
-StorageLive(_5)             # Unchanged
-_5 = _1                     # Unchanged
-StorageLive(_6)             # Unchanged
-_6 = _2                     # Unchanged
-_4 = Lt(move _5, move _6)   # Unchanged
-StorageDead(_6)             # Unchanged
-StorageDead(_5)             # Unchanged
-
-> # ALL NEW AND NECESSARY TO CALL instrprof_increment()
-> FakeRead(ForLet, _4)   # Save the post-increment result in temp "_t"
-> StorageLive(_8)        # ?? stores function pointer to instrprof_increment function?
-> StorageLive(_9)
-> StorageLive(_10)
-> StorageLive(_11)
-> _11 = const {alloc1+0: &&[u8; 6]}
-> _10 = &raw const (*(*_11))
-> _9 = move _10 as *const u8 (Pointer(ArrayToPointer))
-> StorageDead(_10)
-> StorageLive(_12)
-> _12 = const 1234u64
-> StorageLive(_13)
-> _13 = const 3u32
-> StorageLive(_14)
-> _14 = const 0u32
-> --------------------------------------------------------------------------------------
-> _8 = const std::intrinsics::instrprof_increment(move _9, move _12, move _13, move _14)
->
-> -> return
->
-> StorageDead(_14)
-> StorageDead(_13)
-> StorageDead(_12)
-> StorageDead(_9)
-> StorageDead(_11)
-> StorageDead(_8)
-
-FakeRead(ForMatchedPlace, _4)   # Unchanged  (PREVIOUSLY USED IN FakeRead(ForLet), is that OK?)
---------------------------------------------------------------------------------------
-switchInt(_4)                   # Unchanged
-
-
-
-
-
-=================================================
-=================================================
-
-For the second inserted call to instrprof_increment, without that call we have:
-
---------------------------------------------------------------------------------------
-switchInt(_4)                   # From above
-
--> otherwise   # that is, "NOT false"
-
-_3 = const true
-                             <------ to insert instrprof_increment() here
---------------------------------------------------------------------------------------
-goto
-
-->                              # No label. No condition, and not a "return"
-
-FakeRead(ForLet, _3)            # NOTE: Unused result
-StorageDead(_4)
-_0 = ()
-StorageDead(_3)
-StorageDead(_2)
-StorageDead(_1)
---------------------------------------------------------------------------------------
-goto
-
-->                              # No label. No condition, and not a "return"
-
-return   # from main()
-
-
-=================================================
-With the call to increment():
-
---------------------------------------------------------------------------------------
-switchInt(_4)                   # From above
-
--> otherwise   # "NOT false"    # UNCHANGED
-
-StorageLive(_15)                # CHANGED! Allocated new storage (_15) for the result of match, if true.
-_15 = const true                # UNCHANGED except _3 is now _15
-FakeRead(ForLet, _15)           # CHANGED! Assign value to temporary (to be assigned to _3 later) ... Do I need to do this?
-
-> # ALL NEW AND NECESSARY TO CALL instrprof_increment()
-> StorageLive(_16)                # pointer to instrprof_increment() function ?
-> StorageLive(_17)
-> StorageLive(_18)
-> StorageLive(_19)
-> _19 = const {alloc1+0: &&[u8; 6]}
-> _18 = &raw const (*(*_19))
-> _17 = move _18 as *const u8 (Pointer(ArrayToPointer))
-> StorageDead(_18)
-> StorageLive(_20)
-> _20 = const 1234u64
-> StorageLive(_21)
-> _21 = const 3u32
-> StorageLive(_22)
-> _22 = const 1u32
-> --------------------------------------------------------------------------------------
-> _16 = const std::intrinsics::instrprof_increment(move _17, move _20, move _21, move _22)
->
-> ->  return
->
-> StorageDead(_22)
-> StorageDead(_21)
-> StorageDead(_20)
-> StorageDead(_17)
-> StorageDead(_19)
-> StorageDead(_16)
-> _3 = _15
-> StorageDead(_15)
-
---------------------------------# UNCHANGED-------------------------------------------
-goto                            # UNCHANGED
-
-->                              # UNCHANGED
-
-FakeRead(ForLet, _3)            # UNCHANGED
-StorageDead(_4)                 # UNCHANGED
-_0 = ()                         # UNCHANGED
-StorageDead(_3)                 # UNCHANGED
-StorageDead(_2)                 # UNCHANGED
-StorageDead(_1)                 # UNCHANGED
---------------------------------------------------------------------------------------
-goto                            # UNCHANGED
-
-->                              # UNCHANGED
-
-return   # from main()          # UNCHANGED
-
-=================================================
-As before, can I skip the extra variable (_15) and insert the call to intrinsic with _3 directly?:
-
-
---------------------------------------------------------------------------------------
-switchInt(_4)                   # From above
-
--> otherwise   # "NOT false"    # UNCHANGED
-
-_3 = const true                 # UNCHANGED?
-
-> # ALL NEW AND NECESSARY TO CALL instrprof_increment()
-> StorageLive(_16)                # pointer to instrprof_increment() function ?
-> StorageLive(_17)
-> StorageLive(_18)
-> StorageLive(_19)
-> _19 = const {alloc1+0: &&[u8; 6]}
-> _18 = &raw const (*(*_19))
-> _17 = move _18 as *const u8 (Pointer(ArrayToPointer))
-> StorageDead(_18)
-> StorageLive(_20)
-> _20 = const 1234u64
-> StorageLive(_21)
-> _21 = const 3u32
-> StorageLive(_22)
-> _22 = const 1u32
-> --------------------------------------------------------------------------------------
-> _16 = const std::intrinsics::instrprof_increment(move _17, move _20, move _21, move _22)
->
-> ->  return
->
-> StorageDead(_22)
-> StorageDead(_21)
-> StorageDead(_20)
-> StorageDead(_17)
-> StorageDead(_19)
-> StorageDead(_16)
-
---------------------------------# UNCHANGED-------------------------------------------
-goto                            # UNCHANGED
-
-->                              # UNCHANGED
-
-FakeRead(ForLet, _3)            # UNCHANGED
-StorageDead(_4)                 # UNCHANGED
-_0 = ()                         # UNCHANGED
-StorageDead(_3)                 # UNCHANGED
-StorageDead(_2)                 # UNCHANGED
-StorageDead(_1)                 # UNCHANGED
---------------------------------------------------------------------------------------
-goto                            # UNCHANGED
-
-->                              # UNCHANGED
-
-return   # from main()          # UNCHANGED
-
-*/
\ No newline at end of file
diff --git a/src/test/codegen/coverage-experiments/src/match_with_increment_alt.rs b/src/test/codegen/coverage-experiments/src/match_with_increment_alt.rs
deleted file mode 100644 (file)
index 6058696..0000000
+++ /dev/null
@@ -1,296 +0,0 @@
-#![feature(core_intrinsics)]
-//static TEST_FUNC_NAME: &'static [u8; 7] = b"main()\0";
-  static TEST_FUNC_NAME: &'static [u8; 6] = b"main()";
-fn main() {
-    unsafe { core::intrinsics::instrprof_increment(TEST_FUNC_NAME as *const u8, 1234 as u64, 3 as u32, 0 as u32) };
-    let a = 1;
-    let b = 10;
-    let _result = match a < b {
-        true => {
-            unsafe { core::intrinsics::instrprof_increment(TEST_FUNC_NAME as *const u8, 1234 as u64, 3 as u32, 1 as u32) };
-            true
-        }
-        _ => false,
-    };
-}
-
-/*
-
-ALTERNATE APPROACH:
-
-    IS IT MUCH EASIER TO INSERT COUNTERS AT THE TOP OF A REGION THAT MUST EXECUTE IN ENTIRETY IF
-    PANIC DOES NOT OCCUR? AND WHAT IF WE ADD SUPPORT FOR PANIC UNWIND (later)?
-
-    IS THERE A DETRACTOR COMPARED TO THE DEFERRED APPROACH WHEN CONSIDERING EXPRESSIONS MAY HAVE EARLY RETURNS?
-
-    (BECAUSE, WE STILL NEED TO COUNT THE REGION LEADING UP TO THE EXPRESSION ANYWAY)
-
-=================================================
-=================================================
-
-To inject an intrinsic after computing a final expression value of a coverage region:
-
-Replace the following basic block end (last statement plus terminator):
-
-... <statements to compute _4> ...
-StorageLive(_4)
-StorageLive(_5)
-_5 = _1
-StorageLive(_6)
-_6 = _2
-_4 = Lt(move _5, move _6)
-StorageDead(_6)
-StorageDead(_5)
-                             <------ to insert instrprof_increment() here
-FakeRead(ForMatchedPlace, _4)
---------------------------------------------------------------------------------------
-switchInt(_4)
-
-
-=================================================
-Insert call to intrinsic with:
-
-StorageLive(_4)        # _4 is now meant for deferred FakeRead(ForMatchdPlace, _4) in BasicBlock after increment() call
-StorageLive(_5)                 # Unchanged except _4 is now _5
-StorageLive(_6)                 # Unchanged except _5 is now _6
-_6 = _1                         # Unchanged except _5 is now _6
-StorageLive(_7)                 # Unchanged except _6 is now _7
-_7 = _2                         # Unchanged except _6 is now _7
-_5 = Lt(move _6, move _7)       # Unchanged except _4, _5, _6 is now _5, _6, _7
-StorageDead(_7)                 # Unchanged except _6 is now _7
-StorageDead(_6)                 # Unchanged except _5 is now _6
-
-FakeRead(ForLet, _5)   # CHANGED ForMatchedPlace to ForLet
-
-> # ALL NEW AND NECESSARY TO CALL instrprof_increment()
-> StorageLive(_8)        # ?? stores function pointer to instrprof_increment function?
-> StorageLive(_9)
-> StorageLive(_10)
-> StorageLive(_11)
-> _11 = const {alloc1+0: &&[u8; 6]}
-> _10 = &raw const (*(*_11))
-> _9 = move _10 as *const u8 (Pointer(ArrayToPointer))
-> StorageDead(_10)
-> StorageLive(_12)
-> _12 = const 1234u64
-> StorageLive(_13)
-> _13 = const 3u32
-> StorageLive(_14)
-> _14 = const 0u32
-> --------------------------------------------------------------------------------------
-> _8 = const std::intrinsics::instrprof_increment(move _9, move _12, move _13, move _14)
->
-> -> return
->
-> StorageDead(_14)
-> StorageDead(_13)
-> StorageDead(_12)
-> StorageDead(_9)
-> StorageDead(_11)
-> StorageDead(_8)
-
-_4 = _5                         # ARE THESE LINES REDUNDANT? CAN I JUST PASS _5 DIRECTLY TO FakeRead()?
-StorageDead(_5)                 # DROP "_t" temp result of `let _t = a < b`
-                                # (NOTE THAT IF SO, I CAN REMOVE _5 altogether, and use _4, which coincidentally makes less changes)
-                                # SEE BELOW
-
-FakeRead(ForMatchedPlace, _4)   # Unchanged
---------------------------------------------------------------------------------------
-switchInt(_4)                   # Unchanged
-
-
-=================================================
-Can I skip the extra variable and insert call to intrinsic with:
-
-StorageLive(_4)             # Unchanged
-StorageLive(_5)             # Unchanged
-_5 = _1                     # Unchanged
-StorageLive(_6)             # Unchanged
-_6 = _2                     # Unchanged
-_4 = Lt(move _5, move _6)   # Unchanged
-StorageDead(_6)             # Unchanged
-StorageDead(_5)             # Unchanged
-
-> # ALL NEW AND NECESSARY TO CALL instrprof_increment()
-> FakeRead(ForLet, _4)   # Save the post-increment result in temp "_t"
-> StorageLive(_8)        # ?? stores function pointer to instrprof_increment function?
-> StorageLive(_9)
-> StorageLive(_10)
-> StorageLive(_11)
-> _11 = const {alloc1+0: &&[u8; 6]}
-> _10 = &raw const (*(*_11))
-> _9 = move _10 as *const u8 (Pointer(ArrayToPointer))
-> StorageDead(_10)
-> StorageLive(_12)
-> _12 = const 1234u64
-> StorageLive(_13)
-> _13 = const 3u32
-> StorageLive(_14)
-> _14 = const 0u32
-> --------------------------------------------------------------------------------------
-> _8 = const std::intrinsics::instrprof_increment(move _9, move _12, move _13, move _14)
->
-> -> return
->
-> StorageDead(_14)
-> StorageDead(_13)
-> StorageDead(_12)
-> StorageDead(_9)
-> StorageDead(_11)
-> StorageDead(_8)
-
-FakeRead(ForMatchedPlace, _4)   # Unchanged  (PREVIOUSLY USED IN FakeRead(ForLet), is that OK?)
---------------------------------------------------------------------------------------
-switchInt(_4)                   # Unchanged
-
-
-
-
-
-=================================================
-=================================================
-
-For the second inserted call to instrprof_increment, without that call we have:
-
---------------------------------------------------------------------------------------
-switchInt(_4)                   # From above
-
--> otherwise   # that is, "NOT false"
-
-_3 = const true
-                             <------ to insert instrprof_increment() here
---------------------------------------------------------------------------------------
-goto
-
-->                              # No label. No condition, and not a "return"
-
-FakeRead(ForLet, _3)            # NOTE: Unused result
-StorageDead(_4)
-_0 = ()
-StorageDead(_3)
-StorageDead(_2)
-StorageDead(_1)
---------------------------------------------------------------------------------------
-goto
-
-->                              # No label. No condition, and not a "return"
-
-return   # from main()
-
-
-=================================================
-With the call to increment():
-
---------------------------------------------------------------------------------------
-switchInt(_4)                   # From above
-
--> otherwise   # "NOT false"    # UNCHANGED
-
-StorageLive(_15)                # CHANGED! Allocated new storage (_15) for the result of match, if true.
-_15 = const true                # UNCHANGED except _3 is now _15
-FakeRead(ForLet, _15)           # CHANGED! Assign value to temporary (to be assigned to _3 later) ... Do I need to do this?
-
-> # ALL NEW AND NECESSARY TO CALL instrprof_increment()
-> StorageLive(_16)                # pointer to instrprof_increment() function ?
-> StorageLive(_17)
-> StorageLive(_18)
-> StorageLive(_19)
-> _19 = const {alloc1+0: &&[u8; 6]}
-> _18 = &raw const (*(*_19))
-> _17 = move _18 as *const u8 (Pointer(ArrayToPointer))
-> StorageDead(_18)
-> StorageLive(_20)
-> _20 = const 1234u64
-> StorageLive(_21)
-> _21 = const 3u32
-> StorageLive(_22)
-> _22 = const 1u32
-> --------------------------------------------------------------------------------------
-> _16 = const std::intrinsics::instrprof_increment(move _17, move _20, move _21, move _22)
->
-> ->  return
->
-> StorageDead(_22)
-> StorageDead(_21)
-> StorageDead(_20)
-> StorageDead(_17)
-> StorageDead(_19)
-> StorageDead(_16)
-> _3 = _15
-> StorageDead(_15)
-
---------------------------------# UNCHANGED-------------------------------------------
-goto                            # UNCHANGED
-
-->                              # UNCHANGED
-
-FakeRead(ForLet, _3)            # UNCHANGED
-StorageDead(_4)                 # UNCHANGED
-_0 = ()                         # UNCHANGED
-StorageDead(_3)                 # UNCHANGED
-StorageDead(_2)                 # UNCHANGED
-StorageDead(_1)                 # UNCHANGED
---------------------------------------------------------------------------------------
-goto                            # UNCHANGED
-
-->                              # UNCHANGED
-
-return   # from main()          # UNCHANGED
-
-=================================================
-As before, can I skip the extra variable (_15) and insert the call to intrinsic with _3 directly?:
-
-
---------------------------------------------------------------------------------------
-switchInt(_4)                   # From above
-
--> otherwise   # "NOT false"    # UNCHANGED
-
-_3 = const true                 # UNCHANGED?
-
-> # ALL NEW AND NECESSARY TO CALL instrprof_increment()
-> StorageLive(_16)                # pointer to instrprof_increment() function ?
-> StorageLive(_17)
-> StorageLive(_18)
-> StorageLive(_19)
-> _19 = const {alloc1+0: &&[u8; 6]}
-> _18 = &raw const (*(*_19))
-> _17 = move _18 as *const u8 (Pointer(ArrayToPointer))
-> StorageDead(_18)
-> StorageLive(_20)
-> _20 = const 1234u64
-> StorageLive(_21)
-> _21 = const 3u32
-> StorageLive(_22)
-> _22 = const 1u32
-> --------------------------------------------------------------------------------------
-> _16 = const std::intrinsics::instrprof_increment(move _17, move _20, move _21, move _22)
->
-> ->  return
->
-> StorageDead(_22)
-> StorageDead(_21)
-> StorageDead(_20)
-> StorageDead(_17)
-> StorageDead(_19)
-> StorageDead(_16)
-
---------------------------------# UNCHANGED-------------------------------------------
-goto                            # UNCHANGED
-
-->                              # UNCHANGED
-
-FakeRead(ForLet, _3)            # UNCHANGED
-StorageDead(_4)                 # UNCHANGED
-_0 = ()                         # UNCHANGED
-StorageDead(_3)                 # UNCHANGED
-StorageDead(_2)                 # UNCHANGED
-StorageDead(_1)                 # UNCHANGED
---------------------------------------------------------------------------------------
-goto                            # UNCHANGED
-
-->                              # UNCHANGED
-
-return   # from main()          # UNCHANGED
-
-*/
\ No newline at end of file
diff --git a/src/test/codegen/coverage-experiments/src/match_without_increment.mir b/src/test/codegen/coverage-experiments/src/match_without_increment.mir
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/src/test/codegen/coverage-experiments/src/match_without_increment.rs b/src/test/codegen/coverage-experiments/src/match_without_increment.rs
deleted file mode 100644 (file)
index fa85833..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-fn main() {
-    let a = 1;
-    let b = 10;
-    let _result = match a < b { true => true, _ => false, };
-}
\ No newline at end of file
diff --git a/src/test/codegen/coverage-experiments/src/match_without_increment_alt.mir b/src/test/codegen/coverage-experiments/src/match_without_increment_alt.mir
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/src/test/codegen/coverage-experiments/src/question_mark_err_status_handling_with_comments.rs b/src/test/codegen/coverage-experiments/src/question_mark_err_status_handling_with_comments.rs
deleted file mode 100644 (file)
index 03d11b2..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*                   */ #[inline(always)]
-/*                   */ pub fn __incr_cov<T>(_region_loc: &str, /*index: u32,*/ result: T) -> T {
-/*                   */     result
-/*                   */ }
-/*                   */
-/*    -              */ fn main() {
-/*    :   I          */     for countdown in __incr_cov("start", 10..0) { // span is just the while test expression
-/*    :   ┃          */         let _ = countdown;
-/*    :   ┃          */         __incr_cov("top of for", ());
-/*    ┃   -          */     }
-/*    -              */ }
-
-
-// -Z unpretty=val -- present the input source, unstable (and less-pretty) variants;
-// valid types are any of the types for `--pretty`, as well as:
-// `expanded`, `expanded,identified`,
-// `expanded,hygiene` (with internal representations),
-// `everybody_loops` (all function bodies replaced with `loop {}`),
-// `hir` (the HIR), `hir,identified`,
-// `hir,typed` (HIR with types for each node),
-// `hir-tree` (dump the raw HIR),
-// `mir` (the MIR), or `mir-cfg` (graphviz formatted MIR)
-
-// argument to `pretty` must be one of `normal`, `expanded`, `identified`, or `expanded,identified`
diff --git a/src/test/codegen/coverage-experiments/src/while.rs b/src/test/codegen/coverage-experiments/src/while.rs
deleted file mode 100644 (file)
index 3cb185e..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#[inline(always)]
-pub fn __incr_cov<T>(_region_loc: &str, result: T) -> T {
-    result
-}
-
-fn main() {
-    let mut countdown = 10;
-    __incr_cov("block start",());
-    while __incr_cov("while test", countdown > 0) {
-        countdown -= 1;
-    }
-
-    let mut countdown = 10;
-    __incr_cov("after first while loop",());
-    while __incr_cov("while test", countdown > 0) {
-        countdown -= 1;
-        if countdown < 5 {
-            __incr_cov("top of if countdown < 5",());
-            break;
-        }
-        countdown -= 2;
-    }
-}
\ No newline at end of file
diff --git a/src/test/codegen/coverage-experiments/src/while_clean.rs b/src/test/codegen/coverage-experiments/src/while_clean.rs
deleted file mode 100644 (file)
index e9ed1ef..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-fn main() {
-    let mut countdown = 10;
-    while countdown > 0 {
-        countdown -= 1;
-    }
-}
\ No newline at end of file
diff --git a/src/test/codegen/coverage-experiments/src/while_early_return.rs b/src/test/codegen/coverage-experiments/src/while_early_return.rs
deleted file mode 100644 (file)
index 35709ff..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-fn main() -> u8 { // this will lower to HIR but will not compile: `main` can only return types that implement `std::process::Termination`
-    let mut countdown = 10;
-    while countdown > 0 {
-        if false {
-            return if countdown > 8 { 1 } else { return 2; };
-        }
-        countdown -= 1;
-    }
-    0
-}
\ No newline at end of file
diff --git a/src/test/codegen/coverage-experiments/src/while_with_comments.rs b/src/test/codegen/coverage-experiments/src/while_with_comments.rs
deleted file mode 100644 (file)
index 56417fe..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*                   */ #[inline(always)]
-/*                   */ pub fn __incr_cov<T>(_region_loc: &str, /*index: u32,*/ result: T) -> T {
-/*                   */     result
-/*                   */ }
-/*                   */
-/*    -              */ fn main() {
-/*    ┃              */     let mut countdown = 10;
-/*    ┃              */     __incr_cov("block start",()); // Must increment before repeated while text expression
-/*    :   I          */     while __incr_cov("while test", countdown > 0) { // span is just the while test expression
-/*    :   ┃          */         countdown -= 1;
-/*    :   ┃          */         // __incr_cov("while loop",()); // Counter not needed, but span is computed as "while test" minus "block start"
-/*    :   ┃          */                                         // If while criteria is tested 11 times, and the outer block runs only once, 11-1 = 10
-/*    :   ┃          */         // REMOVING COUNTER ASSUMES NO EARLY RETURN THOUGH.
-/*    :   ┃          */         // I THINK WE CAN ONLY USE THE COUNTER EXPRESSION UP TO FIRST CONDITIONAL BLOCK, IF ANY (if, match, maybe any loop)
-/*    ┃   -          */     }
-
-    let mut countdown = 10;
-    __incr_cov("after first while loop",());
-    while __incr_cov("while test", countdown > 0) {
-        countdown -= 1;
-        // if __incr_cov("top of while loop", countdown < 5) {
-        if countdown < 5 { // "top of while loop" = counter expression "while test" - "after first while loop"
-            __incr_cov("top of if countdown < 5",());
-            break;
-        }
-        countdown -= 2;
-        // __incr_cov("after if countdown < 5 block", ());
-        // "after if countdown < 5 block" = counter expression "top of while loop" - "top of if countdown < 5"
-        // HOWEVER, WE CAN ONLY REMOVE THE COUNTER AND USE COUNTER EXPRESSION IF WE **KNOW** THAT THE BODY OF THE IF
-        // WILL **ALWAYS** BREAK (OR RETURN, OR CONTINUE?)
-        // AND THUS WE TREAT THE STATEMENTS FOLLOWING THE IF BLOCK AS IF THEY WERE AN ELSE BLOCK.
-        // THAT'S A LOT TO ASK.
-
-        // PERHAPS TREAT EARLY RETURNS AS A SPECIAL KIND OF COUNTER AND IF ANY ARE INVOKED BEFORE STATEMENTS AFTER THE BLOCK THAT CONTAINS THEM,
-        // THEN SUBTRACT THOSE COUNTS FROM THE COUNT BEFORE THE BLOCK (AS WE DO HERE)? (SO ONE SET OF EXPRESSIONS MUST SUM ALL OF THE EARLY
-        // RETURNS)
-    }
-/*    -              */ }
-
-
-// -Z unpretty=val -- present the input source, unstable (and less-pretty) variants;
-// valid types are any of the types for `--pretty`, as well as:
-// `expanded`, `expanded,identified`,
-// `expanded,hygiene` (with internal representations),
-// `everybody_loops` (all function bodies replaced with `loop {}`),
-// `hir` (the HIR), `hir,identified`,
-// `hir,typed` (HIR with types for each node),
-// `hir-tree` (dump the raw HIR),
-// `mir` (the MIR), or `mir-cfg` (graphviz formatted MIR)
-
-// argument to `pretty` must be one of `normal`, `expanded`, `identified`, or `expanded,identified`