[llvm] [DA] do not handle array accesses of different offsets (PR #123436)
Sebastian Pop via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 14 17:08:57 PDT 2025
sebpop 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 480ceff.
>
> Under the assumption `%N % 4 == 0`, the former means like `A[N/4] = 42`, and the later is `A[M] = 42`. It seems that the current implementation doesn't perform such explicit division.
DA sees the following access functions:
```
subscript 0
src = (%n + %A)
dst = ((4 * %m)<nsw> + %A)
```
The compile time check for `4 * %m modulo 4 == 0` is trivial, only a runtime check for `%n modulo 4 == 0` is recorded.
https://github.com/llvm/llvm-project/pull/123436
More information about the llvm-commits
mailing list