[Mlir-commits] [mlir] [mlir][fold-memref-alias-ops] Add support for folding memref.expand_shape involving dynamic dims (PR #89093)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon May 6 21:21:23 PDT 2024


================
@@ -155,5 +156,31 @@ void eraseDeadAllocAndStores(RewriterBase &rewriter, Operation *parentOp) {
     rewriter.eraseOp(op);
 }
 
+static SmallVector<OpFoldResult>
+computeSuffixProductIRBlockImpl(Location loc, OpBuilder &builder,
+                                ArrayRef<OpFoldResult> sizes,
+                                OpFoldResult unit) {
+  if (sizes.empty())
+    return {};
+  SmallVector<OpFoldResult> strides(sizes.size(), unit);
+  AffineExpr s0, s1;
+  bindSymbols(builder.getContext(), s0, s1);
+
+  for (int64_t r = strides.size() - 2; r >= 0; --r) {
----------------
MaheshRavishankar wrote:

Nit: I find it easier to read in this form
```
for (int64_t r = strides.size() - 1 ; r > 0; --r) {

}
```

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


More information about the Mlir-commits mailing list