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

Add additional binary operations into the RangeCheck analysis. #61662

Merged
merged 6 commits into from
Dec 9, 2021

Commits on Nov 17, 2021

  1. Add additional binary operations into the RangeCheck analysis.

    GT_LSH and GT_MUL are now covered in the range analysis check. This
    allows to catch and eliminate the range check for cases like
    
    ```
    ReadOnlySpan<byte> readOnlySpan => new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
    
    byte byt = 0;
    for (int i = 0; i < 5; i++)
    {
      byt = readOnlySpan[i * 3];
      // ...
    }
    ```
    
    or
    
    ```
    bool[] flags = new bool[Size + 1];
    
    for (int i = 2; i <= Size; i++)
    {
      for (int k = i * 2; k <= Size; k += i)
      {
        flags[k] = false;
      }
    }
    ```
    
    Note that without this change, the previous snippet would not eliminate
    the range check on `flags[k]`, but the equivalent snippet would
    
    ```
    for (int i = 2; i <= Size; i++)
    {
      for (int k = i + i; k <= Size; k += i)
      {
        flags[k] = false;
      }
    }
    
    ```
    
    as additional was implemented in the range check analysis, but multiply
    was not.
    anthonycanino committed Nov 17, 2021
    Configuration menu
    Copy the full SHA
    ebc2288 View commit details
    Browse the repository at this point in the history

Commits on Nov 18, 2021

  1. RangeCheck multiply overflow fix and tests.

    Tests catch some edge cases with multiplcation overflow IF
    the overflow detection isn't implemented correctly.
    anthonycanino committed Nov 18, 2021
    1 Configuration menu
    Copy the full SHA
    162ed95 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    33a3b43 View commit details
    Browse the repository at this point in the history

Commits on Nov 19, 2021

  1. Configuration menu
    Copy the full SHA
    7872399 View commit details
    Browse the repository at this point in the history

Commits on Dec 6, 2021

  1. Update src/coreclr/jit/rangecheck.cpp

    Co-authored-by: Egor Bogatov <egorbo@gmail.com>
    anthonycanino and EgorBo authored Dec 6, 2021
    Configuration menu
    Copy the full SHA
    9b4470c View commit details
    Browse the repository at this point in the history
  2. Update src/coreclr/jit/rangecheck.cpp

    Co-authored-by: Egor Bogatov <egorbo@gmail.com>
    anthonycanino and EgorBo authored Dec 6, 2021
    Configuration menu
    Copy the full SHA
    01e4faa View commit details
    Browse the repository at this point in the history