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

Kareem Ergawy via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Feb 4 21:04:42 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;
----------------
ergawy wrote:

I think this can be moved inside the context struct manager and call `createGEPsToPrivateVars` from the constructor. Just to make things a bit more self-contained whenever possible.

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


More information about the llvm-branch-commits mailing list