[Mlir-commits] [mlir] 0aceb61 - [mlir] make memref.cast implement ViewLikeOpInterface

Alex Zinenko llvmlistbot at llvm.org
Mon Mar 15 09:21:35 PDT 2021


Author: Alex Zinenko
Date: 2021-03-15T17:21:27+01:00
New Revision: 0aceb61665dadbd80b24852cbe55cf0414bd4324

URL: https://github.com/llvm/llvm-project/commit/0aceb61665dadbd80b24852cbe55cf0414bd4324
DIFF: https://github.com/llvm/llvm-project/commit/0aceb61665dadbd80b24852cbe55cf0414bd4324.diff

LOG: [mlir] make memref.cast implement ViewLikeOpInterface

This was seemingly dropped in e2310704d890ad252aeb1ca28b4b84d29514b1d1,
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.

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td b/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
index 804c850d3bd2..4e4e2ecc2505 100644
--- a/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
+++ b/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
@@ -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;


        


More information about the Mlir-commits mailing list