Fix range-check monotonicity for multiplication#130426
Merged
Merged
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 3f1f7aae-af73-4d20-8036-8fc58daa4f21
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new JIT regression test under src/tests/JIT/Regression/JitBlue and wires it into the merged regression test project, covering a miscompile scenario around negative induction variables multiplied by 2.
Changes:
- Added
Runtime_130425regression test implemented as a merged-runner test using xUnit assertions. - Updated
Regression_ro_2.csprojto compile the new test source file.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/tests/JIT/Regression/Regression_ro_2.csproj | Includes the new Runtime_130425 test source in the merged regression project. |
| src/tests/JIT/Regression/JitBlue/Runtime_130425/Runtime_130425.cs | New regression test validating the expected result for the problematic loop/range-analysis scenario. |
Propagate non-negative requirements from multiplication and left shifts back to loop initial values before widening their ranges. Fixes dotnet#130425 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 3f1f7aae-af73-4d20-8036-8fc58daa4f21
Conservatively stop treating multiplication and left shifts as monotonically increasing. SuperPMI benchmarks show no asm diffs from the more precise fix. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 3f1f7aae-af73-4d20-8036-8fc58daa4f21
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Member
Author
|
PTAL @dotnet/jit-contrib AI-found fix for a potential correctness issue with a repro. minimal diffs Instead of attempting to fix the monotonically-increased logic for GT_MUL, GT_LSH I just disabled it for them, left only correct GT_ADD |
jakobbotsch
reviewed
Jul 10, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 04aea4d9-a12d-4589-a2cd-426e4af339c8
jakobbotsch
approved these changes
Jul 10, 2026
Member
Author
|
/ba-g infra issues |
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.
Range analysis treated multiplication and left shifts as monotonically increasing even though both operations can decrease negative values. This could widen an invalid range and incorrectly fold comparisons.
Conservatively restrict monotonic widening to addition. SuperPMI
benchmarks.runshowed zero asm diffs compared with the more precise fix. Adds a regression test for the reported miscompile.Fixes #130425.