[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 12:28:08 PDT 2025


================
@@ -408,6 +425,145 @@ void llvm::computeAccessFunctions(ScalarEvolution &SE, const SCEV *Expr,
   });
 }
 
+/// Backward compatibility wrapper for the old 4-parameter version.
+void llvm::computeAccessFunctions(ScalarEvolution &SE, const SCEV *Expr,
+                                  SmallVectorImpl<const SCEV *> &Subscripts,
+                                  SmallVectorImpl<const SCEV *> &Sizes) {
+  // Use the element size from the last element in Sizes array (legacy behavior)
+  if (Sizes.empty()) {
+    Subscripts.clear();
+    return;
+  }
+  const SCEV *ElementSize = Sizes.back();
+  computeAccessFunctions(SE, Expr, Subscripts, Sizes, ElementSize);
----------------
kasuga-fj wrote:

```suggestion
  if (Sizes.empty()) {
    Subscripts.clear();
    return;
  }
  // Use the element size from the last element in Sizes array (legacy behavior)
  const SCEV *ElementSize = Sizes.back();
  computeAccessFunctions(SE, Expr, Subscripts, Sizes, ElementSize);
```

Consider adjusting the comment position.

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


More information about the llvm-commits mailing list