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

[SimplifyCFG] Delete the unnecessary range check for small mask operation #65835

Merged
merged 2 commits into from
Oct 26, 2023

Commits on Oct 26, 2023

  1. Configuration menu
    Copy the full SHA
    925f462 View commit details
    Browse the repository at this point in the history
  2. [SimplifyCFG] Delete the unnecessary range check for small mask opera…

    …tion
    
    When the small mask value little than 64, we can eliminate the checking
    for upper limit of the range by enlarge the lookup table size to the maximum
    index value. (Then the final table size grows to the next pow2 value)
    ```
    bool f(unsigned x) {
        switch (x % 8) {
            case 0: return 1;
            case 1: return 0;
            case 2: return 0;
            case 3: return 1;
            case 4: return 1;
            case 5: return 0;
            case 6: return 1;
    
            // This would remove the range check: case 7: return 0;
        }
        return 0;
    }
    ```
    Use WouldFitInRegister instead of fitsInLegalInteger to support
    more result type beside bool.
    
    Fixes llvm#65120
    Reviewed By: zmodem, nikic, RKSimon
    vfdff committed Oct 26, 2023
    6 Configuration menu
    Copy the full SHA
    5e07481 View commit details
    Browse the repository at this point in the history