[PATCH] D108885: [Delinerization] Keep array element byte offset.

Bardia Mahjour via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 9 15:27:47 PDT 2021


bmahjour added a comment.

In D108885#2992237 <https://reviews.llvm.org/D108885#2992237>, @Meinersbur wrote:

>> I also have concerns about the current implementation not being able to handle arrays of structures.
>
> D109527 <https://reviews.llvm.org/D109527>

Thanks for that. Looks like using the "true element size" can significantly simplify the remainder expression for the added byte dimension. We may be converging on a solution here.

>> maybe we can heuristically pick something that does divide it evenly (eg a GCD or just choosing 1). If we choose 1, DA is able to produce expected result (with -da-disable-delinearization-checks)
>
> A dimension of size 1 can be omitted since its only valid with a subscript of 0 and multiplies by 1. What makes delinearization useful is that allowing to assume that memory accesses only alias if all subscripts are equal (and the arrays themselves dot overlap)[*]. For this to work the subscripts must be between 0 and the dimension size. `-da-disable-delinearization-checks`  skips this check and therefore may cause miscompilation.

Rather than viewing it as an extra dimension I simply view it as the size of the structure member. From the point of view of dependence analysis (after aliasing properties are computed) the dependence between `A[i][j][k].b` and `A[i-1][j][k].b` should yield the same results regardless of the size of `b` (be it 1-byte or otherwise). I used the `-da-disable-delinearization-checks` to illustrate the idea, but it's possible that using this scheme requires different validity checks.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108885/new/

https://reviews.llvm.org/D108885



More information about the llvm-commits mailing list