Created attachment 12342 [details] Reduced test case We can sucessfully delinearize this piece of code: A[][dim_size]; for (i = 0; i < n; i++)_ for (j = 0; j < n; j++) A[i][j] AddRec: {{%A,+,(4 * %dim_size)}<%loop.i>,+,4}<%loop.j> Base offset: %A ArrayDecl[UnknownSize][%dim_size] with elements of 4 bytes. ArrayRef[{0,+,1}<%loop.i>][{0,+,1}<%loop.j>] but fail for: A[][dim_size]; for (i = 0; i < n; i++)_ for (j = 0; j < n; j++) A[j][i] AddRec: {{%A,+,4}<%loop.i>,+,(4 * %dim_size)}<%loop.j> Base offset: %A ArrayDecl[UnknownSize][1] with elements of 4 bytes. ArrayRef[{0,+,1}<%loop.i>][{0,+,%dim_size}<%loop.j>]
I will fix this.
(In reply to comment #0) > but fail for: > > A[][dim_size]; > > for (i = 0; i < n; i++)_ > for (j = 0; j < n; j++) > A[j][i] > > AddRec: {{%A,+,4}<%loop.i>,+,(4 * %dim_size)}<%loop.j> > Base offset: %A > ArrayDecl[UnknownSize][1] with elements of 4 bytes. > ArrayRef[{0,+,1}<%loop.i>][{0,+,%dim_size}<%loop.j>] This is a correct delinearization, although it is not a very useful one: - the size of the inner dimension is 1: ArrayDecl[UnknownSize][1] - the stride of the inner dimension is parametric: [{0,+,%dim_size}<%loop.j>] I think we should be able to modify SCEV->delinearize to "prefer" a non parametric strides, and that would also solve the strange dimension size "1".
(In reply to comment #2) > (In reply to comment #0) > > but fail for: > > > > A[][dim_size]; > > > > for (i = 0; i < n; i++)_ > > for (j = 0; j < n; j++) > > A[j][i] > > > > AddRec: {{%A,+,4}<%loop.i>,+,(4 * %dim_size)}<%loop.j> > > Base offset: %A > > ArrayDecl[UnknownSize][1] with elements of 4 bytes. > > ArrayRef[{0,+,1}<%loop.i>][{0,+,%dim_size}<%loop.j>] > > This is a correct delinearization, although it is not a very useful one: > - the size of the inner dimension is 1: ArrayDecl[UnknownSize][1] > - the stride of the inner dimension is parametric: [{0,+,%dim_size}<%loop.j>] > > I think we should be able to modify SCEV->delinearize to "prefer" a non > parametric strides, and that would also solve the strange dimension size "1". Yes, non parametric strides should be preferred. With this stride, we can not really do a lot. Tobi
I just tested with 217336 and this works. The corresponding test case is part of Polly since 208233.