[flang-commits] [flang] b905864 - [flang] Support for dump OpenMP/OpenACC declarative directives PFT in module

via flang-commits flang-commits at lists.llvm.org
Thu Mar 10 22:35:27 PST 2022


Author: Peixin-Qiao
Date: 2022-03-11T14:33:17+08:00
New Revision: b90586484560ef48b9c4b018885fea07561dd2ac

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

LOG: [flang] Support for dump OpenMP/OpenACC declarative directives PFT in module

OpenMP/OpenACC declarative directives can also be used in module unit.
Add support for dump them in module.

Reviewed By: kiranchandramohan, V Donaldson

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

Added: 
    flang/test/Lower/pre-fir-tree06.f90
    flang/test/Lower/pre-fir-tree07.f90

Modified: 
    flang/lib/Lower/PFTBuilder.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Lower/PFTBuilder.cpp b/flang/lib/Lower/PFTBuilder.cpp
index c6a5ceb7b044d..b204d4a53fb54 100644
--- a/flang/lib/Lower/PFTBuilder.cpp
+++ b/flang/lib/Lower/PFTBuilder.cpp
@@ -1163,8 +1163,9 @@ class PFTDumper {
   void dumpModuleLikeUnit(llvm::raw_ostream &outputStream,
                           const lower::pft::ModuleLikeUnit &moduleLikeUnit) {
     outputStream << getNodeIndex(moduleLikeUnit) << " ";
-    outputStream << "ModuleLike: ";
-    outputStream << "\nContains\n";
+    outputStream << "ModuleLike:\n";
+    dumpEvaluationList(outputStream, moduleLikeUnit.evaluationList);
+    outputStream << "Contains\n";
     for (const lower::pft::FunctionLikeUnit &func :
          moduleLikeUnit.nestedFunctions)
       dumpFunctionLikeUnit(outputStream, func);

diff  --git a/flang/test/Lower/pre-fir-tree06.f90 b/flang/test/Lower/pre-fir-tree06.f90
new file mode 100644
index 0000000000000..b79a55a4a9745
--- /dev/null
+++ b/flang/test/Lower/pre-fir-tree06.f90
@@ -0,0 +1,12 @@
+! RUN: %flang_fc1 -fdebug-pre-fir-tree -fopenmp %s | FileCheck %s
+
+! Test structure of the Pre-FIR tree with OpenMP declarative construct
+
+! CHECK: ModuleLike
+module m
+  real, dimension(10) :: x
+  ! CHECK-NEXT: OpenMPDeclarativeConstruct
+  !$omp threadprivate(x)
+end
+! CHECK: End ModuleLike
+

diff  --git a/flang/test/Lower/pre-fir-tree07.f90 b/flang/test/Lower/pre-fir-tree07.f90
new file mode 100644
index 0000000000000..b12d6b7501bef
--- /dev/null
+++ b/flang/test/Lower/pre-fir-tree07.f90
@@ -0,0 +1,12 @@
+! RUN: %flang_fc1 -fdebug-pre-fir-tree -fopenacc %s | FileCheck %s
+
+! Test structure of the Pre-FIR tree with OpenACC declarative construct
+
+! CHECK: ModuleLike
+module m
+  real, dimension(10) :: x
+  ! CHECK-NEXT: OpenACCDeclarativeConstruct
+  !$acc declare create(x)
+end
+! CHECK: End ModuleLike
+


        


More information about the flang-commits mailing list