@@ -761,7 +761,8 @@ genEnterExitUpdateDataOp(Fortran::lower::AbstractConverter &converter,
761
761
Fortran::lower::StatementContext stmtCtx;
762
762
mlir::Value ifClauseOperand, deviceOperand;
763
763
mlir::UnitAttr nowaitAttr;
764
- llvm::SmallVector<mlir::Value> mapOperands;
764
+ llvm::SmallVector<mlir::Value> mapOperands, dependOperands;
765
+ llvm::SmallVector<mlir::Attribute> dependTypeOperands;
765
766
766
767
Fortran::parser::OmpIfClause::DirectiveNameModifier directiveName;
767
768
llvm::omp::Directive directive;
@@ -784,6 +785,7 @@ genEnterExitUpdateDataOp(Fortran::lower::AbstractConverter &converter,
784
785
ClauseProcessor cp (converter, semaCtx, clauseList);
785
786
cp.processIf (directiveName, ifClauseOperand);
786
787
cp.processDevice (stmtCtx, deviceOperand);
788
+ cp.processDepend (dependTypeOperands, dependOperands);
787
789
cp.processNowait (nowaitAttr);
788
790
789
791
if constexpr (std::is_same_v<OpTy, mlir::omp::UpdateDataOp>) {
@@ -796,12 +798,13 @@ genEnterExitUpdateDataOp(Fortran::lower::AbstractConverter &converter,
796
798
cp.processMap (currentLocation, directive, stmtCtx, mapOperands);
797
799
}
798
800
799
- cp.processTODO <Fortran::parser::OmpClause::Depend>(currentLocation,
800
- directive);
801
-
802
- return firOpBuilder.create <OpTy>(currentLocation, ifClauseOperand,
803
- deviceOperand, nullptr , mlir::ValueRange (),
804
- nowaitAttr, mapOperands);
801
+ return firOpBuilder.create <OpTy>(
802
+ currentLocation, ifClauseOperand, deviceOperand,
803
+ dependTypeOperands.empty ()
804
+ ? nullptr
805
+ : mlir::ArrayAttr::get (converter.getFirOpBuilder ().getContext (),
806
+ dependTypeOperands),
807
+ dependOperands, nowaitAttr, mapOperands);
805
808
}
806
809
807
810
// This functions creates a block for the body of the targetOp's region. It adds
@@ -968,7 +971,8 @@ genTargetOp(Fortran::lower::AbstractConverter &converter,
968
971
Fortran::lower::StatementContext stmtCtx;
969
972
mlir::Value ifClauseOperand, deviceOperand, threadLimitOperand;
970
973
mlir::UnitAttr nowaitAttr;
971
- llvm::SmallVector<mlir::Value> mapOperands;
974
+ llvm::SmallVector<mlir::Attribute> dependTypeOperands;
975
+ llvm::SmallVector<mlir::Value> mapOperands, dependOperands;
972
976
llvm::SmallVector<mlir::Type> mapSymTypes;
973
977
llvm::SmallVector<mlir::Location> mapSymLocs;
974
978
llvm::SmallVector<const Fortran::semantics::Symbol *> mapSymbols;
@@ -978,11 +982,12 @@ genTargetOp(Fortran::lower::AbstractConverter &converter,
978
982
ifClauseOperand);
979
983
cp.processDevice (stmtCtx, deviceOperand);
980
984
cp.processThreadLimit (stmtCtx, threadLimitOperand);
985
+ cp.processDepend (dependTypeOperands, dependOperands);
981
986
cp.processNowait (nowaitAttr);
982
987
cp.processMap (currentLocation, directive, stmtCtx, mapOperands, &mapSymTypes,
983
988
&mapSymLocs, &mapSymbols);
989
+
984
990
cp.processTODO <Fortran::parser::OmpClause::Private,
985
- Fortran::parser::OmpClause::Depend,
986
991
Fortran::parser::OmpClause::Firstprivate,
987
992
Fortran::parser::OmpClause::IsDevicePtr,
988
993
Fortran::parser::OmpClause::HasDeviceAddr,
@@ -992,7 +997,6 @@ genTargetOp(Fortran::lower::AbstractConverter &converter,
992
997
Fortran::parser::OmpClause::UsesAllocators,
993
998
Fortran::parser::OmpClause::Defaultmap>(
994
999
currentLocation, llvm::omp::Directive::OMPD_target);
995
-
996
1000
// 5.8.1 Implicit Data-Mapping Attribute Rules
997
1001
// The following code follows the implicit data-mapping rules to map all the
998
1002
// symbols used inside the region that have not been explicitly mapped using
@@ -1066,7 +1070,11 @@ genTargetOp(Fortran::lower::AbstractConverter &converter,
1066
1070
1067
1071
auto targetOp = converter.getFirOpBuilder ().create <mlir::omp::TargetOp>(
1068
1072
currentLocation, ifClauseOperand, deviceOperand, threadLimitOperand,
1069
- nullptr , mlir::ValueRange (), nowaitAttr, mapOperands);
1073
+ dependTypeOperands.empty ()
1074
+ ? nullptr
1075
+ : mlir::ArrayAttr::get (converter.getFirOpBuilder ().getContext (),
1076
+ dependTypeOperands),
1077
+ dependOperands, nowaitAttr, mapOperands);
1070
1078
1071
1079
genBodyOfTargetOp (converter, semaCtx, eval, genNested, targetOp, mapSymTypes,
1072
1080
mapSymLocs, mapSymbols, currentLocation);
0 commit comments