@@ -613,12 +613,39 @@ class OpenACCClauseCIREmitter final
613613 } else {
614614 llvm_unreachable (" var-list version of self shouldn't get here" );
615615 }
616+ } else if constexpr (isOneOfTypes<OpTy, mlir::acc::UpdateOp>) {
617+ assert (!clause.isEmptySelfClause () && !clause.isConditionExprClause () &&
618+ " var-list version of self required for update" );
619+ for (const Expr *var : clause.getVarList ())
620+ addDataOperand<mlir::acc::GetDevicePtrOp, mlir::acc::UpdateHostOp>(
621+ var, mlir::acc::DataClause::acc_update_self, {},
622+ /* structured=*/ false , /* implicit=*/ false );
616623 } else if constexpr (isCombinedType<OpTy>) {
617624 applyToComputeOp (clause);
618625 } else {
619- // TODO: When we've implemented this for everything, switch this to an
620- // unreachable. update construct remains.
621- return clauseNotImplemented (clause);
626+ llvm_unreachable (" Unknown construct kind in VisitSelfClause" );
627+ }
628+ }
629+
630+ void VisitHostClause (const OpenACCHostClause &clause) {
631+ if constexpr (isOneOfTypes<OpTy, mlir::acc::UpdateOp>) {
632+ for (const Expr *var : clause.getVarList ())
633+ addDataOperand<mlir::acc::GetDevicePtrOp, mlir::acc::UpdateHostOp>(
634+ var, mlir::acc::DataClause::acc_update_host, {},
635+ /* structured=*/ false , /* implicit=*/ false );
636+ } else {
637+ llvm_unreachable (" Unknown construct kind in VisitHostClause" );
638+ }
639+ }
640+
641+ void VisitDeviceClause (const OpenACCDeviceClause &clause) {
642+ if constexpr (isOneOfTypes<OpTy, mlir::acc::UpdateOp>) {
643+ for (const Expr *var : clause.getVarList ())
644+ addDataOperand<mlir::acc::UpdateDeviceOp>(
645+ var, mlir::acc::DataClause::acc_update_device, {},
646+ /* structured=*/ false , /* implicit=*/ false );
647+ } else {
648+ llvm_unreachable (" Unknown construct kind in VisitDeviceClause" );
622649 }
623650 }
624651
@@ -1095,6 +1122,7 @@ EXPL_SPEC(mlir::acc::WaitOp)
10951122EXPL_SPEC(mlir::acc::HostDataOp)
10961123EXPL_SPEC(mlir::acc::EnterDataOp)
10971124EXPL_SPEC(mlir::acc::ExitDataOp)
1125+ EXPL_SPEC(mlir::acc::UpdateOp)
10981126#undef EXPL_SPEC
10991127
11001128template <typename ComputeOp, typename LoopOp>
0 commit comments