Repository navigation
JIT: handle relational operators in range overflow analysis - #134375
Conversation
|
Azure Pipelines: Successfully started running 5 pipeline(s). 11 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Co-authored-by: EgorBo <[email protected]>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Add a focused regression test covering the relational-expression optimization path.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
What changed in this PR
Updates JIT range-overflow analysis to recognize relational operators and eliminate redundant bounds checks.
Changes:
- Treats comparisons as non-overflowing while checking operands recursively.
- Enables bounds-check elimination for comparison-based expressions.
| File | Description |
|---|---|
src/coreclr/jit/rangecheck.cpp |
Extends overflow analysis to relational operators. |
|
PTAL @AndyAyersMS very few diffs, but the change is one-liner. I was looking at user code that contained a redundant bound check (see #134368). Turns out JIT was conservatively giving up in DoesOverflow for index being a relop. Relop is always just 0 or 1, but I also conservatively check operands for overflow. |

GetClosestCosineIndexretains two redundant bounds checks because overflow analysis rejects relational expressions.