[Mlir-commits] [mlir] Fix `memref.expand_shape` verifier (PR #91501)

Benoit Jacob llvmlistbot at llvm.org
Wed May 8 09:58:35 PDT 2024


================
@@ -2356,12 +2356,11 @@ LogicalResult ExpandShapeOp::verify() {
   // Verify if provided output shapes are in agreement with output type.
   DenseI64ArrayAttr staticOutputShapes = getStaticOutputShapeAttr();
   ArrayRef<int64_t> resShape = getResult().getType().getShape();
-  unsigned staticShapeNum = 0;
-
-  for (auto [pos, shape] : llvm::enumerate(resShape))
-    if (!ShapedType::isDynamic(shape) &&
-        shape != staticOutputShapes[staticShapeNum++])
+  for (auto [pos, shape] : llvm::enumerate(resShape)) {
+    if (!ShapedType::isDynamic(shape) && shape != staticOutputShapes[pos]) {
       emitOpError("invalid output shape provided at pos ") << pos;
+    }
----------------
bjacob wrote:

Yup, reproduces.

And (I don't know how I didn't notice earlier), but testing this also revealed an existing test case that was incorrect. fixed.

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


More information about the Mlir-commits mailing list