-
Notifications
You must be signed in to change notification settings - Fork 5.3k
JIT: Clone ADDR(LCL) for DUP #64171
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
JIT: Clone ADDR(LCL) for DUP #64171
Conversation
|
Tagging subscribers to this area: @JulieLeeMSFT Issue DetailsLow-hanging fruit, closes #57055 and codegen issues in this tweet https://twitter.com/badamczewski01/status/1484990815910957058
|
src/coreclr/jit/importer.cpp
Outdated
| { | ||
| needsTemp = false; | ||
| } | ||
| else if (tree->TypeIs(TYP_BYREF) && tree->OperIs(GT_ADDR) && tree->gtGetOp1()->IsLocal()) |
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 this also check for TYP_I_IMPL or GT_IND? What about the GT_OBJ scenario?
Asking since these are all special cases we handle in impSIMDPopStack to cover ref T, T*, and a few other scenarios: https://github.com/dotnet/runtime/blob/main/src/coreclr/jit/simd.cpp#L1225-L1305
So I'd imagine they may also qualify here in some circumstances.
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.
This is checking for addresses only, so, no need to check for indirections.
This should probably be using impIsAddressInLocal to catch both LCL_VAR_ADDR and LCL_FLD_ADDR - equivalent trees.
|
coreclr_tests, libraries_tests and libraries.crossgen2 seems to have regression I guess there is some more tuning needed to make sure we don't do unnecessary copies? I will have to see if some of them can be eliminated by #64130. |
Thanks, I didn't realize that for compDbg I had to always "clone" rather than making a temp, fixed.
I am seeing a lot of size regression with There are still some regressions since struct enreg is not always a good thing e.g. when we need to copy struct. Overall, diff is negative and the example from the tweet is improved. |
kunalspathak
left a comment
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.
There are still some regressions since struct enreg is not always a good thing e.g. when we need to copy struct. Overall, diff is negative and the example from the tweet is improved.
Can you paste the diff of regression with a sample example? It will help me in my future work on structs.
|
@kunalspathak here is a minimal repro: public virtual DateTimeOffset? EndTime { get; set; }
public TimeSpan Duration() =>
(EndTime?.Subtract(DateTimeOffset.MinValue)).Value;Diff: https://www.diffchecker.com/QZjlpePR All of them look like this (quite often connected with |
kunalspathak
left a comment
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.
LGTM

Low-hanging fruit, closes #57055 and codegen issues in this tweet https://twitter.com/badamczewski01/status/1484990815910957058
Diffs: https://dev.azure.com/dnceng/public/_build/results?buildId=1572041&view=ms.vss-build-web.run-extensions-tab