-
Notifications
You must be signed in to change notification settings - Fork 5.5k
JIT: inefficient multidimensional array access vis Jit32 (and in general) #8569
Copy link
Copy link
Closed
Labels
JitUntriagedCLR JIT issues needing additional triageCLR JIT issues needing additional triagearea-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 SuperPMIenhancementProduct code improvement that does NOT require public API changes/additionsProduct code improvement that does NOT require public API changes/additionsoptimizationtenet-performancePerformance related issuePerformance related issue
Milestone
Metadata
Metadata
Assignees
Labels
JitUntriagedCLR JIT issues needing additional triageCLR JIT issues needing additional triagearea-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 SuperPMIenhancementProduct code improvement that does NOT require public API changes/additionsProduct code improvement that does NOT require public API changes/additionsoptimizationtenet-performancePerformance related issuePerformance related issue
Type
Fields
Give feedbackNo fields configured for issues without a type.
RyuJit fails to optimize multidimensional array indices and misses some cases that Jit32 is able to optimize. In the following code example,
Jit32 is able to CSE the addressing done in the
a[b,i]references inExample(though it does not CSE the array fetch itself). RyuJit does not CSE anything in the loop.Neither jit recognizes
a.GetLengthas being a loop invariant, or that the initial bounds checkr[b, ]is likewise a loop invariant, or inline and decomposeGetLengthdespite inlining the very similar bounds check and element addressing logic. Neither jit is able to optimize away the bounds checks inMainwhere the array size and indices are known.category:cq
theme:md-arrays
skill-level:expert
cost:large