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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed May 8 09:31:53 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;
+    }
----------------
MaheshRavishankar wrote:

The above needs to be a `return emitOpError`.  Also is it possible to just add a test for this? The original PR didnt fail on anything so the issue here was missed.

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


More information about the Mlir-commits mailing list