[clang] [OpenACC] Implement 'firstprivate' clause copy lowering (PR #154150)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 18 13:49:14 PDT 2025
================
@@ -392,12 +392,27 @@ class OpenACCClauseCIREmitter final
CIRGenFunction::AutoVarEmission tempDeclEmission,
mlir::acc::FirstprivateRecipeOp recipe, const VarDecl *varRecipe,
const VarDecl *temporary) {
- builder.createBlock(&recipe.getCopyRegion(), recipe.getCopyRegion().end(),
- {mainOp.getType(), mainOp.getType()}, {loc, loc});
+ mlir::Block *block = builder.createBlock(
+ &recipe.getCopyRegion(), recipe.getCopyRegion().end(),
+ {mainOp.getType(), mainOp.getType()}, {loc, loc});
builder.setInsertionPointToEnd(&recipe.getCopyRegion().back());
- // TODO: OpenACC: Implement this copy to actually do something.
+ mlir::BlockArgument fromArg = block->getArgument(0);
+ mlir::BlockArgument toArg = block->getArgument(1);
+
+ mlir::Type elementTy =
+ mlir::cast<cir::PointerType>(mainOp.getType()).getPointee();
+
+ // Set the address of the emission to be the argument, so that we initialize
+ // that instead of the variable in the other block.
+ tempDeclEmission.setAllocatedAddress(
----------------
andykaylor wrote:
Where is the memory for this actually allocated? Does that happen during lowering to some other dialect?
https://github.com/llvm/llvm-project/pull/154150
More information about the cfe-commits
mailing list