[release/9.0-staging] JIT: fix local assertion prop error for partial local comparisons #112539
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
long
variables.For example; if the program had code like
Then the JIT would mistakenly optimize the
WriteLine
toWriteLine($"{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.