Skip to content

Commit 1ea2896

Browse files
committed
[mlir] Add ViewLikeOpInterface to std.memref_cast.
Summery: It's needed for correct work of BufferPlacement. Differential Revision: https://reviews.llvm.org/D83385
1 parent 2ebf4b6 commit 1ea2896

File tree

2 files changed

+5
-1
lines changed
  • mlir
    • include/mlir/Dialect/StandardOps/IR
    • lib/Dialect/StandardOps/IR

2 files changed

+5
-1
lines changed

mlir/include/mlir/Dialect/StandardOps/IR/Ops.td

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1772,7 +1772,9 @@ def Log2Op : FloatUnaryOp<"log2"> {
17721772
// MemRefCastOp
17731773
//===----------------------------------------------------------------------===//
17741774

1775-
def MemRefCastOp : CastOp<"memref_cast"> {
1775+
def MemRefCastOp : CastOp<"memref_cast", [
1776+
DeclareOpInterfaceMethods<ViewLikeOpInterface>
1777+
]> {
17761778
let summary = "memref cast operation";
17771779
let description = [{
17781780
Syntax:

mlir/lib/Dialect/StandardOps/IR/Ops.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1822,6 +1822,8 @@ OpFoldResult LoadOp::fold(ArrayRef<Attribute> cstOperands) {
18221822
// MemRefCastOp
18231823
//===----------------------------------------------------------------------===//
18241824

1825+
Value MemRefCastOp::getViewSource() { return source(); }
1826+
18251827
bool MemRefCastOp::areCastCompatible(Type a, Type b) {
18261828
auto aT = a.dyn_cast<MemRefType>();
18271829
auto bT = b.dyn_cast<MemRefType>();

0 commit comments

Comments
 (0)