[Flang][OpenMP] Add TODO message for common block privatisation
authorKiran Chandramohan <kiran.chandramohan@arm.com>
Fri, 24 Mar 2023 11:02:18 +0000 (11:02 +0000)
committerKiran Chandramohan <kiran.chandramohan@arm.com>
Fri, 24 Mar 2023 11:20:03 +0000 (11:20 +0000)
This is a temporary message until the feature is implemented and
merged.

Note: There is a proposed patch (https://reviews.llvm.org/D127215)

Reviewed By: peixin

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

flang/lib/Lower/OpenMP.cpp
flang/test/Lower/OpenMP/Todo/firstprivate-commonblock.f90 [new file with mode: 0644]
flang/test/Lower/OpenMP/Todo/lastprivate-commonblock.f90 [new file with mode: 0644]
flang/test/Lower/OpenMP/Todo/private-commonblock.f90 [new file with mode: 0644]

index 22e5ff3..1204ba7 100644 (file)
@@ -173,6 +173,12 @@ void DataSharingProcessor::collectSymbolsForPrivatization() {
     }
   }
 
+  for (auto *ps : privatizedSymbols) {
+    if (ps->has<Fortran::semantics::CommonBlockDetails>())
+      TODO(converter.getCurrentLocation(),
+           "Common Block in privatization clause");
+  }
+
   if (hasCollapse && hasLastPrivateOp)
     TODO(converter.getCurrentLocation(), "Collapse clause with lastprivate");
 }
diff --git a/flang/test/Lower/OpenMP/Todo/firstprivate-commonblock.f90 b/flang/test/Lower/OpenMP/Todo/firstprivate-commonblock.f90
new file mode 100644 (file)
index 0000000..1018c7b
--- /dev/null
@@ -0,0 +1,10 @@
+! 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: Common Block in privatization clause
+subroutine firstprivate_common
+  common /c/ x, y
+  real x, y
+  !$omp parallel firstprivate(/c/)
+  !$omp end parallel
+end subroutine
diff --git a/flang/test/Lower/OpenMP/Todo/lastprivate-commonblock.f90 b/flang/test/Lower/OpenMP/Todo/lastprivate-commonblock.f90
new file mode 100644 (file)
index 0000000..66ffc46
--- /dev/null
@@ -0,0 +1,12 @@
+! 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: Common Block in privatization clause
+subroutine lastprivate_common
+  common /c/ x, y
+  real x, y
+  !$omp do lastprivate(/c/)
+  do i=1,100
+  end do
+  !$omp end do
+end subroutine
diff --git a/flang/test/Lower/OpenMP/Todo/private-commonblock.f90 b/flang/test/Lower/OpenMP/Todo/private-commonblock.f90
new file mode 100644 (file)
index 0000000..da11e58
--- /dev/null
@@ -0,0 +1,10 @@
+! 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: Common Block in privatization clause
+subroutine private_common
+  common /c/ x, y
+  real x, y
+  !$omp parallel private(/c/)
+  !$omp end parallel
+end subroutine