[mlir][MemRef] Fix canonicalization of BufferCast(TensorLoad).
authorAdrian Kuegel <akuegel@google.com>
Thu, 5 Aug 2021 09:30:09 +0000 (11:30 +0200)
committerAdrian Kuegel <akuegel@google.com>
Fri, 6 Aug 2021 06:32:35 +0000 (08:32 +0200)
commitd6b4993736c2b2e52f1417c72e0f34bba5b5b40e
tree0e67b9317c704d60425e186e195fb6eb608a9659
parent4fee756c75af4bb6367508626ceb5ba12bd04eb8
[mlir][MemRef] Fix canonicalization of BufferCast(TensorLoad).

CastOp::areCastCompatible does not check whether casts are definitely compatible.
When going from dynamic to static offset or stride, the canonicalization cannot
know whether it is really cast compatible. In that case, it can only canonicalize
to an alloc plus copy.

Differential Revision: https://reviews.llvm.org/D107545
mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
mlir/test/Dialect/MemRef/canonicalize.mlir