Skip to content

Comments

JIT: Treat unconditional store as the else case in if-conversion#124738

Draft
BoyBaykiller wants to merge 4 commits intodotnet:mainfrom
BoyBaykiller:if-conv-unconditional-store-to-else-124713
Draft

JIT: Treat unconditional store as the else case in if-conversion#124738
BoyBaykiller wants to merge 4 commits intodotnet:mainfrom
BoyBaykiller:if-conv-unconditional-store-to-else-124713

Conversation

@BoyBaykiller
Copy link

If-conversion phase now produces the same IR for these two cases:

void First(int tMinLeft, int tMinRight)
{
    bool leftCloser = false;
    if (tMinLeft < tMinRight)
    {
        leftCloser = true;
    }
}

void Second(int tMinLeft, int tMinRight)
{
    bool leftCloser;
    if (tMinLeft < tMinRight)
    {
        leftCloser = true;
    }
    else
    {
        leftCloser = false;
    }
}

The last unconditional store (leftCloser = false) is substituted into the SELECT which enables further optimization. Specifically it fixes #124713. Still need to investigate regressions.

@github-actions github-actions bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Feb 23, 2026
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Feb 23, 2026
@dotnet-policy-service
Copy link
Contributor

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

@BoyBaykiller
Copy link
Author

@dotnet-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JIT: Turn conditional move arround bool into setl to save registers

1 participant