[flang-commits] [flang] [mlir] [mlir][OpenMP] rewrite conversion of privatisation for omp.parallel (PR #111844)

Kiran Chandramohan via flang-commits flang-commits at lists.llvm.org
Fri Oct 11 04:58:13 PDT 2024


================
@@ -1421,12 +1449,56 @@ convertOmpParallel(omp::ParallelOp opInst, llvm::IRBuilderBase &builder,
             deferredStores, isByRef)))
       bodyGenStatus = failure();
 
+    // Apply copy region for firstprivate.
+    if (!privateBlockArgs.empty()) {
+      // Find the end of the allocation blocks
+      assert(afterAllocas->getSinglePredecessor());
+      builder.SetInsertPoint(
+          afterAllocas->getSinglePredecessor()->getTerminator());
+      llvm::BasicBlock *copyBlock = splitBB(builder, true, "omp.private.copy");
----------------
kiranchandramohan wrote:

```suggestion
      llvm::BasicBlock *copyBlock = splitBB(builder, /*CreateBranch=*/ true, "omp.private.copy");
```

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


More information about the flang-commits mailing list