Skip to content

Keep structs in registers #43867

Closed
Closed
@CarolEidt

Description

@CarolEidt

Epic for improving the ability of the JIT to keep structs in registers.

Overview

The JIT currently supports keeping structs in registers when the individual fields are promoted to local variables (also known as scalar replacement). However, there are a number of cases where it forces them to the stack. Some of these cases are more fundamental, e.g. when they are address exposed. Others, however, are due to JIT limitations in handling argument passing and returns.

The Jit does not support keeping small structs in registers when the fields are not promoted and not accessed, for example, when the struct is only used as an argument or block.

.NET 6 scope:

Work items for multi-reg

Work items for single-reg

Stretch goals for 6.0:

Stretch goal for multi-reg:

Stretch goal for single-reg:

  • Add support for LclFld with struct type;
  • LclVar struct as first-class nodes, meaning don't create OBJ(ADDR(LCL_VAR)) when pass as args etc.

.NET 6 Result:

We have a set of repro-tests that show incorrect/inefficient code generation in 5.0 that is expected to be fixed. It is covered by issues in the previous section.

The perf results are shown in the bottom messages.

category:planning
theme:planning
skill-level:expert
cost:large
impact:medium

Metadata

Metadata

Assignees

Labels

Bottom Up WorkNot part of a theme, epic, or user storyUser StoryA single user-facing feature. Can be grouped under an epic.area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMItenet-performancePerformance related issue

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions