Skip to content

JIT: Fix invalid IR and weights in if-conversion#125072

Open
BoyBaykiller wants to merge 2 commits intodotnet:mainfrom
BoyBaykiller:fix-invalid-ir-if-conv-124942
Open

JIT: Fix invalid IR and weights in if-conversion#125072
BoyBaykiller wants to merge 2 commits intodotnet:mainfrom
BoyBaykiller:fix-invalid-ir-if-conv-124942

Conversation

@BoyBaykiller
Copy link

Fix #124942.

Small diffs are expected because:

  1. It allows if-conversion to recognize more cases.
    For example https://godbolt.org/z/Pdj898qTT currently still produces one jmp. But with this change it's eliminated, as the search now knows when there actually is a return block (previously it wasn't marked as such).

  2. The block weights changed. For example previously

static int InvalidIR(bool cond)
{
    if (cond)
    {
        return 2;
    }
    // or else {}
    return 4;
}

produced blocks with bbWeight = 0.5, now it's 1.0.

@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Mar 2, 2026
@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 Mar 2, 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 BoyBaykiller marked this pull request as draft March 2, 2026 21:06
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: If-conversion phase can produce questionable IR. Return block having a successor

1 participant