-
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
Pi-Digits: Extra Struct copies of BigInteger #5785
Comments
The JIT doesn't do copy-prop for structs, see #4308
Presumably by "block copy" you mean using a SSE move and not something like
Because t4 isn't used after the call? Yeah, that would be nice but that's a bit of fortunate case. In general the JIT has to make such copies when passing value types by value due to the rather unfortunate calling convention.
It is because the JIT doesn't know that |
/cc @dotnet/jit-contrib |
This is an issue on Linux codegen because of the way structs are treated. |
In addition to the failure to eliminate struct copies as noted in #4308, this suffers from the following additional issue:
|
With the combination of improved inlining (which eliminates the address-taking of a struct passed to the constructor) and #39326 which keeps more reg-passed structs in registers, the extra copies have been eliminated. Note that this was referring to the older version of pi-digits which has since been eliminated (I had to go back to an old dotnet/coreclr version to find it). |
RYUJit has several extra struct copies of the two field BigInteger struct in the pi-digit Benchmark's functions.
For example, here's the code for
pidigits:extract_digit(int):int:this
The comments indicate block struct copy/init as well as field assignments.
There are several extra copies in this code:
t3
struct after each function is unnecessary. The return struct can be reused for next computation. This could be an isolated issue wrt Copy-prop of struct-return values that can be fixed. This accounts for three copies.this->BI1
(via pointerp
) could be block copied, but is field-copiedt2 = t4
copy is unnecessary -- could be caused by phase ordering where one of the structs is lowered early.t4
necessary before call to constructor?category:cq
theme:structs
skill-level:expert
cost:extra-large
The text was updated successfully, but these errors were encountered: