Skip to content

Remove O1K_BOUND_OPER_BND and O1K_BOUND_LOOP_BND#124065

Merged
EgorBo merged 14 commits intodotnet:mainfrom
EgorBo:last-cleanup
Feb 7, 2026
Merged

Remove O1K_BOUND_OPER_BND and O1K_BOUND_LOOP_BND#124065
EgorBo merged 14 commits intodotnet:mainfrom
EgorBo:last-cleanup

Conversation

@EgorBo
Copy link
Member

@EgorBo EgorBo commented Feb 6, 2026

This PR removes the remaining O1K_BOUND_OPER_BND and O1K_BOUND_LOOP_BND.

All bounds-related assertions now look like:

O1K_VN  -- OAK_<relop> -- O2K_CHECKED_BOUND_ADD_CNS
  • op1.vn - just some variable
  • op2.vn - the checked bound
  • op2.icon.iconValue - the int constant added to the checked bound

Hence, it's unified for e.g. "x < len" and "x < (len - 10)". The "x < len" is effectively "x < (len + 0)".

Overall, it simplifies a lot the search for relevant assertions as we no longer need to decompose relopVNs (and its operands) into pieces every time.

Did a small cleanup along the way. It brings some improvements mostly due to "don't create useless complimentary assertions such as X > BND" check. Also, TP improvements.

Diffs

Copilot AI review requested due to automatic review settings February 6, 2026 02:21
@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 Feb 6, 2026
@dotnet-policy-service
Copy link
Contributor

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

Copy link
Contributor

Copilot AI left a comment

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 refactors the JIT's assertion system to remove two legacy assertion kinds (O1K_BOUND_OPER_BND and O1K_BOUND_LOOP_BND) and replaces them with pure relational operator assertions. This simplifies the assertion representation by eliminating the "relop != 0" pattern in favor of direct relop assertions (e.g., "i < len" instead of "(i < len) != 0").

Changes:

  • Removed O1K_BOUND_OPER_BND and O1K_BOUND_LOOP_BND assertion kinds and replaced them with pure relop assertions using OAK_GE, OAK_GT, OAK_LE, OAK_LT
  • Added O2K_CHECKED_BOUND_BINOP to distinguish binary operations on checked bounds from plain checked bounds
  • Simplified IsVNCheckedBoundArith to accept output parameters and handle constant extraction and normalization directly
  • Removed obsolete helper methods (GetCompareCheckedBound, GetCheckedBoundArithInfo, GetCompareCheckedBoundArithInfo) and the CompareCheckedBoundArithInfo struct

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/coreclr/jit/valuenum.h Removed CompareCheckedBoundArithInfo struct and obsolete method declarations; updated IsVNCheckedBoundArith signature to accept output parameters
src/coreclr/jit/valuenum.cpp Refactored IsVNCheckedBoundArith to return bound VN and constant via output parameters; removed helper methods and debug dump code for old assertion format
src/coreclr/jit/rangecheck.cpp Updated range checking logic to work with pure relop assertions; simplified extraction of comparison operators using ToCompareOper
src/coreclr/jit/compiler.h Removed old assertion kinds; added O2K_CHECKED_BOUND_BINOP; refactored CreateCompareCheckedBoundArith to create pure relop assertions; updated helper methods
src/coreclr/jit/assertionprop.cpp Removed debug printing code for old assertion kinds; added printing support for O2K_CHECKED_BOUND_BINOP; updated assertion validation

Copilot AI review requested due to automatic review settings February 6, 2026 17:57
Copy link
Contributor

Copilot AI left a comment

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 5 out of 5 changed files in this pull request and generated 1 comment.

Copilot AI review requested due to automatic review settings February 6, 2026 19:25
Copy link
Contributor

Copilot AI left a comment

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 5 out of 5 changed files in this pull request and generated 3 comments.

Copilot AI review requested due to automatic review settings February 6, 2026 20:27
Copy link
Contributor

Copilot AI left a comment

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 5 out of 5 changed files in this pull request and generated 2 comments.

Copilot AI review requested due to automatic review settings February 6, 2026 20:57
Copy link
Contributor

Copilot AI left a comment

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 5 out of 5 changed files in this pull request and generated 1 comment.

@EgorBo EgorBo marked this pull request as ready for review February 6, 2026 21:35
@EgorBo
Copy link
Member Author

EgorBo commented Feb 6, 2026

PTAL @AndyAyersMS @dotnet/jit-contrib

@EgorBo EgorBo requested a review from AndyAyersMS February 6, 2026 22:56
Copy link
Member

@AndyAyersMS AndyAyersMS left a comment

Choose a reason for hiding this comment

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

LGTM.

Maybe run fuzzlyn here too?

@EgorBo
Copy link
Member Author

EgorBo commented Feb 7, 2026

/azp run Fuzzlyn

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copilot AI review requested due to automatic review settings February 7, 2026 02:14
@EgorBo
Copy link
Member Author

EgorBo commented Feb 7, 2026

/azp run Fuzzlyn

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

Copilot AI left a comment

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 5 out of 5 changed files in this pull request and generated 1 comment.

@EgorBo
Copy link
Member Author

EgorBo commented Feb 7, 2026

@AndyAyersMS I've addressed your feedback, fuzzlyn failures seem unrelated, in fact, most of them should be fixed by #124128

@EgorBo EgorBo enabled auto-merge (squash) February 7, 2026 17:19
@EgorBo EgorBo merged commit 912f1e2 into dotnet:main Feb 7, 2026
130 of 139 checks passed
@EgorBo EgorBo deleted the last-cleanup branch February 7, 2026 17:19
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.

2 participants