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

Hint the maximum length permitted by invariant of slices #77023

Merged
merged 1 commit into from
Oct 4, 2020

Commits on Oct 4, 2020

  1. Assume slice len is bounded by allocation size

    Uses assume to check the length against a constant upper bound. The
    inlined result then informs the optimizer of the sound value range.
    
    This was tried with unreachable_unchecked before which introduces a
    branch. This has the advantage of not being executed in sound code but
    complicates basic blocks. It resulted in ~2% increased compile time in
    some worst cases.
    
    Add a codegen test for the assumption, testing the issue from rust-lang#67186
    HeroicKatora committed Oct 4, 2020
    Configuration menu
    Copy the full SHA
    e44784b View commit details
    Browse the repository at this point in the history