Skip to content

Suboptimal struct zeroing in case of gc pointers #83297

Closed
@EgorBo

Description

@EgorBo
public struct MyStruct
{
    public long a;
    public long b;
    public long c;
    public long d;
    public long e;
    public long f;
    public long g;
    public long h;
    public long i;
    public long j;
    public long k;
    public long l;
    public long m;
    public long n;
    public long o;
    public string s;
}

public MyStruct Foo()
{
    MyStruct s = default;
    return s;
}
; Method Program:Foo():Program+MyStruct:this
       33C0                 xor      eax, eax
       488902               mov      qword ptr [rdx], rax
       48894208             mov      qword ptr [rdx+08H], rax
       48894210             mov      qword ptr [rdx+10H], rax
       48894218             mov      qword ptr [rdx+18H], rax
       48894220             mov      qword ptr [rdx+20H], rax
       48894228             mov      qword ptr [rdx+28H], rax
       48894230             mov      qword ptr [rdx+30H], rax
       48894238             mov      qword ptr [rdx+38H], rax
       48894240             mov      qword ptr [rdx+40H], rax
       48894248             mov      qword ptr [rdx+48H], rax
       48894250             mov      qword ptr [rdx+50H], rax
       48894258             mov      qword ptr [rdx+58H], rax
       48894260             mov      qword ptr [rdx+60H], rax
       48894268             mov      qword ptr [rdx+68H], rax
       48894270             mov      qword ptr [rdx+70H], rax
       48894278             mov      qword ptr [rdx+78H], rax
       488BC2               mov      rax, rdx
       C3                   ret      
; Total bytes of code: 69

JIT gives up on SIMDs because of gc pointers in a struct while it could use SIMD only for unmanaged part

Metadata

Metadata

Assignees

Labels

area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIin-prThere is an active PR which will close this issue when it is merged

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions