-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
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 SuperPMIenhancementProduct code improvement that does NOT require public API changes/additionsProduct code improvement that does NOT require public API changes/additionsoptimization
Milestone
Description
Ideally the following two methods should generate similar code.
[MethodImpl(MethodImplOptions.NoInlining)]
static Span<int> TrimFirstLast_OpenCoded(Span<int> s) => s.Slice(1, s.Length - 1);
[MethodImpl(MethodImplOptions.NoInlining)]
static Span<int> TrimFirstLast_Range(Span<int> s) => s[Range.Create(1, new Index(1, true))];Currently the Range-based version runs into a number of issues:
Ranges are not promotable (fixed via JIT: allow slightly more general promotion of structs with struct fields coreclr#22867)- Key methods are not inlining (too large/complex) (fixed in Index and Range updates coreclr#22331)
- IL shape in
Indexconstructor is blocking enregistration of fields (similar byref on IL stack across branch exposure issue as we saw in Improve perf for Index based span indexers coreclr#21196) (fixed in Index and Range updates coreclr#22331) - ABI modelling in jit is blocking
Rangeenregistration (8 byte structs are returned by-value, so jit “retypes” the two adjacent ints in a Range as a long). - (possibly more, once above is addressed)
cc @stephentoub
Will fill in more details later.
Marking as 3.0 for now.
category:cq
theme:optimization
skill-level:expert
cost:large
NN---, PaulusParssinen and pentp
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 SuperPMIenhancementProduct code improvement that does NOT require public API changes/additionsProduct code improvement that does NOT require public API changes/additionsoptimization