Skip to content

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

Closed
@sejongoh

Description

@sejongoh

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIenhancementProduct code improvement that does NOT require public API changes/additionsoptimizationos-linuxLinux OS (any supported distro)tenet-performancePerformance related issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions