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

Matthias Springer llvmlistbot at llvm.org
Thu May 15 15:38:07 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 ");
----------------
matthias-springer wrote:

nit: It's a bit difficult to understand what "expectedSize" means in the error message. Maybe: `specified size is static, but result type dimension is dynamic`

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


More information about the Mlir-commits mailing list