Skip to content

Commit 2b2d32b

Browse files
committed
Add feature flag.
1 parent e8fc1e6 commit 2b2d32b

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

flang/lib/Lower/OpenMP.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ static llvm::cl::opt<bool> treatIndexAsSection(
4141
llvm::cl::desc("In the OpenMP data clauses treat `a(N)` as `a(N:N)`."),
4242
llvm::cl::init(true));
4343

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+
4450
using DeclareTargetCapturePair =
4551
std::pair<mlir::omp::DeclareTargetCaptureClause,
4652
Fortran::semantics::Symbol>;
@@ -2614,6 +2620,21 @@ genParallelOp(Fortran::lower::AbstractConverter &converter,
26142620
if (!outerCombined)
26152621
cp.processReduction(currentLocation, reductionVars, reductionDeclSymbols);
26162622

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+
26172638
bool privatize = !outerCombined;
26182639
DataSharingProcessor dsp(converter, clauseList, eval,
26192640
/*useDelayedPrivatization=*/true, &symTable);

0 commit comments

Comments
 (0)