julia
f501e458 - abstractarray: Combine the per-dimension checks in `checkbounds_indices` with `&` (#64567)

Commit
25 days ago
abstractarray: Combine the per-dimension checks in `checkbounds_indices` with `&` (#64567) JuliaLang#61535 changed `checkbounds_indices` from `&` to `&&` along with its codegen changes. With `&&`, the size of each later dimension is only loaded after the check of the previous one passes, so when the bounds check stays inside a loop (e.g. a wrapper array that forwards `getindex`/`setindex!` without `@propagate_inbounds`), the size load is not executed on every iteration, LICM does not hoist it, the check is not unswitched, and the loop does not vectorize. Broadcasting over such a wrapper (the `array/custom_array` runtime benchmark) went from 172k instructions on 1.13.2 to 991k on master; with `&` it is 154k. The `&&` is not what gave JuliaLang#61535 its improvements: its multidimensional indexing and Laplacian benchmarks perform the same with `&` and `&&`, so those come from the codegen changes, which are kept.
Author
Parents
Loading