You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
JIT: missing opportunity for Redundant Branch Opt #98227
JIT-RBOarea-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIin-prThere is an active PR which will close this issue when it is merged
; Method Prog:Test(int):this (FullOpts)G_M36082_IG01:subrsp,40G_M36082_IG02:cmpedx,100jl SHORT G_M36082_IG04G_M36082_IG03:cmpedx,100jg SHORT G_M36082_IG04movecx,edxcall[System.Console:WriteLine(int)]G_M36082_IG04:nopG_M36082_IG05:addrsp,40ret; Total bytes of code: 28
Expected codegen:
; Method Prog:Test(int):this (FullOpts)G_M36082_IG01:subrsp,40G_M36082_IG02:cmpedx,100jne SHORT G_M36082_IG04G_M36082_IG03:movecx,100call[System.Console:WriteLine(int)]G_M36082_IG04:nopG_M36082_IG05:addrsp,40ret; Total bytes of code: 26
Reacted by neon-sunset and Julian
Activity
ghost added
untriagedNew issue has not been triaged by the area owner
This looks like something we could handle with a small-ish extension to #126587.
Given if (pA) if (pB) S;
In #126587 we simplified flow if we could prove pB ==> pA to if (true) if (pB) S;
We can also see if pB & pA simplifies to just one relop, and if so, a relop between the values already being used in pB, and if so, we can optimize to if (true) if (pA & pB) S;
JIT-RBOarea-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIin-prThere is an active PR which will close this issue when it is merged
Activity
[-]JIT: Missing oportunity for Redundant Branch Opt[/-][+]JIT: missing opportunity for Redundant Branch Opt[/+]EgorBo commentedon Feb 9, 2024
сс @AndyAyersMS I assume this is slightly different from "implied relops" opts we have.
In this case we can:
== 100(and then assertprop can propagate it as a constant)AndyAyersMS commentedon Feb 9, 2024
Looks similar to the case noted in #81220 (comment).
Linked this example into #48115.
AndyAyersMS commentedon Apr 17, 2026
This looks like something we could handle with a small-ish extension to #126587.
Given
if (pA) if (pB) S;In #126587 we simplified flow if we could prove
pB ==> pAtoif (true) if (pB) S;We can also see if
pB & pAsimplifies to just one relop, and if so, a relop between the values already being used inpB, and if so, we can optimize toif (true) if (pA & pB) S;JIT: relop simplification during redundant branch opts
JIT: relop simplification during redundant branch opts (dotnet#127181)
JIT: relop simplification during redundant branch opts (#127181)