Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Working expression optimization, and some improvements to branch-level source coverage #78040

Closed

Commits on Oct 21, 2020

  1. Injecting expressions in place of counters where helpful

    Starting with implementing the Graph traits for the BasicCoverageBlock
    graph.
    richkadel committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    51e07b8 View commit details
    Browse the repository at this point in the history
  2. Removed most TODO comments and OBE lines

    Most of these TODO comments were reminders to remove commented out lines
    that were saved but replaced with an alternative implementation.
    
    Now that the new BCB graph is implemented and tests still pass, it
    should be safe to remove the older attempts.
    richkadel committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    ea64143 View commit details
    Browse the repository at this point in the history
  3. Expression optimization is nearly working

    I need to change how I determine if a target from a SwitchInt exits the
    loop or not, but this almost worked (and did successfully compile and
    create the right coverage). It just didn't select the right targets for
    the optimized expressions.
    richkadel committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    dcb4b24 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    aa9747d View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    6d78047 View commit details
    Browse the repository at this point in the history
  6. Generally working expressions

    Still not fully optimized to remove unneeded expressions, or expressions
    that complicate the MIR a bit without really improving coverage or
    efficiency.
    
    Getting some coverage results that don't seem right:
      * In three tests, the last line of the function (last brace) is
        counted twice.
      * In simple_match, the { let z; match is counted zero times (and used
        to be uncovered) but how would a developer ever get non-zero coverage
        for this code?
    richkadel committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    bce5815 View commit details
    Browse the repository at this point in the history
  7. Fixed coverage issues that I didn't like.

    * Avoid adding coverage to unreachable blocks.
    * Special case for Goto at the end of the body. Make it non-reportable.
    richkadel committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    3aef9e0 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    756b920 View commit details
    Browse the repository at this point in the history
  9. Don't automatically add counters to BCBs without CoverageSpans

    They may still get counters but only if there are dependencies from
    other BCBs that have spans, I think.
    
    At least one test, "various_conditions.rs", seems to have simplified
    counters as a result of this change, for whatever reason.
    richkadel committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    cc00eb0 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    736ddb9 View commit details
    Browse the repository at this point in the history
  11. Make CodeRegions optional for Counters too

    I relized the "hack" with GapRegions was completely unnecessary. It is
    possible to inject counters (`llvm.instrprof.increment` intrinsic calls
    without corresponding code regions in the coverage map. An expression
    can still uses these counter values, solving the problem I thought I
    needed GapRegions for.
    richkadel committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    6436892 View commit details
    Browse the repository at this point in the history
  12. instrument_coverage.rs -> instrument_coverage/mod.rs

    Just moved the file, before refactoring into multiple files in the new
    compiler/rustc_mir/src/transform/instrument_coverage/ directory.
    richkadel committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    b052391 View commit details
    Browse the repository at this point in the history
  13. Completed most of the refactoring, except make_bcb_counters()

    Still working on make_bcb_counters() refacoring to split it into
    separate functions.
    richkadel committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    c564a3f View commit details
    Browse the repository at this point in the history
  14. Apparently there were a few recent changes affecting tests

    I should have re-tested for these, in the last PR. Here are those
    updates.
    richkadel committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    1296fe3 View commit details
    Browse the repository at this point in the history
  15. Fixed four bugs found while compiling a larger set of real world crates

    Compiling with coverage, with the expression optimization, now works on
    the json5format crate and its dependencies.
    richkadel committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    334bbbe View commit details
    Browse the repository at this point in the history
  16. Refactored debug features from mod.rs to debug.rs

    Also removed the SIMPLIFY_EXPRESSIONS option, which added complexity
    without tangible benefits.
    richkadel committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    4ee5cec View commit details
    Browse the repository at this point in the history

Commits on Oct 22, 2020

  1. Configuration menu
    Copy the full SHA
    31a0b6b View commit details
    Browse the repository at this point in the history
  2. Refactored make_bcb_counters() into several smaller functions

    It could be refactored even further, if that's preferred/requested, but
    its much better than it was ;-).
    richkadel committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    17c1f14 View commit details
    Browse the repository at this point in the history