[llvm-branch-commits] [flang] [mlir] [mlir][OpenMP] Pack task private variables into a heap-allocated context struct (PR #125307)

Tom Eccles via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Feb 5 07:55:31 PST 2025


================
@@ -1796,36 +1918,110 @@ convertOmpTaskOp(omp::TaskOp taskOp, llvm::IRBuilderBase &builder,
   // Allocate and initialize private variables
   // TODO: package private variables up in a structure
   builder.SetInsertPoint(initBlock->getTerminator());
-  for (auto [privDecl, mlirPrivVar, blockArg] :
-       llvm::zip_equal(privateDecls, mlirPrivateVars, privateBlockArgs)) {
-    llvm::Type *llvmAllocType =
-        moduleTranslation.convertType(privDecl.getType());
 
-    // Allocations:
-    builder.SetInsertPoint(allocaIP.getBlock()->getTerminator());
-    llvm::Value *llvmPrivateVar = builder.CreateAlloca(
-        llvmAllocType, /*ArraySize=*/nullptr, "omp.private.alloc");
+  // Create task variable structure
+  llvm::SmallVector<llvm::Value *> privateVarAllocations;
----------------
tblah wrote:

I did this in [dd07fa7](https://github.com/llvm/llvm-project/pull/125307/commits/dd07fa7ae85c3837862b7771d2ad5ed449e87f16), but I'm unsure because it doesn't provide any additional encapsulation because write access is needed anyway for the charbox workaround after initializing the variables.

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


More information about the llvm-branch-commits mailing list