[Mlir-commits] [mlir] [mlir][memref.expand_shape] Add verifier check to ensure correct output_shape is provided by user (PR #91245)
Quentin Colombet
llvmlistbot at llvm.org
Tue May 7 02:00:37 PDT 2024
================
@@ -2353,6 +2353,16 @@ LogicalResult ExpandShapeOp::verify() {
<< " dynamic dims while output_shape has " << getOutputShape().size()
<< " values";
+ // 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 (unsigned i = 0, e = resShape.size(); i < e; ++i)
----------------
qcolombet wrote:
You should be able to use a range loop (with `enumerate` if you want the `pos` in the error message)
https://github.com/llvm/llvm-project/pull/91245
More information about the Mlir-commits
mailing list