@@ -41,6 +41,12 @@ static llvm::cl::opt<bool> treatIndexAsSection(
41
41
llvm::cl::desc (" In the OpenMP data clauses treat `a(N)` as `a(N:N)`." ),
42
42
llvm::cl::init(true ));
43
43
44
+ static llvm::cl::opt<bool > enableDelayedPrivatization (
45
+ " openmp-enable-delayed-privatization" ,
46
+ llvm::cl::desc (
47
+ " Emit `[first]private` variables as clauses on the MLIR ops." ),
48
+ llvm::cl::init(false ));
49
+
44
50
using DeclareTargetCapturePair =
45
51
std::pair<mlir::omp::DeclareTargetCaptureClause,
46
52
Fortran::semantics::Symbol>;
@@ -2614,6 +2620,21 @@ genParallelOp(Fortran::lower::AbstractConverter &converter,
2614
2620
if (!outerCombined)
2615
2621
cp.processReduction (currentLocation, reductionVars, reductionDeclSymbols);
2616
2622
2623
+ if (!enableDelayedPrivatization) {
2624
+ return genOpWithBody<mlir::omp::ParallelOp>(
2625
+ converter, eval, genNested, currentLocation, outerCombined, &clauseList,
2626
+ /* genRegionEntryCB=*/ nullptr , /* dsp=*/ nullptr ,
2627
+ /* resultTypes=*/ mlir::TypeRange (), ifClauseOperand,
2628
+ numThreadsClauseOperand, allocateOperands, allocatorOperands,
2629
+ reductionVars,
2630
+ reductionDeclSymbols.empty ()
2631
+ ? nullptr
2632
+ : mlir::ArrayAttr::get (converter.getFirOpBuilder ().getContext (),
2633
+ reductionDeclSymbols),
2634
+ procBindKindAttr, /* private_vars=*/ llvm::SmallVector<mlir::Value>{},
2635
+ /* privatizers=*/ nullptr );
2636
+ }
2637
+
2617
2638
bool privatize = !outerCombined;
2618
2639
DataSharingProcessor dsp (converter, clauseList, eval,
2619
2640
/* useDelayedPrivatization=*/ true , &symTable);
0 commit comments