[Mlir-commits] [mlir] [mlir][memref.expand_shape] Add verifier check to ensure correct output_shape is provided by user (PR #91245)
Benoit Jacob
llvmlistbot at llvm.org
Wed May 8 09:34:42 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 (auto [pos, shape] : llvm::enumerate(resShape))
+ if (!ShapedType::isDynamic(shape) &&
+ shape != staticOutputShapes[staticShapeNum++])
+ emitOpError("invalid output shape provided at pos ") << pos;
+
----------------
bjacob wrote:
yes it does.
https://github.com/llvm/llvm-project/pull/91245
More information about the Mlir-commits
mailing list