Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Emit simpler array bounds checks when using Polly
This helps to enable Polly's bounds check elimination logic for multi-dimensional array accesses which would hoist those checks out of loops (or remove them entirely) if possible. For example, the bounds checks that are currently emitted for an access `A[i,j,k]` to an array `A::Array{Float32,m,n,o}` would correspond to the following pseudo-code: ``` if (i >= m) out_of_bounds_error(); elseif (j >= n) out_of_bounds_error(); elseif (((k * n + j) * m + i) < m * n * o) out_of_bounds_error(); ``` The expression `((k * n + j) * m + i)` is non-affine, therefore Polly would not be able to analyze it. Instead, we now emit simpler bounds checks for those code parts that Polly will be applied to: ``` if (i >= m) out_of_bounds_error(); elseif (j >= n) out_of_bounds_error(); elseif (k >= o) out_of_bounds_error(); ```
- Loading branch information