[llvm] [Delinearization] Extract array dimensions from global declarations (PR #175158)
Michael Kruse via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 9 07:56:05 PST 2026
Meinersbur wrote:
```ll
@test_array_10x20 = global [10 x [20 x i32]] zeroinitializer
```
There are 2 interpretations for this
1. This is an array of 10 arrays of 20 i32\'s
2. This is an sequence of 800 bytes (10\*20\*4)
The second interpretation would follow the trend of LLVM-IR going lower level, which could mean that eventually it might be replaced with an "allocate 800 bytes" instruction, in which case I fear we would eventually end up at the same problem we have with using the dimensional information from `getelementptr`. So what is the future direction?
However, information of delineratization could be interpreted as only a hint, not semantic, as e.g. Polly does. Runtime condition checks `0 <= j < 20` that for an access `test_array_10x20[i][j]`. If an execution would encounter a `j` outside this range, the non-optimized code is executed (i.e. loop versioning). For the optimized version it can assume that `i != i' && j != j'` implies `&test_array_10x20[i][j]` and `&test_array_10x20[i'][j']` do not alias. A hint could also be encoded a different way, which is what @sebpop is working on.
https://github.com/llvm/llvm-project/pull/175158
More information about the llvm-commits
mailing list