[Mlir-commits] [mlir] [mlir][OpenMP] Extend `omp.private` with a `dealloc` region (PR #90456)

Kiran Chandramohan llvmlistbot at llvm.org
Mon Apr 29 04:36:13 PDT 2024


================
@@ -187,10 +188,23 @@ def PrivateClauseOp : OpenMP_Op<"private", [IsolatedFromAbove]> {
     }
     ```
 
+    * `private(x)` for "allocatables" would be emitted as:
+    ```mlir
+    omp.private {type = private} @x.privatizer : !some.type alloc {
+    ^bb0(%arg0: !some.type):
+    %0 = ... allocate proper memory for the private clone ...
+    omp.yield(%0 : !fir.ref<i32>)
+    } deaclloc {
+    ^bb0(%arg0: !some.type):
+    ... deallocate allocated memory ...
+    omp.yield
+    }
+    ```
+
     There are no restrictions on the body except for:
-    - The `alloc` region has a single argument.
+    - The `alloc` & `dealloc` regions have a single argument.
     - The `copy` region has 2 arguments.
-    - Both regions are terminated by `omp.yield` ops.
+    - All 3 regions are terminated by `omp.yield` ops.
----------------
kiranchandramohan wrote:

```suggestion
    - All three regions are terminated by `omp.yield` ops.
```

https://github.com/llvm/llvm-project/pull/90456


More information about the Mlir-commits mailing list