[Mlir-commits] [mlir] [mlir][memref] Add a `ViewOp::getMixedSizes` (PR #176561)

Jakub Kuderski llvmlistbot at llvm.org
Sat Jan 17 07:05:26 PST 2026


================
@@ -3762,6 +3762,22 @@ OpFoldResult ViewOp::fold(FoldAdaptor adaptor) {
   return {};
 }
 
+SmallVector<OpFoldResult> ViewOp::getMixedSizes() {
+  SmallVector<OpFoldResult> result;
+  unsigned ctr = 0;
+  Builder b(getContext());
+  MemRefType resultType = getType();
+  auto resultShape = resultType.getShape();
+  for (int64_t i = 0; i < resultType.getRank(); ++i) {
----------------
kuhar wrote:

do not recalculate end https://llvm.org/docs/CodingStandards.html#don-t-evaluate-end-every-time-through-a-loop
```suggestion
  for (int64_t i = 0,e = resultType.getRank(); i < e; ++i) {
```


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


More information about the Mlir-commits mailing list