[flang-commits] [flang] [Flang][OpenMP]Add tests for align and allocator in allocate clauses (PR #121356)

via flang-commits flang-commits at lists.llvm.org
Mon Dec 30 12:06:09 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-fir-hlfir

@llvm/pr-subscribers-flang-openmp

Author: Mats Petersson (Leporacanthicus)

<details>
<summary>Changes</summary>

No functional change.

(Also, tried to filter out all ALLOCATOR modifiers, but that makes some other tests fail).

---
Full diff: https://github.com/llvm/llvm-project/pull/121356.diff


3 Files Affected:

- (modified) flang/lib/Parser/openmp-parsers.cpp (+2-2) 
- (added) flang/test/Lower/OpenMP/Todo/allocate-clause-align.f90 (+14) 
- (added) flang/test/Lower/OpenMP/Todo/allocate-clause-allocator.f90 (+15) 


``````````diff
diff --git a/flang/lib/Parser/openmp-parsers.cpp b/flang/lib/Parser/openmp-parsers.cpp
index 67385c03f66c80..dea4102205be0c 100644
--- a/flang/lib/Parser/openmp-parsers.cpp
+++ b/flang/lib/Parser/openmp-parsers.cpp
@@ -157,8 +157,8 @@ static TypeDeclarationStmt makeIterSpecDecl(std::list<ObjectName> &&names) {
 
 TYPE_PARSER(construct<OmpAlignment>(scalarIntExpr))
 
-TYPE_PARSER(construct<OmpAlignModifier>( //
-    "ALIGN" >> parenthesized(scalarIntExpr)))
+TYPE_PARSER(
+    construct<OmpAlignModifier>("ALIGN"_tok >> parenthesized(scalarIntExpr)))
 
 TYPE_PARSER(construct<OmpAllocatorComplexModifier>(
     "ALLOCATOR" >> parenthesized(scalarIntExpr)))
diff --git a/flang/test/Lower/OpenMP/Todo/allocate-clause-align.f90 b/flang/test/Lower/OpenMP/Todo/allocate-clause-align.f90
new file mode 100644
index 00000000000000..c51ba9be84235b
--- /dev/null
+++ b/flang/test/Lower/OpenMP/Todo/allocate-clause-align.f90
@@ -0,0 +1,14 @@
+! RUN: %not_todo_cmd %flang_fc1 -emit-fir -fopenmp -fopenmp-version=51 -o - %s 2>&1 | FileCheck %s
+
+! CHECK: not yet implemented: OmpAllocateClause ALIGN modifier
+program p
+  use omp_lib
+  integer :: x
+  integer :: a
+  integer :: i
+  !$omp parallel private(x) allocate(align(4): x)
+  do i=1,10
+     a = a + i
+  end do
+  !$omp end parallel
+end program p
diff --git a/flang/test/Lower/OpenMP/Todo/allocate-clause-allocator.f90 b/flang/test/Lower/OpenMP/Todo/allocate-clause-allocator.f90
new file mode 100644
index 00000000000000..01a91e84a0d477
--- /dev/null
+++ b/flang/test/Lower/OpenMP/Todo/allocate-clause-allocator.f90
@@ -0,0 +1,15 @@
+! RUN: %not_todo_cmd %flang_fc1 -emit-llvm -fopenmp -fopenmp-version=51 -o - %s 2>&1 | FileCheck %s
+
+! CHECK: not yet implemented: Unhandled clause allocate in omp.parallel
+! CHECK: LLVM Translation failed for operation: omp.parallel
+program p
+  use omp_lib
+  integer :: x
+  integer :: a
+  integer :: i
+  !$omp parallel private(x) allocate(allocator(omp_default_mem_alloc): x)
+  do i=1,10
+     a = a + i
+  end do
+  !$omp end parallel
+end program p

``````````

</details>


https://github.com/llvm/llvm-project/pull/121356


More information about the flang-commits mailing list