[Mlir-commits] [mlir] [mlir][bufferization] Clone simplify fails when input and result type not cast compatiable (PR #71310)

Matthias Springer llvmlistbot at llvm.org
Thu Jan 11 07:17:55 PST 2024


================
@@ -457,6 +457,10 @@ struct SimplifyClones : public OpRewritePattern<CloneOp> {
     }
 
     Value source = cloneOp.getInput();
+    if (!memref::CastOp::areCastCompatible({source.getType()},
----------------
matthias-springer wrote:

Unranked -> unranked is not "cast compatible":
```c++
    // Unranked to unranked casting is unsupported
    if (uaT && ubT)
      return false;
```

I think if you write this as:
```
if (source.getType() != cloneOp.getType() && !memref::CastOp::areCastCompatible({source.getType()}, {cloneOp.getType()}))
  return failure();
```
Then the `dealloc_canonicalize_clone_removal` test case does not have to be modified.


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


More information about the Mlir-commits mailing list