@@ -504,11 +504,6 @@ struct OpWithBodyGenInfo {
504
504
: converter(converter), symTable(symTable), semaCtx(semaCtx), loc(loc),
505
505
eval (eval), dir(dir) {}
506
506
507
- OpWithBodyGenInfo &setOuterCombined (bool value) {
508
- outerCombined = value;
509
- return *this ;
510
- }
511
-
512
507
OpWithBodyGenInfo &setClauses (const List<Clause> *value) {
513
508
clauses = value;
514
509
return *this ;
@@ -519,14 +514,6 @@ struct OpWithBodyGenInfo {
519
514
return *this ;
520
515
}
521
516
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
-
530
517
OpWithBodyGenInfo &setGenRegionEntryCb (GenOMPRegionEntryCBFn value) {
531
518
genRegionEntryCB = value;
532
519
return *this ;
@@ -544,16 +531,10 @@ struct OpWithBodyGenInfo {
544
531
lower::pft::Evaluation &eval;
545
532
// / [in] leaf directive for which to generate the op body.
546
533
llvm::omp::Directive dir;
547
- // / [in] is this an outer operation - prevents privatization.
548
- bool outerCombined = false ;
549
534
// / [in] list of clauses to process.
550
535
const List<Clause> *clauses = nullptr ;
551
536
// / [in] if provided, processes the construct's data-sharing attributes.
552
537
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 ;
557
538
// / [in] if provided, emits the op's region entry. Otherwise, an emtpy block
558
539
// / is created in the region.
559
540
GenOMPRegionEntryCBFn genRegionEntryCB = nullptr ;
@@ -591,26 +572,23 @@ static void createBodyOfOp(mlir::Operation &op, const OpWithBodyGenInfo &info,
591
572
// Mark the earliest insertion point.
592
573
mlir::Operation *marker = insertMarker (firOpBuilder);
593
574
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 ())
597
577
lower::createEmptyRegionBlocks<mlir::omp::TerminatorOp, mlir::omp::YieldOp>(
598
578
firOpBuilder, info.eval .getNestedEvaluations ());
599
579
600
580
// Start with privatization, so that the lowering of the nested
601
581
// code will use the right symbols.
602
582
bool isLoop = llvm::omp::getDirectiveAssociation (info.dir ) ==
603
583
llvm::omp::Association::Loop;
604
- bool privatize = info.clauses && !info. outerCombined ;
584
+ bool privatize = info.clauses ;
605
585
606
586
firOpBuilder.setInsertionPoint (marker);
607
587
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 ();
614
592
}
615
593
616
594
if (info.dir == llvm::omp::Directive::OMPD_parallel) {
@@ -1078,8 +1056,7 @@ genOrderedRegionClauses(lower::AbstractConverter &converter,
1078
1056
static void genParallelClauses (
1079
1057
lower::AbstractConverter &converter, semantics::SemanticsContext &semaCtx,
1080
1058
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,
1083
1060
llvm::SmallVectorImpl<mlir::Type> &reductionTypes,
1084
1061
llvm::SmallVectorImpl<const semantics::Symbol *> &reductionSyms) {
1085
1062
ClauseProcessor cp (converter, semaCtx, clauses);
@@ -1088,10 +1065,7 @@ static void genParallelClauses(
1088
1065
cp.processIf (llvm::omp::Directive::OMPD_parallel, clauseOps);
1089
1066
cp.processNumThreads (stmtCtx, clauseOps);
1090
1067
cp.processProcBind (clauseOps);
1091
-
1092
- if (processReduction) {
1093
- cp.processReduction (loc, clauseOps, &reductionTypes, &reductionSyms);
1094
- }
1068
+ cp.processReduction (loc, clauseOps, &reductionTypes, &reductionSyms);
1095
1069
}
1096
1070
1097
1071
static void genSectionsClauses (lower::AbstractConverter &converter,
@@ -1440,15 +1414,13 @@ static mlir::omp::ParallelOp
1440
1414
genParallelOp (lower::AbstractConverter &converter, lower::SymMap &symTable,
1441
1415
semantics::SemanticsContext &semaCtx,
1442
1416
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) {
1445
1418
fir::FirOpBuilder &firOpBuilder = converter.getFirOpBuilder ();
1446
1419
lower::StatementContext stmtCtx;
1447
1420
mlir::omp::ParallelClauseOps clauseOps;
1448
1421
llvm::SmallVector<mlir::Type> reductionTypes;
1449
1422
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,
1452
1424
reductionTypes, reductionSyms);
1453
1425
1454
1426
auto reductionCallback = [&](mlir::Operation *op) {
@@ -1459,22 +1431,17 @@ genParallelOp(lower::AbstractConverter &converter, lower::SymMap &symTable,
1459
1431
OpWithBodyGenInfo genInfo =
1460
1432
OpWithBodyGenInfo (converter, symTable, semaCtx, loc, eval,
1461
1433
llvm::omp::Directive::OMPD_parallel)
1462
- .setOuterCombined (outerCombined)
1463
1434
.setClauses (&item->clauses )
1464
- .setReductions (&reductionSyms, &reductionTypes)
1465
1435
.setGenRegionEntryCb (reductionCallback);
1466
1436
1467
1437
if (!enableDelayedPrivatization)
1468
1438
return genOpWithBody<mlir::omp::ParallelOp>(genInfo, queue, item,
1469
1439
clauseOps);
1470
1440
1471
- bool privatize = !outerCombined;
1472
1441
DataSharingProcessor dsp (converter, semaCtx, item->clauses , eval,
1473
1442
lower::omp::isLastItemInQueue (item, queue),
1474
1443
/* useDelayedPrivatization=*/ true , &symTable);
1475
-
1476
- if (privatize)
1477
- dsp.processStep1 (&clauseOps);
1444
+ dsp.processStep1 (&clauseOps);
1478
1445
1479
1446
auto genRegionEntryCB = [&](mlir::Operation *op) {
1480
1447
auto parallelOp = llvm::cast<mlir::omp::ParallelOp>(op);
@@ -1921,15 +1888,14 @@ static mlir::omp::TeamsOp
1921
1888
genTeamsOp (lower::AbstractConverter &converter, lower::SymMap &symTable,
1922
1889
semantics::SemanticsContext &semaCtx, lower::pft::Evaluation &eval,
1923
1890
mlir::Location loc, const ConstructQueue &queue,
1924
- ConstructQueue::iterator item, bool outerCombined = false ) {
1891
+ ConstructQueue::iterator item) {
1925
1892
lower::StatementContext stmtCtx;
1926
1893
mlir::omp::TeamsClauseOps clauseOps;
1927
1894
genTeamsClauses (converter, semaCtx, stmtCtx, item->clauses , loc, clauseOps);
1928
1895
1929
1896
return genOpWithBody<mlir::omp::TeamsOp>(
1930
1897
OpWithBodyGenInfo (converter, symTable, semaCtx, loc, eval,
1931
1898
llvm::omp::Directive::OMPD_teams)
1932
- .setOuterCombined (outerCombined)
1933
1899
.setClauses (&item->clauses ),
1934
1900
queue, item, clauseOps);
1935
1901
}
@@ -1982,7 +1948,6 @@ genWsloopOp(lower::AbstractConverter &converter, lower::SymMap &symTable,
1982
1948
*nestedEval, llvm::omp::Directive::OMPD_do)
1983
1949
.setClauses (&item->clauses )
1984
1950
.setDataSharingProcessor (&dsp)
1985
- .setReductions (&reductionSyms, &reductionTypes)
1986
1951
.setGenRegionEntryCb (ivCallback),
1987
1952
queue, item);
1988
1953
symTable.popScope ();
@@ -2084,8 +2049,7 @@ static void genOMPDispatch(lower::AbstractConverter &converter,
2084
2049
genOrderedRegionOp (converter, symTable, semaCtx, eval, loc, queue, item);
2085
2050
break ;
2086
2051
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);
2089
2053
break ;
2090
2054
case llvm::omp::Directive::OMPD_section:
2091
2055
genSectionOp (converter, symTable, semaCtx, eval, loc, queue, item);
0 commit comments