-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Support loop cloning of byte array accesses #48894
Conversation
Cloning pattern matches morphed array index expressions, looking for expressions that include bounds checks that can potentially be removed. It wasn't matching array index expressions for byte arrays, which don't have an index scaling expression. This change simply matches that pattern.
@AndyAyersMS PTAL |
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.
What happens for arrays of structs where there's likely a MUL or more complex tree in there?
Arrays of structs are not handled (actually, there is some code to specifically disallow handling them). I opened #48897 to track this. |
/azp run runtime-coreclr outerloop |
Azure Pipelines successfully started running 1 pipeline(s). |
{ | ||
return false; | ||
// No scale (e.g., byte array). | ||
index = si; |
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.
Do we need to add some assert to make sure the array is what we expect?
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.
Sorry, I missed this before merge. There's certainly some question about what additional things could/should be checked in this pattern matching. Types, for example. For this case, the index is checked (lower down) to be a lclvar that is the same as the array bounds check base, so we're good.
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.
Any reason the filenames in the diffs are being output as numbers?
|
@benaadams SuperPMI asm diffs (as opposed to "jit-diff" asm diffs) generates a file per function, with the number being the "method context number" (aka the function number in the MCH file) as the filename. The "per-file" stats hence aren't really interesting. We could think about how to make the jit-analyze output more useful when doing SPMI diffs (for starters, just don't show the per-file section). |
Loop cloning does pattern matching on morphed array index expressions, looking
for expressions that include bounds checks that can potentially
be removed. It wasn't matching array index expressions for byte arrays,
which don't have an index scaling expression. This change simply
matches that pattern.
A few spmi asmdiff results (these are all size regressions because loops get cloned when they previously didn't):
Benchmarks:
Detail diffs
Tests:
Detail diffs