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
CSE seems to fail when writing x / cns and x % cns for unsigned integers #119131
area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIhelp wanted[up-for-grabs] Good issue for external contributorstenet-performancePerformance related issue
The general logic here is likely worth tuning a bit since the AMD/Intel optimization manuals also recommend such transforms when one of the inputs is a known constant and it allows the same general CSE opportunities.
Inversely we may want to recognize tmp = a / b followed by a - (tmp * b) for a non-constant b and transform the latter back into GT_MOD for some cases to ensure #117215 is handled and optimal.
If we handle this by doing what #32615 suggests and always doing the transform, we may want to also recognize tmp = a / b followed by a - (tmp * b) for the general xarch optimization to only do a single DIV instead.
area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIhelp wanted[up-for-grabs] Good issue for external contributorstenet-performancePerformance related issue
Activity
dotnet-policy-service commentedon Aug 27, 2025
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.
tannergooding commentedon Aug 27, 2025
Related to #32615, not necessarily a dupe though since this is specifically around a constant divisor.
On xarch we end up preserving the
UMODnode until rationalization, unlike withMODwhere it's often replaced in morph: https://github.com/dotnet/runtime/blob/main/src/coreclr/jit/morph.cpp#L7405-L7417This is unlike for arm64 where we always do it.
The general logic here is likely worth tuning a bit since the AMD/Intel optimization manuals also recommend such transforms when one of the inputs is a known constant and it allows the same general CSE opportunities.
Inversely we may want to recognize
tmp = a / bfollowed bya - (tmp * b)for a non-constantband transform the latter back intoGT_MODfor some cases to ensure #117215 is handled and optimal.If we handle this by doing what #32615 suggests and always doing the transform, we may want to also recognize
tmp = a / bfollowed bya - (tmp * b)for the general xarch optimization to only do a singleDIVinstead.