dotnet/runtime
Auf GitHub ansehenCSE seems to fail when writing `x / cns` and `x % cns` for unsigned integers
Open
#119.131 geöffnet am 27. Aug. 2025
area-CodeGen-coreclrhelp wantedtenet-performance
Repository-Metriken
- Stars
- (17.886 Stars)
- PR-Merge-Metriken
- (Durchschn. Merge 12T 11h) (661 gemergte PRs in 30 T)
Beschreibung
Description
CSE seems to fail if I write something like:
uint Natural(uint index)
{
uint arrIndex = index / 3;
uint bitIndex = index % 3;
return arrIndex + bitIndex;
}
(it does the division twice).
This seems to only be an issue for unsigned integers not using DivRem.
Configuration
Seems to reproduce on any .NET version on godbolt - I've only checked the issue on x64.
Regression?
Probably not.
Analysis
@tannergooding was saying it seems that UMOD might be missing early expansion altogether & it's getting carried down to rationalisation.