[Mlir-commits] [mlir] c83e696 - Add AutomaticAllocationScope to memref.alloca_scope

Alex Zinenko llvmlistbot at llvm.org
Mon Jun 14 07:09:14 PDT 2021


Author: Denys Shabalin
Date: 2021-06-14T16:09:06+02:00
New Revision: c83e696732fd906297d83a98dee044f1173be355

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

LOG: Add AutomaticAllocationScope to memref.alloca_scope

This change adds `AutomaticAllocationScope` to the
memref.alloca_scope op. Additionally, it also clarifies
that alloca_scope is is conceptually a passthrough operation.

Reviewed By: ftynse, bondhugula

Differential Revision: https://reviews.llvm.org/D104227

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 16d7ec059bc69..7bcc53d93845b 100644
--- a/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
+++ b/mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
@@ -204,7 +204,8 @@ def MemRef_AllocaOp : AllocLikeOp<"alloca", AutomaticAllocationScopeResource> {
 //===----------------------------------------------------------------------===//
 
 def MemRef_AllocaScopeOp : MemRef_Op<"alloca_scope", 
-      [DeclareOpInterfaceMethods<RegionBranchOpInterface>,
+      [AutomaticAllocationScope,
+       DeclareOpInterfaceMethods<RegionBranchOpInterface>,
        SingleBlockImplicitTerminator<"AllocaScopeReturnOp">,
        RecursiveSideEffects,
        NoRegionArguments]> {
@@ -223,7 +224,9 @@ def MemRef_AllocaScopeOp : MemRef_Op<"alloca_scope",
     ```
 
     Here, `%myalloca` memref is valid within the explicitly delimited scope
-    and is automatically deallocated at the end of the given region.
+    and is automatically deallocated at the end of the given region. Conceptually,
+    `memref.alloca_scope` is a passthrough operation with 
+    `AutomaticAllocationScope` that spans the body of the region within the operation. 
 
     `memref.alloca_scope` may also return results that are defined in the nested
     region. To return a value, one should use `memref.alloca_scope.return`


        


More information about the Mlir-commits mailing list