Add FileCheck test for elided bounds checks#123585
Merged
Conversation
Co-authored-by: EgorBo <523221+EgorBo@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add FileCheck test to verify absence of bounds checks
Add FileCheck test for elided bounds checks
Jan 24, 2026
This was referenced Jan 25, 2026
Open
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a JIT FileCheck-based regression test to ensure bounds checks are fully elided (no CORINFO_HELP_RNGCHKFAIL) for several common “proven in-range” indexing patterns on x64 and arm64.
Changes:
- Add new
ElidedBoundsCheckstest methods that exercise range-analysis patterns where the JIT should prove indices are in-bounds. - Add FileCheck
X64-NOT/ARM64-NOTannotations to ensure noCORINFO_HELP_RNGCHKFAILappears in generated code. - Add a dedicated test project with
HasDisasmCheck=trueand environment settings to force optimized JIT compilation.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/tests/JIT/opt/RangeChecks/ElidedBoundsChecks.cs | Introduces FileCheck-annotated methods and an entrypoint that exercises them. |
| src/tests/JIT/opt/RangeChecks/ElidedBoundsChecks.csproj | Enables disasm-based checking (HasDisasmCheck) and configures environment for stable optimized codegen. |
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @dotnet/jit-contrib |
Member
|
@dotnet/jit-contrib PTAL a FileCheck test. I just wanted to make sure none of my BCE related tests silently break these cases (will probably add various loop-related tests at some point) |
jakobbotsch
approved these changes
Jan 26, 2026
Member
|
/ba-g deadletter |
This was referenced Jan 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #123583
Description
Adds a FileCheck test that verifies codegen doesn't contain bounds checks (
CORINFO_HELP_RNGCHKFAIL) for patterns where the JIT should prove access is in-bounds.Test Methods
ulong.Log2()result (0-63) indexes 64-element span(span.Length - 1)patternFiles Added
src/tests/JIT/opt/RangeChecks/ElidedBoundsChecks.cs- Test methods withX64-NOTandARM64-NOTFileCheck annotationssrc/tests/JIT/opt/RangeChecks/ElidedBoundsChecks.csproj- Project withHasDisasmCheck=trueOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.