[llvm] [polly] [delinearize] Extract array dimensions from alloca and global declarations (PR #156342)

Ryotaro Kasuga via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 10 09:15:06 PDT 2025


================
@@ -523,7 +525,7 @@ for.body:                                         ; preds = %entry, %for.body
   %conv = trunc i64 %i.02 to i32
   %sub = sub nsw i64 18, %i.02
   %mul = mul nsw i64 %i.02, 3
-  %sub1 = add nsw i64 %mul, -18
+  %sub1 = add nsw i64 %mul, 18
----------------
kasuga-fj wrote:

I think the original test can be interpreted as follows.

```c
void couple11(int A[][100], int B[]) {
  for (long int i = 0; i <= 15; i++) {
    A[3*i - 18][18 - i] = i;
    B[i] = A[i][i];
  }
}
```

IIUC, the following C code is not broken.

```c
int Mem[100][100] = {};
int (*A)[100] = Mem + 50;
int B[16];
couple11(A, B);
```

In addition, this is LLVM, not C/C++/Fortran.

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


More information about the llvm-commits mailing list