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

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

Merged
merged 2 commits into from
Nov 3, 2023

Commits on Nov 2, 2023

  1. [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
    vfdff committed Nov 2, 2023
    Configuration menu
    Copy the full SHA
    e86a303 View commit details
    Browse the repository at this point in the history
  2. [SimplifyCFG] Fix the compile crash when default branch is unreachable

    This modification will squash to the previous commit if accepted.
    Seperate it just to make it more clearly to review.
    vfdff committed Nov 2, 2023
    Configuration menu
    Copy the full SHA
    64be382 View commit details
    Browse the repository at this point in the history