[llvm] [Delinearization] Extract outer array dimensions using global object size (PR #175158)

Ryotaro Kasuga via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 22 06:32:04 PST 2026


================
@@ -18,9 +18,9 @@ define void @test_2d_array(i64 %i, i64 %j, i64 %N, i64 %M) {
 ; CHECK-NEXT:  Inst: %val = load i32, ptr %gepij, align 4
 ; CHECK-NEXT:  AccessFunction: {{\{\{}}0,+,80}<%for.i>,+,4}<%for.j>
 ; CHECK-NEXT:  Base offset: @test_array_10x20
-; CHECK-NEXT:  ArrayDecl[UnknownSize][20] with elements of 4 bytes.
+; CHECK-NEXT:  ArrayDecl[10][20] with elements of 4 bytes.
 ; CHECK-NEXT:  ArrayRef[{0,+,1}<nuw><%for.i>][{0,+,1}<nuw><nsw><%for.j>]
-; CHECK-NEXT:  Delinearization validation: Failed
+; CHECK-NEXT:  Delinearization validation: Succeeded
----------------
kasuga-fj wrote:

I don't think this is correct. For example, `(%N, %M) = (2, 21)` should be legal, and in this case the result must be discarded. (`&test_array_10x20[1][0] == &test_array_10x20[0][20]`, which may cause DA to produce incorrect results.)

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


More information about the llvm-commits mailing list