Repository navigation
JIT: Fold unsigned constant range tests - #135421
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 0a3719cb-02eb-4e5d-bce9-bffc4f4ee19c
|
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 |
There was a problem hiding this comment.
🟡 Changes recommended
The newly enabled unsigned transformation needs targeted regression coverage; builds and runtime tests were not run during this review.
1 open finding
What changed in this PR
Extends the JIT’s existing range folding to unsigned comparisons, addressing the digit-range optimization in #135418.
Changes:
- Allows unsigned constant range tests.
- Requires matching signedness for folding and preserves the signed-only nonnegative fallback.
| File | Description |
|---|---|
| src/coreclr/jit/optimizebools.cpp | Enables unsigned range folding with signedness guards. |
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
|
PTAL @adamperlin @dotnet/jit-contrib The diffs are quite small, but there is no reason to give up on Unsigned in that transformation (I remember I just conservatively gave up on them there). Fixes user's repro: #135418 |
|
@EgorBo Note that in my example, I used an |
adamperlin
left a comment
There was a problem hiding this comment.
This LGTM. Do existing tests for range folding cover the unsigned case?
The JIT actually represents |
It makes a lot of sense, and explains why it did not work either way. |

Closes #135418
Enable unsigned constant range folding in
optOptimizeBools. Foruint n: