-
Couldn't load subscription status.
- Fork 5.2k
Increase cost of ARR_LENGTH node to match IND(ADD(..,CNS)) #117531
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
Conversation
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
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.
Pull Request Overview
This PR updates the evaluation cost of the GT_MDARR_LOWER_BOUND (array length) node so that it matches the cost of an IND(ADD(addr, smallCns)) sequence, improving both performance scoring and code size estimates.
- Revised the explanatory comment to reference the
IND(ADD(...))pattern. - Increased
costExby 2 (fromIND_COST_EX - 1toIND_COST_EX + 1). - Updated
costSzfrom2to4(2 * 2).
|
@dotnet/jit-contrib @jakobbotsch opinions on this? diffs imply it's a perfscore improvement. |
Can you spot check some of the size regressions that are perfscore improvements? What happens in them and do they look beneficial? I am fine with this change. |
@jakobbotsch so my motivation to was to use more of LCL_VAR because those support constant folding with help of assertions, e.g.: if (arr.Length == 10)
{
memcpy(,, arr.Length); // I want to unroll this one.
}in this case if it gets CSE'd then the assert-prop kicks in, if it's not - it doesn't. I actually tried to fix assertprop by just supporting ARR_LENGTH folding, but diffs were not nice #117505 Many size regressions seem to be caused by extra push+pop instructions for callee-saved registers used for extra CSEs. e.g.:
|
…otnet#117531)" This reverts commit 5c17036.

ARR_LENGTH was (2,2) while IND(ADD(addr, 8)) is (4,4) while both are effectively the same.
Diffs - seems to be a big PerfScore improvement. Surprisingly, it's also a size improvement on arm64.