JIT: Preserve checked additions in rotation recognition - #133869
Merged
Merged
Conversation
|
Azure Pipelines: 16 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @dotnet/runtime-infrastructure |
Co-authored-by: EgorBo <523221+EgorBo@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix rotation recognition dropping OverflowException in add.ovf
JIT: Preserve checked additions in rotation recognition
Sep 14, 2026
EgorBo
marked this pull request as ready for review
September 14, 2026 13:47
|
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. |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No unresolved review issues remain.
Pull request overview
Preserves checked shift-count additions during JIT rotation recognition and adds regression coverage.
Changes:
- Skip rotation folding when the addition may overflow.
- Add 14 32/64-bit rotation regression cases.
File summaries
| File | Summary |
|---|---|
src/coreclr/jit/morph.cpp |
Guards rotation recognition against checked additions. |
src/tests/JIT/CodeGenBringUpTests/Rotate.cs |
Adds checked rotation regression tests. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Member
|
PTAL @jakobbotsch @dotnet/jit-contrib, copilot added probably way more tests than it needed, but it won't hurt I think |
jakobbotsch
approved these changes
Sep 15, 2026
tannergooding
approved these changes
Sep 15, 2026
Member
|
/ba-g #133936 |
jtschuster
pushed a commit
to jtschuster/runtime
that referenced
this pull request
Sep 18, 2026
<!-- --> Rotation recognition could discard a checked shift-count addition, suppressing `OverflowException` and leaving stale `GTF_EXCEPT` flags that trigger a Checked-JIT assertion. - **Recognition:** Require `!gtOverflow()` before folding `ADD(NEG(y), N)` into a rotate. - **Regression coverage:** Add 14 cases covering 32/64-bit left/right rotations, overflow boundaries, unchecked negation wrapping, and normal shift counts. <!-- START COPILOT CODING AGENT SUFFIX --> - Fixes dotnet#133863 --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: EgorBo <523221+EgorBo@users.noreply.github.com>
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.
Rotation recognition could discard a checked shift-count addition, suppressing
OverflowExceptionand leaving staleGTF_EXCEPTflags that trigger a Checked-JIT assertion.!gtOverflow()before foldingADD(NEG(y), N)into a rotate.add.ovfin the shift count (missing OverflowException + Checked assert) #133863