[llvm-commits] [PATCH] Multidimensional Array Index Delinearization Analysis

Sebastian Pop spop at codeaurora.org
Mon Oct 21 19:16:11 PDT 2013


Arnold Schwaighofer wrote:
> +; void foo(long n, long m, long o, int A[n][m][o]) {
> +;   for (long i = 0; i < n; i++)
> +;     for (long j = 0; j < m; j++)
> +;       for (long k = 0; k < o; k++)
> +;         A[2*i+3][3*j-4][5*k+7] = 1;
> 
> A[][0][5*k+7] is going to ?overflow? the lowest dimension into the next row
> A[][1][...] at 'k == o/5-6' or so. I believe you can?t treat these indices as
> separate in this example for the purpose of dependence checks? Is the client
> assumed to conduct checks that guarantee that this is not going to happen?

Right.  It looks like the data dependence analysis needs more code to support
the contiguous memory semantics.

This test-case is a bit artificial and most likely undefined (it has out of
bounds accesses for all dimensions): I built this test to have more complex
access functions than A[i][j][k].  I can probably adjust the loop bounds or the
array dimensions to avoid undefined-ness.

Sebastian
-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation



More information about the llvm-commits mailing list