Skip to content

More cleanups in rangecheck/assertionprop#129325

Merged
EgorBo merged 8 commits into
dotnet:mainfrom
EgorBo:cleanup-rngchk-3
Jul 3, 2026
Merged

More cleanups in rangecheck/assertionprop#129325
EgorBo merged 8 commits into
dotnet:mainfrom
EgorBo:cleanup-rngchk-3

Conversation

@EgorBo

@EgorBo EgorBo commented Jun 12, 2026

Copy link
Copy Markdown
Member
  • Remove GTF_CHK_INDEX_INBND and unconditionally always remove GT_BOUNDS_CHECK in assertprop when we can
  • Remove FEATURE_ENABLE_NO_RANGE_CHECKS and DOTNET_JitNoRngChks, these were never enabled by default and I don't think they have any value.
  • Correctness improvement: we no longer use this potential bug and extract all side-effects.

Copilot AI review requested due to automatic review settings June 12, 2026 13:32
@github-actions github-actions Bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jun 12, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR simplifies RyuJIT range-check handling by removing an unused “no range checks” configuration path and deleting the GTF_CHK_INDEX_INBND flag-based, deferred bounds-check removal logic in assertion propagation, replacing it with direct removal that preserves operand side effects.

Changes:

  • Remove FEATURE_ENABLE_NO_RANGE_CHECKS / JitNoRngChks config plumbing.
  • Remove GTF_CHK_INDEX_INBND and the GT_COMMA special-case path used to defer redundant GT_BOUNDS_CHECK removal.
  • Remove the optRemoveStandaloneRangeCheck wrapper and update bounds-check removal in assertion prop to directly replace the node with a side-effect-preserving NOTHING/COMMA.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/coreclr/jit/optimizer.cpp Removes optRemoveStandaloneRangeCheck wrapper (standalone removal now handled differently).
src/coreclr/jit/jitconfigvalues.h Deletes JitNoRngChks config entry (previously gated by a feature define).
src/coreclr/jit/gentree.h Removes GTF_CHK_INDEX_INBND flag definition.
src/coreclr/jit/compiler.h Removes declarations tied to deleted helpers (optRemoveStandaloneRangeCheck, optAssertionProp_Comma).
src/coreclr/jit/assertionprop.cpp Removes deferred/comma-based bounds-check elimination and directly rewrites redundant GT_BOUNDS_CHECK to side-effect-only execution.
src/coreclr/inc/switches.h Deletes the dormant FEATURE_ENABLE_NO_RANGE_CHECKS toggle comment/define.

Comment thread src/coreclr/jit/assertionprop.cpp
@xackus

xackus commented Jun 12, 2026

Copy link
Copy Markdown

FYI I've seen people interested in enabling FEATURE_ENABLE_NO_RANGE_CHECKS in custom runtime builds:
MonoGame/MonoGame#8194 (comment)

@EgorBo

EgorBo commented Jun 12, 2026

Copy link
Copy Markdown
Member Author

FYI I've seen people interested in enabling FEATURE_ENABLE_NO_RANGE_CHECKS in custom runtime builds: MonoGame/MonoGame#8194 (comment)

We've significantly improved the range check analysis over the last few years, so the need for elided checks should be much less relevant today. I'd suggest introducing helper calls that remove the checks and using them where the profiler points out a problem

Copilot AI review requested due to automatic review settings June 12, 2026 19:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comment thread src/coreclr/jit/assertionprop.cpp Outdated
Mirror the hack in optRemoveRangeCheck: extract only GTF_ASG from the
length and full side effects from the index, deliberately dropping the
length load's null-check exception to avoid size regressions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 26, 2026 01:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comment thread src/coreclr/jit/assertionprop.cpp Outdated
Copilot AI review requested due to automatic review settings July 1, 2026 16:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comment thread src/coreclr/jit/assertionprop.cpp Outdated
@EgorBo

EgorBo commented Jul 3, 2026

Copy link
Copy Markdown
Member Author

A small clean up PR with a few diffs

Unfortunately, I had to keep

        gtExtractSideEffList(arrBndsChkLen, &sideEffList, GTF_ASG);
        gtExtractSideEffList(arrBndsChkIdx, &sideEffList);

(we have it today in optRemoveStandaloneRangeCheck) due to size regressions.
Also, removed JitNoRngChks

PTAL @jakobbotsch @dotnet/jit-contrib

@EgorBo
EgorBo requested a review from jakobbotsch July 3, 2026 13:55
Comment thread src/coreclr/jit/assertionprop.cpp
@EgorBo
EgorBo enabled auto-merge (squash) July 3, 2026 16:22
@EgorBo
EgorBo merged commit 651c190 into dotnet:main Jul 3, 2026
133 of 137 checks passed
@EgorBo
EgorBo deleted the cleanup-rngchk-3 branch July 3, 2026 16:22
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview7 milestone Jul 4, 2026
eiriktsarpalis pushed a commit that referenced this pull request Jul 15, 2026
* Remove `GTF_CHK_INDEX_INBND` and unconditionally always remove
`GT_BOUNDS_CHECK` in assertprop when we can
* Remove `FEATURE_ENABLE_NO_RANGE_CHECKS` and `DOTNET_JitNoRngChks`,
these were never enabled by default and I don't think they have any
value.
* Correctness improvement: we no longer use this [potential
bug](https://github.com/dotnet/runtime/blob/d71e0a994980fc47a1efb4ce2c207947e7efedca/src/coreclr/jit/optimizer.cpp#L5545-L5553)
and extract all side-effects.

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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.

5 participants