[mlir] Add ViewLikeOpInterface to std.memref_cast.

Summery:  It's needed for correct work of BufferPlacement.

Differential Revision: https://reviews.llvm.org/D83385
This commit is contained in:
Alexander Belyaev 2020-07-08 13:44:36 +02:00
parent 2ebf4b6e4c
commit 1ea289681a
2 changed files with 5 additions and 1 deletions

View file

@ -1772,7 +1772,9 @@ def Log2Op : FloatUnaryOp<"log2"> {
// MemRefCastOp
//===----------------------------------------------------------------------===//
def MemRefCastOp : CastOp<"memref_cast"> {
def MemRefCastOp : CastOp<"memref_cast", [
DeclareOpInterfaceMethods<ViewLikeOpInterface>
]> {
let summary = "memref cast operation";
let description = [{
Syntax:

View file

@ -1822,6 +1822,8 @@ OpFoldResult LoadOp::fold(ArrayRef<Attribute> cstOperands) {
// MemRefCastOp
//===----------------------------------------------------------------------===//
Value MemRefCastOp::getViewSource() { return source(); }
bool MemRefCastOp::areCastCompatible(Type a, Type b) {
auto aT = a.dyn_cast<MemRefType>();
auto bT = b.dyn_cast<MemRefType>();