[Mlir-commits] [mlir] [mlir] [memref] add more checks to the memref.reinterpret_cast (PR #112669)
donald chen
llvmlistbot at llvm.org
Fri Oct 25 09:44:48 PDT 2024
================
@@ -1892,11 +1892,12 @@ LogicalResult ReinterpretCastOp::verify() {
// Match sizes in result memref type and in static_sizes attribute.
for (auto [idx, resultSize, expectedSize] :
llvm::enumerate(resultType.getShape(), getStaticSizes())) {
- if (!ShapedType::isDynamic(resultSize) &&
- !ShapedType::isDynamic(expectedSize) && resultSize != expectedSize)
+ if (!ShapedType::isDynamic(resultSize) && resultSize != expectedSize)
return emitError("expected result type with size = ")
- << expectedSize << " instead of " << resultSize
- << " in dim = " << idx;
+ << (ShapedType::isDynamic(expectedSize)
----------------
cxy-1993 wrote:
Thank you for your review. However, I believe these checks are necessary. As the PR description mentions, mismatches between return value data types and operands may lead to other transforms incorrectly obtaining values of the wrong data type, resulting in erroneous outcomes. This submission is specifically designed to address this issue.
https://github.com/llvm/llvm-project/pull/112669
More information about the Mlir-commits
mailing list