[Mlir-commits] [flang] [mlir] [acc] Support for Optionals in firstprivate recipes. (PR #185764)

Razvan Lupusoru llvmlistbot at llvm.org
Wed Mar 11 08:05:40 PDT 2026


================
@@ -1607,24 +1611,28 @@ static LogicalResult createCopyRegion(OpBuilder &builder, Location loc,
   copyBlock->addArguments(copyArgTypes, copyArgLocs);
   builder.setInsertionPointToStart(copyBlock);
 
+  Value originalArg = copyBlock->getArgument(0);
+  Value privatizedArg = copyBlock->getArgument(1);
+
   bool isMappable = isa<MappableType>(varType);
   bool isPointerLike = isa<PointerLikeType>(varType);
-  // TODO: Handle MappableType - it does not yet have a copy API.
-  // Otherwise, for now just fallback to pointer-like behavior.
-  if (isMappable && !isPointerLike)
-    return failure();
 
-  // Generate copy region body based on variable type
-  if (isPointerLike) {
+  // When optional, use MappableType::generateCopy for null-check handling.
+  if (isMappable && isOptional) {
----------------
razvanlupusoru wrote:

I would suggest a separate PR for the update which adds MappableType support for the copy region. It should look similar to init region, if MappableType, use the generateCopy API, otherwise, use genCopy from PointerLikeType. 

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


More information about the Mlir-commits mailing list