[release/9.0-staging] JIT: fix local assertion prop error for partial local comparisons#112539
Merged
jeffschwMSFT merged 2 commits intorelease/9.0-stagingfrom Feb 28, 2025
Merged
Conversation
If a JTRUE comparison only involves part of a local value we cannot make assertions about the local as a whole. Fixes #111352.
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Member
|
cc @dotnet/jit-contrib @jeffschwMSFT |
jeffschwMSFT
approved these changes
Feb 13, 2025
Member
jeffschwMSFT
left a comment
There was a problem hiding this comment.
lgtm. please get a code review. we will take this for consideration in 9.0.x
amanasifkhalid
approved these changes
Feb 14, 2025
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Backport of #112506 to release/9.0-staging
/cc @AndyAyersMS
Customer Impact
We got a report of incorrect behavior in 9.0 on github: #111352
This is silent bad code and could impact customers unexpectedly.
Regression
Introduced by #94741. We enabled more aggressive assertion propagation in the JIT "morph" phase, and one of the new classes of assertions could incorrectly draw inferences from operations on just the low 32 bits of
longvariables.For example; if the program had code like
Then the JIT would mistakenly optimize the
WriteLinetoWriteLine($"{x},{x}");Testing
Verified on a private repo case from the user that opened the issue, and extracted the problematic pattern and added a new test case.
Risk
Low. This optimization was enabled in our mainline in Dec 2023 and has just surfaced now. Also, no SPMI hits for this pattern.