-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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 SuperPMI
Milestone
Description
Only when the iteration variable is a native sized int does it do strength reduction.
// https://godbolt.org/z/hdTeGEeE1
int TestNint(int* data, int count)
{
int sum = 0;
for (nint i = 0; i < count; i++)
{
sum += data[i];
}
return sum;
}
int TestInt(int* data, int count)
{
int sum = 0;
for (int i = 0; i < count; i++)
{
sum += data[i];
}
return sum;
}G_M63938_IG04: ;; offset=0x000E
add eax, dword ptr [rsi]
add rsi, 4
dec rcx
jne SHORT G_M63938_IG04vs
G_M29388_IG03: ;; offset=0x000C
movsxd rdi, ecx
add eax, dword ptr [rsi+4*rdi]
inc ecx
cmp ecx, edx
jl SHORT G_M29388_IG03Metadata
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 SuperPMI