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

Benoit Jacob llvmlistbot at llvm.org
Wed May 8 09:33:43 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:

Added the missing `return`. See PR description note about the custom asm format impeding testability.

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


More information about the Mlir-commits mailing list