Skip to content
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

Unix: Unnecessary struct copy while passsing struct of size <=16 #6316

Closed
sejongoh opened this issue Jul 13, 2016 · 2 comments
Closed

Unix: Unnecessary struct copy while passsing struct of size <=16 #6316

sejongoh opened this issue Jul 13, 2016 · 2 comments
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI enhancement Product code improvement that does NOT require public API changes/additions optimization os-linux Linux OS (any supported distro) tenet-performance Performance related issue
Milestone

Comments

@sejongoh
Copy link
Contributor

Struct arguments whose size is <= 16 bytes generate unnecessary copies. @sivarv categorized the cases below:

The following are the struct passing cases on Amd64 Unix that are of interest:

  1. struct of size 1,2,4 or 8 in memory/register is getting passed in an arg reg or on stack
  2. struct of size 3,5,6,7 in memory/register is getting passed in an arg reg or on stack
  3. struct of size 9-16 bytes in memory is getting passed in two arg registers
  4. struct of size 9-16 bytes (e.g. SIMD structs Vector3 and Vector4) in a register is getting passed in two arg registers
  5. struct of size 9-16 bytes in memory/register is getting passed on stack.

In fgMorphArgs, eeGetSystemVAmd64PassStructInRegisterDescriptor classifies the cases above as register argument except simd from vector<t> and sets structDesc.passedInRegisters to true, this always calls fgMakeOutgoingStructArgCopy() and generates copies.

@CarolEidt
Copy link
Contributor

dotnet/coreclr#18358 eliminated the unnecessary copy when passed on stack.
There are still cases where structs are copied unnecessarily when passed in registers.

@erozenfeld
Copy link
Member

For some reason it wasn't possible to update the description of this issue. I created a copy: dotnet/coreclr#19425.

@msftgits msftgits transferred this issue from dotnet/coreclr Jan 31, 2020
@msftgits msftgits added this to the Future milestone Jan 31, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI enhancement Product code improvement that does NOT require public API changes/additions optimization os-linux Linux OS (any supported distro) tenet-performance Performance related issue
Projects
None yet
Development

No branches or pull requests

4 participants