[mlir] make memref.cast implement ViewLikeOpInterface

This was seemingly dropped in e2310704d8,
potentially due to a misrebase. The absence of this trait makes aliasing
analysis incorrect, leading to, e.g., buffer deallocation pass inserting
deallocations too early.
This commit is contained in:
Alex Zinenko 2021-03-15 17:19:37 +01:00
parent 4e67ae7b6b
commit 0aceb61665
1 changed files with 4 additions and 1 deletions

View File

@ -254,7 +254,8 @@ def MemRef_BufferCastOp : MemRef_Op<"buffer_cast",
def MemRef_CastOp : MemRef_Op<"cast", [
NoSideEffect, SameOperandsAndResultShape,
DeclareOpInterfaceMethods<CastOpInterface>
DeclareOpInterfaceMethods<CastOpInterface>,
ViewLikeOpInterface
]> {
let summary = "memref cast operation";
let description = [{
@ -325,6 +326,8 @@ def MemRef_CastOp : MemRef_Op<"cast", [
let extraClassDeclaration = [{
/// Fold the given CastOp into consumer op.
static bool canFoldIntoConsumerOp(CastOp castOp);
Value getViewSource() { return source(); }
}];
let hasFolder = 1;