[llvm] [DA] do not handle array accesses of different offsets (PR #123436)
Ryotaro Kasuga via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 15 01:26:40 PDT 2025
kasuga-fj wrote:
> > I don't fully understand this component yet, but not sure if "the offset is %N and %N % 4 == 0" and "the offset is 4 * %n where %N == 4 * %n are equivalent. For example, if we have the following IR
> > ```
> > %arrayidx0 = getelementptr inbounds i8, ptr %A, i64 %N
> > store i32 42, ptr %arrayidx0, align 1
> >
> > %arrayidx1 = getelementptr inbounds i32, ptr %A, i64 %M
> > store i32 42, ptr %arrayidx1, align 4
> > ```
> I added this as a testcase in https://github.com/llvm/llvm-project/commit/480ceff66fdf8491aeb695ddd08107d92b3f8d23.
I may have confused you, but I don't think this example directly causes any problems. What I'm concerned about is a case where a target loop has such a code fragment in its body. Looking at the testcases of Delinearization, the subscript for the second store can become `%m`, not `4 * %m`?
https://github.com/llvm/llvm-project/blob/0f526498a1b0819055d1094fd9850fdbcab5b903/llvm/test/Analysis/Delinearization/multidim_ivs_and_parameteric_offsets_3d.ll
If so, what happens if Delinearization succeeded only for the second store? I don't have any cases to check for such a situation, but I guess the subscripts would become like the following.
```
subscript 0
src = (%n + %A)
dst = (%m + %A)
```
In this case the analysis still works fine, because we don't know the relation between `%n` and `%m`, so they are handled conservatively. But what about the case where `%m` is a function of `%n`, like `%n + 1`?
https://github.com/llvm/llvm-project/pull/123436
More information about the llvm-commits
mailing list