[Mlir-commits] [mlir] 1ea2896 - [mlir] Add ViewLikeOpInterface to std.memref_cast.
Alexander Belyaev
llvmlistbot at llvm.org
Wed Jul 8 05:33:03 PDT 2020
Author: Alexander Belyaev
Date: 2020-07-08T14:32:23+02:00
New Revision: 1ea289681acf622ceda783c8fda2f16754b7c933
URL: https://github.com/llvm/llvm-project/commit/1ea289681acf622ceda783c8fda2f16754b7c933
DIFF: https://github.com/llvm/llvm-project/commit/1ea289681acf622ceda783c8fda2f16754b7c933.diff
LOG: [mlir] Add ViewLikeOpInterface to std.memref_cast.
Summery: It's needed for correct work of BufferPlacement.
Differential Revision: https://reviews.llvm.org/D83385
Added:
Modified:
mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
mlir/lib/Dialect/StandardOps/IR/Ops.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td b/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
index 2019db4a956f..677e2940f9a4 100644
--- a/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
+++ b/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
@@ -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:
diff --git a/mlir/lib/Dialect/StandardOps/IR/Ops.cpp b/mlir/lib/Dialect/StandardOps/IR/Ops.cpp
index f792e5d93e4e..7c28608d98b9 100644
--- a/mlir/lib/Dialect/StandardOps/IR/Ops.cpp
+++ b/mlir/lib/Dialect/StandardOps/IR/Ops.cpp
@@ -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>();
More information about the Mlir-commits
mailing list