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

[MIR trans] Optimize trans for biased switches #33566

Merged
merged 1 commit into from
May 14, 2016

Commits on May 11, 2016

  1. [MIR trans] Optimize trans for biased switches

    Currently, all switches in MIR are exhausitive, meaning that we can have
    a lot of arms that all go to the same basic block, the extreme case
    being an if-let expression which results in just 2 possible cases, be
    might end up with hundreds of arms for large enums.
    
    To improve this situation and give LLVM less code to chew on, we can
    detect whether there's a pre-dominant target basic block in a switch
    and then promote this to be the default target, not translating the
    corresponding arms at all.
    
    In combination with rust-lang#33544 this makes unoptimized MIR trans of
    nickel.rs as fast as using old trans and greatly improves the times for
    optimized builds, which are only 30-40% slower instead of ~300%.
    
    cc rust-lang#33111
    dotdash committed May 11, 2016
    Configuration menu
    Copy the full SHA
    49b2cdf View commit details
    Browse the repository at this point in the history