@@ -504,11 +504,6 @@ struct OpWithBodyGenInfo {
504504 : converter(converter), symTable(symTable), semaCtx(semaCtx), loc(loc),
505505 eval (eval), dir(dir) {}
506506
507- OpWithBodyGenInfo &setOuterCombined (bool value) {
508- outerCombined = value;
509- return *this ;
510- }
511-
512507 OpWithBodyGenInfo &setClauses (const List<Clause> *value) {
513508 clauses = value;
514509 return *this ;
@@ -519,14 +514,6 @@ struct OpWithBodyGenInfo {
519514 return *this ;
520515 }
521516
522- OpWithBodyGenInfo &
523- setReductions (llvm::SmallVectorImpl<const semantics::Symbol *> *value1,
524- llvm::SmallVectorImpl<mlir::Type> *value2) {
525- reductionSymbols = value1;
526- reductionTypes = value2;
527- return *this ;
528- }
529-
530517 OpWithBodyGenInfo &setGenRegionEntryCb (GenOMPRegionEntryCBFn value) {
531518 genRegionEntryCB = value;
532519 return *this ;
@@ -544,16 +531,10 @@ struct OpWithBodyGenInfo {
544531 lower::pft::Evaluation &eval;
545532 // / [in] leaf directive for which to generate the op body.
546533 llvm::omp::Directive dir;
547- // / [in] is this an outer operation - prevents privatization.
548- bool outerCombined = false ;
549534 // / [in] list of clauses to process.
550535 const List<Clause> *clauses = nullptr ;
551536 // / [in] if provided, processes the construct's data-sharing attributes.
552537 DataSharingProcessor *dsp = nullptr ;
553- // / [in] if provided, list of reduction symbols
554- llvm::SmallVectorImpl<const semantics::Symbol *> *reductionSymbols = nullptr ;
555- // / [in] if provided, list of reduction types
556- llvm::SmallVectorImpl<mlir::Type> *reductionTypes = nullptr ;
557538 // / [in] if provided, emits the op's region entry. Otherwise, an emtpy block
558539 // / is created in the region.
559540 GenOMPRegionEntryCBFn genRegionEntryCB = nullptr ;
@@ -591,26 +572,23 @@ static void createBodyOfOp(mlir::Operation &op, const OpWithBodyGenInfo &info,
591572 // Mark the earliest insertion point.
592573 mlir::Operation *marker = insertMarker (firOpBuilder);
593574
594- // If it is an unstructured region and is not the outer region of a combined
595- // construct, create empty blocks for all evaluations.
596- if (info.eval .lowerAsUnstructured () && !info.outerCombined )
575+ // If it is an unstructured region, create empty blocks for all evaluations.
576+ if (info.eval .lowerAsUnstructured ())
597577 lower::createEmptyRegionBlocks<mlir::omp::TerminatorOp, mlir::omp::YieldOp>(
598578 firOpBuilder, info.eval .getNestedEvaluations ());
599579
600580 // Start with privatization, so that the lowering of the nested
601581 // code will use the right symbols.
602582 bool isLoop = llvm::omp::getDirectiveAssociation (info.dir ) ==
603583 llvm::omp::Association::Loop;
604- bool privatize = info.clauses && !info. outerCombined ;
584+ bool privatize = info.clauses ;
605585
606586 firOpBuilder.setInsertionPoint (marker);
607587 std::optional<DataSharingProcessor> tempDsp;
608- if (privatize) {
609- if (!info.dsp ) {
610- tempDsp.emplace (info.converter , info.semaCtx , *info.clauses , info.eval ,
611- Fortran::lower::omp::isLastItemInQueue (item, queue));
612- tempDsp->processStep1 ();
613- }
588+ if (privatize && !info.dsp ) {
589+ tempDsp.emplace (info.converter , info.semaCtx , *info.clauses , info.eval ,
590+ Fortran::lower::omp::isLastItemInQueue (item, queue));
591+ tempDsp->processStep1 ();
614592 }
615593
616594 if (info.dir == llvm::omp::Directive::OMPD_parallel) {
@@ -1078,8 +1056,7 @@ genOrderedRegionClauses(lower::AbstractConverter &converter,
10781056static void genParallelClauses (
10791057 lower::AbstractConverter &converter, semantics::SemanticsContext &semaCtx,
10801058 lower::StatementContext &stmtCtx, const List<Clause> &clauses,
1081- mlir::Location loc, bool processReduction,
1082- mlir::omp::ParallelClauseOps &clauseOps,
1059+ mlir::Location loc, mlir::omp::ParallelClauseOps &clauseOps,
10831060 llvm::SmallVectorImpl<mlir::Type> &reductionTypes,
10841061 llvm::SmallVectorImpl<const semantics::Symbol *> &reductionSyms) {
10851062 ClauseProcessor cp (converter, semaCtx, clauses);
@@ -1088,10 +1065,7 @@ static void genParallelClauses(
10881065 cp.processIf (llvm::omp::Directive::OMPD_parallel, clauseOps);
10891066 cp.processNumThreads (stmtCtx, clauseOps);
10901067 cp.processProcBind (clauseOps);
1091-
1092- if (processReduction) {
1093- cp.processReduction (loc, clauseOps, &reductionTypes, &reductionSyms);
1094- }
1068+ cp.processReduction (loc, clauseOps, &reductionTypes, &reductionSyms);
10951069}
10961070
10971071static void genSectionsClauses (lower::AbstractConverter &converter,
@@ -1440,15 +1414,13 @@ static mlir::omp::ParallelOp
14401414genParallelOp (lower::AbstractConverter &converter, lower::SymMap &symTable,
14411415 semantics::SemanticsContext &semaCtx,
14421416 lower::pft::Evaluation &eval, mlir::Location loc,
1443- const ConstructQueue &queue, ConstructQueue::iterator item,
1444- bool outerCombined = false ) {
1417+ const ConstructQueue &queue, ConstructQueue::iterator item) {
14451418 fir::FirOpBuilder &firOpBuilder = converter.getFirOpBuilder ();
14461419 lower::StatementContext stmtCtx;
14471420 mlir::omp::ParallelClauseOps clauseOps;
14481421 llvm::SmallVector<mlir::Type> reductionTypes;
14491422 llvm::SmallVector<const semantics::Symbol *> reductionSyms;
1450- genParallelClauses (converter, semaCtx, stmtCtx, item->clauses , loc,
1451- /* processReduction=*/ !outerCombined, clauseOps,
1423+ genParallelClauses (converter, semaCtx, stmtCtx, item->clauses , loc, clauseOps,
14521424 reductionTypes, reductionSyms);
14531425
14541426 auto reductionCallback = [&](mlir::Operation *op) {
@@ -1459,22 +1431,17 @@ genParallelOp(lower::AbstractConverter &converter, lower::SymMap &symTable,
14591431 OpWithBodyGenInfo genInfo =
14601432 OpWithBodyGenInfo (converter, symTable, semaCtx, loc, eval,
14611433 llvm::omp::Directive::OMPD_parallel)
1462- .setOuterCombined (outerCombined)
14631434 .setClauses (&item->clauses )
1464- .setReductions (&reductionSyms, &reductionTypes)
14651435 .setGenRegionEntryCb (reductionCallback);
14661436
14671437 if (!enableDelayedPrivatization)
14681438 return genOpWithBody<mlir::omp::ParallelOp>(genInfo, queue, item,
14691439 clauseOps);
14701440
1471- bool privatize = !outerCombined;
14721441 DataSharingProcessor dsp (converter, semaCtx, item->clauses , eval,
14731442 lower::omp::isLastItemInQueue (item, queue),
14741443 /* useDelayedPrivatization=*/ true , &symTable);
1475-
1476- if (privatize)
1477- dsp.processStep1 (&clauseOps);
1444+ dsp.processStep1 (&clauseOps);
14781445
14791446 auto genRegionEntryCB = [&](mlir::Operation *op) {
14801447 auto parallelOp = llvm::cast<mlir::omp::ParallelOp>(op);
@@ -1921,15 +1888,14 @@ static mlir::omp::TeamsOp
19211888genTeamsOp (lower::AbstractConverter &converter, lower::SymMap &symTable,
19221889 semantics::SemanticsContext &semaCtx, lower::pft::Evaluation &eval,
19231890 mlir::Location loc, const ConstructQueue &queue,
1924- ConstructQueue::iterator item, bool outerCombined = false ) {
1891+ ConstructQueue::iterator item) {
19251892 lower::StatementContext stmtCtx;
19261893 mlir::omp::TeamsClauseOps clauseOps;
19271894 genTeamsClauses (converter, semaCtx, stmtCtx, item->clauses , loc, clauseOps);
19281895
19291896 return genOpWithBody<mlir::omp::TeamsOp>(
19301897 OpWithBodyGenInfo (converter, symTable, semaCtx, loc, eval,
19311898 llvm::omp::Directive::OMPD_teams)
1932- .setOuterCombined (outerCombined)
19331899 .setClauses (&item->clauses ),
19341900 queue, item, clauseOps);
19351901}
@@ -1982,7 +1948,6 @@ genWsloopOp(lower::AbstractConverter &converter, lower::SymMap &symTable,
19821948 *nestedEval, llvm::omp::Directive::OMPD_do)
19831949 .setClauses (&item->clauses )
19841950 .setDataSharingProcessor (&dsp)
1985- .setReductions (&reductionSyms, &reductionTypes)
19861951 .setGenRegionEntryCb (ivCallback),
19871952 queue, item);
19881953 symTable.popScope ();
@@ -2084,8 +2049,7 @@ static void genOMPDispatch(lower::AbstractConverter &converter,
20842049 genOrderedRegionOp (converter, symTable, semaCtx, eval, loc, queue, item);
20852050 break ;
20862051 case llvm::omp::Directive::OMPD_parallel:
2087- genParallelOp (converter, symTable, semaCtx, eval, loc, queue, item,
2088- /* outerCombined=*/ false );
2052+ genParallelOp (converter, symTable, semaCtx, eval, loc, queue, item);
20892053 break ;
20902054 case llvm::omp::Directive::OMPD_section:
20912055 genSectionOp (converter, symTable, semaCtx, eval, loc, queue, item);
0 commit comments