[llvm] [DA] do not handle GEPs with different types (PR #144088)

Ryotaro Kasuga via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 2 09:54:47 PDT 2025


================
@@ -149,8 +145,7 @@ define void @multidim_accesses(ptr %A) {
 ; CHECK-NEXT:  Src: store i32 1, ptr %idx0, align 4 --> Dst: store i32 1, ptr %idx0, align 4
 ; CHECK-NEXT:    da analyze - none!
 ; CHECK-NEXT:  Src: store i32 1, ptr %idx0, align 4 --> Dst: store i32 1, ptr %idx1, align 4
-; FIXME: the dependence distance is not constant. Distance vector should be [* * *|<]!
-; CHECK-NEXT:    da analyze - consistent output [0 0 0|<]!
+; CHECK-NEXT:    da analyze - confused!
----------------
kasuga-fj wrote:

My understanding is as follows (some of the notations may not be entirely accurate):

The two addresses (`idx0` and `idx1`) are calculated as below:

- `idx0 = %A + 262114 * i0 + 1024 * j0 + 4 * k0`
- `idx1 = %A + 262114 * i1 + 1024 * j1 + 4 * (k1 + 1)`

The memory address range affected by the first store is from `idx0` to `idx0 + 7`, and the second store affects the range from `idx1` to `idx1 + 7`. DA calculates the conditions between `[i0, j0, k0]` and `[i1, j1, k1]` under which these two ranges overlap. In this case, they overlap when either of the following conditions[^cond] holds:

- `[i0, j0, k0] = [i1, j1, k1]` 
- `[i0, j0, k0] = [i1, j1, k1 + 1]`
- `i0 = i1` and `j0 = j1 + 1` and `k0 = 0` and `k1 = 255`

Therefore, at least, `k` has `*` dependence, and `j` has a `>` dependence.

[^cond]: This is a necessary condition, but not a sufficient condition.

https://github.com/llvm/llvm-project/pull/144088


More information about the llvm-commits mailing list