[Mlir-commits] [mlir] Validate type consistency in reintepret cast sizes (PR #140032)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed May 21 00:58:24 PDT 2025


================
@@ -1835,6 +1835,15 @@ LogicalResult ReinterpretCastOp::verify() {
   // Match sizes in result memref type and in static_sizes attribute.
   for (auto [idx, resultSize, expectedSize] :
        llvm::enumerate(resultType.getShape(), getStaticSizes())) {
+    // Check that dynamic sizes are not mixed with static sizes
+    if (ShapedType::isDynamic(resultSize) &&
+        !ShapedType::isDynamic(expectedSize))
+      return emitError(
+          "expectedSize is static but received a dynamic resultSize ");
----------------
yaniv217 wrote:

I agree that it sounds more understandable but it seems that in the context of these functions they consistently use expected size and not specified size to name.

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


More information about the Mlir-commits mailing list