Skip to content

JIT should be able to elide zeroing of fields after allocations #96942

@jakobbotsch

Description

@jakobbotsch
using System;

class Program
{
    static void Main()
    {
        Program p = new();
        p.Test = false;
    }

    public bool Test;
}

Codegen:

       call     CORINFO_HELP_NEWSFAST
       mov      byte  ptr [rax+0x08], 0

Expected:

       call     CORINFO_HELP_NEWSFAST

I looked at representing this in VN once, but it seemed hard with how we represent memory in VN.

Metadata

Metadata

Assignees

Labels

area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions