Skip to content

JIT: Missed flag re-use over fall-through blocks #128535

Open

Description

@BoyBaykiller

https://godbolt.org/z/TMz45r84d

static bool MissedReuseCmp(int ch, int op2)
{
    if (ch <= op2)
    {
        if (ch != op2)
        {
            Console.WriteLine("Hi!");
            return false;
        }
        return true;
    }
    return false;
}
Program:MissedReuseCmp(int,int):bool (FullOpts):
       push     rbp
       mov      rbp, rsp
       cmp      edi, esi
       jg       SHORT G_M12322_IG06
       cmp      edi, esi ; <- can be removed
       jne      SHORT G_M12322_IG05
       mov      eax, 1
       pop      rbp
       ret      
G_M12322_IG05:  ;; offset=0x0013
       mov      rdi, 0x765570A025E8      ; 'Hi!'
       call     [System.Console:WriteLine(System.String)]
G_M12322_IG06:  ;; offset=0x0023
       xor      eax, eax
       pop      rbp
       ret      

Activity

  1. added
    untriaged
    on May 24, 2026
  2. added
    area-CodeGen-coreclr
    on May 24, 2026
  3. dotnet-policy-service commented on May 24, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
    See info in area-owners.md if you want to be subscribed.

  4. removed
    untriaged
    on May 26, 2026
  5. added this to the 11.0.0 milestone on May 26, 2026
  6. modified the milestones: 11.0.0, Future on Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area-CodeGen-coreclr

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions