Skip to content

Redundant test after PopCount #118811

@xtqqczze

Description

@xtqqczze
static void M1(int value)
{
    if (int.PopCount(value) > 0) 
        throw null!;
}

Expected codegen:

       popcnt   edi, edi
       jne      SHORT G_M28251_IG04

Actual codegen

       popcnt   edi, edi
       test     edi, edi
       jg       SHORT G_M9581_IG04

https://csharp.godbolt.org/z/c1ofPxe1E

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIhelp wanted[up-for-grabs] Good issue for external contributors

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions