-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Range check elimination for multi-dimensional array #35056
Labels
area-CodeGen-coreclr
CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
optimization
Milestone
Comments
Dotnet-GitSync-Bot
added
area-CodeGen-coreclr
CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
untriaged
New issue has not been triaged by the area owner
labels
Apr 16, 2020
BruceForstall
added
optimization
and removed
untriaged
New issue has not been triaged by the area owner
labels
Apr 20, 2020
Example of simple case where array/index are not part of argument. static int InnerProduct()
{
int[,] b = new int[,] { { 1, 2 }, { 3, 4 }, { 5, 6 }, { 7, 8 } };
int result = 0;
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < 2; j++)
{
result = result + b[i,j];
}
}
return result;
} Generates G_M64019_IG03:
52800003 mov w3, #0
;; bbWeight=4 PerfScore 2.00
G_M64019_IG04:
B9401804 ldr w4, [x0,#24]
4B040045 sub w5, w2, w4
B9401004 ldr w4, [x0,#16]
6B0400BF cmp w5, w4
540002A2 bhs G_M64019_IG08
2A0503E4 mov w4, w5
B9401C05 ldr w5, [x0,#28]
4B050066 sub w6, w3, w5
B9401405 ldr w5, [x0,#20]
6B0500DF cmp w6, w5
540001E2 bhs G_M64019_IG08
B9401405 ldr w5, [x0,#20]
9B0418A4 madd x4, x5, x4, x6
8B040805 add x5, x0, x4, LSL #2
B94020A4 ldr w4, [x5,#32]
0B010081 add w1, w4, w1
11000463 add w3, w3, #1
7100087F cmp w3, #2
54FFFDCB blt G_M64019_IG04
;; bbWeight=16 PerfScore 496.00
G_M64019_IG05:
11000442 add w2, w2, #1
7100085F cmp w2, #2
54FFFD4B blt G_M64019_IG03
;; bbWeight=4 PerfScore 8.00
...
;; bbWeight=1 PerfScore 2.00
G_M64019_IG08:
97FF6496 bl CORINFO_HELP_RNGCHKFAIL
D43E0000 bkpt |
This need to happen in .NET 6.0 |
JulieLeeMSFT
added
the
needs-further-triage
Issue has been initially triaged, but needs deeper consideration or reconsideration
label
Mar 23, 2021
I don't think we will have bandwidth to do this in .NET 6.0. Marking this for future. |
JulieLeeMSFT
removed
the
needs-further-triage
Issue has been initially triaged, but needs deeper consideration or reconsideration
label
Jun 7, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area-CodeGen-coreclr
CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
optimization
For Jagged array, it is not possible to hoist the column length check out of the loop, however it should be possible for 2D array or if we are doing loop cloning we should be able to generate a faster version of loop that doesn't have these checks.
category:cq
theme:range-check
skill-level:expert
cost:large
The text was updated successfully, but these errors were encountered: