[flang-commits] [flang] 93b0d0f - [Flang][OpenMP] Add TODO message for copyprivate clause

Kiran Chandramohan via flang-commits flang-commits at lists.llvm.org
Thu Aug 3 12:11:21 PDT 2023


Author: Kiran Chandramohan
Date: 2023-08-03T18:51:27Z
New Revision: 93b0d0f6b53fa3ccf83cae19996abcc6699b6886

URL: https://github.com/llvm/llvm-project/commit/93b0d0f6b53fa3ccf83cae19996abcc6699b6886
DIFF: https://github.com/llvm/llvm-project/commit/93b0d0f6b53fa3ccf83cae19996abcc6699b6886.diff

LOG: [Flang][OpenMP] Add TODO message for copyprivate clause

The copyprivate clause is not yet implemented. Provide a TODO
error message when this clause is seen.

Reviewed By: NimishMishra

Differential Revision: https://reviews.llvm.org/D155596

Added: 
    flang/test/Lower/OpenMP/Todo/copyprivate.f90

Modified: 
    flang/lib/Lower/OpenMP.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Lower/OpenMP.cpp b/flang/lib/Lower/OpenMP.cpp
index a375648c4e3e36..8dba0dbba10cab 100644
--- a/flang/lib/Lower/OpenMP.cpp
+++ b/flang/lib/Lower/OpenMP.cpp
@@ -2432,6 +2432,7 @@ genOMP(Fortran::lower::AbstractConverter &converter,
   cp.processDepend(dependTypeOperands, dependOperands);
 
   for (const Fortran::parser::OmpClause &clause : opClauseList.v) {
+    mlir::Location clauseLocation = converter.genLocation(clause.source);
     if (!std::get_if<Fortran::parser::OmpClause::If>(&clause.u) &&
         !std::get_if<Fortran::parser::OmpClause::NumThreads>(&clause.u) &&
         !std::get_if<Fortran::parser::OmpClause::ProcBind>(&clause.u) &&
@@ -2458,13 +2459,19 @@ genOMP(Fortran::lower::AbstractConverter &converter,
         !std::get_if<Fortran::parser::OmpClause::UseDevicePtr>(&clause.u) &&
         !std::get_if<Fortran::parser::OmpClause::UseDeviceAddr>(&clause.u) &&
         !std::get_if<Fortran::parser::OmpClause::ThreadLimit>(&clause.u)) {
-      TODO(converter.getCurrentLocation(), "OpenMP Block construct clause");
+      TODO(clauseLocation, "OpenMP Block construct clause");
     }
   }
 
   ClauseProcessor(converter,
                   std::get<Fortran::parser::OmpClauseList>(endBlockDirective.t))
       .processNowait(nowaitAttr);
+  for (const auto &clause :
+       std::get<Fortran::parser::OmpClauseList>(endBlockDirective.t).v) {
+    mlir::Location clauseLocation = converter.genLocation(clause.source);
+    if (!std::get_if<Fortran::parser::OmpClause::Nowait>(&clause.u))
+      TODO(clauseLocation, "OpenMP Block construct clause");
+  }
 
   if (blockDirective.v == llvm::omp::OMPD_parallel) {
     // Create and insert the operation.

diff  --git a/flang/test/Lower/OpenMP/Todo/copyprivate.f90 b/flang/test/Lower/OpenMP/Todo/copyprivate.f90
new file mode 100644
index 00000000000000..0d871427ce60ff
--- /dev/null
+++ b/flang/test/Lower/OpenMP/Todo/copyprivate.f90
@@ -0,0 +1,13 @@
+! RUN: %not_todo_cmd bbc -emit-fir -fopenmp -o - %s 2>&1 | FileCheck %s
+! RUN: %not_todo_cmd %flang_fc1 -emit-fir -fopenmp -o - %s 2>&1 | FileCheck %s
+
+! CHECK: not yet implemented: OpenMP Block construct clause
+subroutine sb
+  integer, save :: a
+  !$omp threadprivate(a)
+  !$omp parallel
+  !$omp single
+  a = 3
+  !$omp end single copyprivate(a)
+  !$omp end parallel
+end subroutine


        


More information about the flang-commits mailing list