Fix potential fgIsBigOffset issue in optAssertionIsNonNull#124289
Draft
EgorBo wants to merge 1 commit intodotnet:mainfrom
Draft
Fix potential fgIsBigOffset issue in optAssertionIsNonNull#124289EgorBo wants to merge 1 commit intodotnet:mainfrom
EgorBo wants to merge 1 commit intodotnet:mainfrom
Conversation
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates CoreCLR JIT assertion propagation to avoid double-peeling offsets (tree-level + VN-level) in optAssertionIsNonNull, ensuring fgIsBigOffset is applied to the combined peeled offset and removing reliance on gtEffectiveVal for this analysis.
Changes:
- Switch global assertion-prop non-null checks to VN-only offset peeling with an explicit
fgIsBigOffsetguard. - Switch local assertion-prop non-null checks to use
gtPeelOffsetsto compute the full summed offset before applyingfgIsBigOffset. - Remove the prior
gtEffectiveVal-based restriction so global AP can reason about non-lclvar trees via VN.
77d2a0a to
6acc5d3
Compare
This was referenced Feb 12, 2026
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.
Currently in optAssertionIsNonNull we start from peeling the offset from GenTree:
runtime/src/coreclr/jit/assertionprop.cpp
Lines 4618 to 4624 in 92741be
Then, for Global-AP we peel it again on top of VN level:
runtime/src/coreclr/jit/assertionprop.cpp
Lines 4655 to 4657 in 92741be
but this time we don't check the offset with fgIsBigOffset (in fact, we should check the sum of both offsets).
Instead, this PR only does VN-level peeling for global AP and uses a special
gtPeelOffsethelper for the local one.Also, removed unsound use of
gtEffectiveVal