Skip to content

Conversation

@EgorBo
Copy link
Member

@EgorBo EgorBo commented Nov 17, 2024

Optimizes bounds check for #109899

@ghost ghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Nov 17, 2024
@EgorBo
Copy link
Member Author

EgorBo commented Nov 18, 2024

PTAL @AndyAyersMS @dotnet/jit-contrib a change to optimize bounds check for "arr[X >> CNS]" pattern in order to remove unsafe code from the repo

return Range(Limit(Limit::keConstant, 0));
}

// Calculate max possible value of op1, e.g. UINT_MAX for TYP_INT/TYP_UINT
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was wondering if we could use IntegralRange here but that seems a bit clunky.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initially, I wanted to call RangeCheck::ComputeRange on op1 to get even more precise range, but it had no diffs

@EgorBo EgorBo merged commit 50cbcb3 into dotnet:main Nov 20, 2024
143 checks passed
@EgorBo EgorBo deleted the drop-bounds-check-rsz branch November 20, 2024 13:20
mikelle-rogers pushed a commit to mikelle-rogers/runtime that referenced this pull request Dec 10, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Dec 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants