Skip to content

JIT: missing opportunities in constant folding around bitwise ops #95747

@EgorBo

Description

@EgorBo
int Test(int x, int y) => (x | 5) | (y | 3); // E.g. Enums

Current asm:

; Method Program:Test(int,int):int:this (FullOpts)
       or       edx, 5
       mov      eax, edx
       or       eax, r8d
       or       eax, 3
       ret      
; Total bytes of code: 12

Expected asm:

       mov      eax, edx
       or       eax, r8d
       or       eax, 7
       ret      
; Total bytes of code: 9

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 contributorsin-prThere is an active PR which will close this issue when it is merged

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions