-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Labels
area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Milestone
Description
Given:
public struct T
{
private double x;
private byte y; // unused
private int z; // unused
public static double M(double v)
{
T t = new T { x = v };
return t.x;
}
}codegen of M looks like:
T:M(double):double:
ret after removing unused fields (y and z), it turns into:
T:M(double):double:
push rax
movsd qword ptr [rsp], xmm0
add rsp, 8
retIOW, it needs at least one unused field (i.e. size of struct > 8) for this optimization to kick in.
Metadata
Metadata
Assignees
Labels
area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI