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

Reorder mir_const_qualif to make promotion in consts more consistent #65883

Closed
wants to merge 4 commits into from

Commits on Oct 28, 2019

  1. Swap order of mir_const_qualif and mir_validated

    Computing `mir_const_qualif` requires running
    `QualifyAndPromoteConstants`, but no promotion was actually done until
    `mir_validated`. This required persisting a `BitSet` of promoted locals
    across queries, making it difficult to properly handle promotion in
    `const`s.
    
    This commit swaps the order of the two queries, and stores the result of
    `mir_const_qualif` (a single `u8`) in the result of `mir_validated`.
    `mir_const_qualif` now simply invokes `mir_validated` and extracts this
    result.
    ecstatic-morse committed Oct 28, 2019
    Configuration menu
    Copy the full SHA
    0a2ff68 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    bcbfcaa View commit details
    Browse the repository at this point in the history
  3. Don't check new promotion logic in consts if CFG is complex

    The old promotion logic ignores anything after a branch or loop in a
    `const`, so the new logic will often find new things to promote. Note
    that we can't actually do promotion in a `const` within a loop body
    using the current approach of removing `Drop` and `StorageDead`.
    ecstatic-morse committed Oct 28, 2019
    Configuration menu
    Copy the full SHA
    a49eece View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    9ac2147 View commit details
    Browse the repository at this point in the history