-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fold BOX+ISINST to null if possible #88989
Conversation
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
@MihuBot -tier0 |
src/coreclr/jit/importer.cpp
Outdated
if ((opts != BoxPatterns::MakeInlineObservation) && | ||
((impStackTop().val->gtFlags & GTF_SIDE_EFFECT) == 0)) | ||
{ | ||
if ((opts == BoxPatterns::IsByRefLike) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we do this for byref-like types? Note that the exact patterns that are supported for them is documented here and I think it is expected that other patterns continue throwing (or, alternatively, that the pattern is documented).
A separate question -- doesn't this logic essentially subsume the logic that happens below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A separate question -- doesn't this logic essentially subsume the logic that happens below?
Sort of, in this case we only handle MustNot case while the logic below handles both Must and MustNot - I tried to share them but decided that it's not worth it, also, removed nullable<> support since it didn't add any diffs
Should we do this for byref-like types?
Let me remove it then and keep only the patterns listed there then
Closes #88987
Tier0 Codegen diff for
Test<int>
:Consume
call is still here but it's underif (false)
branch, we just can't properly fold that never-taken branch in Tier0 (needs forward sub in tier0) - not a big deal, at least, it no longer allocates.Some nice jit-diffs numbers locally.