-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Open
Labels
area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMItenet-performancePerformance related issuePerformance related issue
Milestone
Description
Description
Elidable checked is not elided.
/cc @EgorBo who asked me to open an issue for it
Configuration
64-bit on sharplab.com
Regression?
Probably not.
Data
public class C {
public nuint M(uint a) {
return checked((nuint)a * 8);
}
}gives
C.M(UInt32)
L0000: sub rsp, 0x28
L0004: mov eax, edx
L0006: mov ecx, 8
L000b: mul rcx
L000e: jb short L0015
L0010: add rsp, 0x28
L0014: ret
L0015: call 0x0000027c46350090
L001a: int3Analysis
The checked can be elided on 64-bit, since a fits within 32 bits & a * 8 fits within 35 bits, which means no overflow can occur with 64-bits of storage.
Seemingly doesn't reproduce on 32-bit when nuint is replaced with ulong (but still does on 64-bit)? Sharplab link
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMItenet-performancePerformance related issuePerformance related issue