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

Arnold Schwaighofer aschwaighofer at apple.com
Mon Oct 21 15:48:42 PDT 2013


Sebastian,

I am worried about this example:

+; RUN: opt < %s -analyze -delinearize | FileCheck %s
+;
+; 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;
+; }
+
+; AddRec: {{{(28 + (4 * (-4 + (3 * %m)) * %o) + %A),+,(8 * %m * %o)}<%for.i>,+,(12 * %o)}<%for.j>,+,20}<%for.k>
+; CHECK: Base offset: %A
+; CHECK: ArrayDecl[UnknownSize][%m][%o] with elements of 4 bytes.
+; CHECK: ArrayRef[{3,+,2}<%for.i>][{-4,+,3}<%for.j>][{7,+,5}<%for.k>]


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?

Thanks,
Arnold

On Oct 21, 2013, at 4:49 PM, Sebastian Pop <spop at codeaurora.org> wrote:

> <0001-delinearization-of-arrays.patch>





More information about the llvm-commits mailing list