JIT doesn't elide bounds checking when iterating over a span and an array of known length #110986
Labels
area-CodeGen-coreclr
CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
tenet-performance
Performance related issue
Milestone
Description
If you ensure that the length of an array and a span are the same, the JIT will still emit bounds checking on only the span when indexing.
This does not occur when iterating over a span and a span, or an array and an array.
Sharplab example here
Regression?
I have only used Sharplab to test this, but it doesn't seem likely to be a regression.
Analysis
I don't know why, but curiously enough when checking the span length when iterating over a span + array, there is no bound check
The text was updated successfully, but these errors were encountered: