From 28325abd4108deee6a48a68e1b63da04ba55367e Mon Sep 17 00:00:00 2001 From: Mats Petersson Date: Mon, 30 Dec 2024 18:49:55 +0000 Subject: [PATCH 1/3] [Flang][OpenMP]Add tests for align and allocator in allocate clauses No functional change. (Also, tried to filter out all ALLOCATOR modifiers, but that makes some other tests fail). --- flang/lib/Parser/openmp-parsers.cpp | 4 ++-- .../Lower/OpenMP/Todo/allocate-clause-align.f90 | 14 ++++++++++++++ .../OpenMP/Todo/allocate-clause-allocator.f90 | 15 +++++++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 flang/test/Lower/OpenMP/Todo/allocate-clause-align.f90 create mode 100644 flang/test/Lower/OpenMP/Todo/allocate-clause-allocator.f90 diff --git a/flang/lib/Parser/openmp-parsers.cpp b/flang/lib/Parser/openmp-parsers.cpp index 67385c03f66c8..dea4102205be0 100644 --- a/flang/lib/Parser/openmp-parsers.cpp +++ b/flang/lib/Parser/openmp-parsers.cpp @@ -157,8 +157,8 @@ static TypeDeclarationStmt makeIterSpecDecl(std::list &&names) { TYPE_PARSER(construct(scalarIntExpr)) -TYPE_PARSER(construct( // - "ALIGN" >> parenthesized(scalarIntExpr))) +TYPE_PARSER( + construct("ALIGN"_tok >> parenthesized(scalarIntExpr))) TYPE_PARSER(construct( "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 0000000000000..c51ba9be84235 --- /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 0000000000000..01a91e84a0d47 --- /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 From b2e20707c56def024fb071b23fc53ab395296d3d Mon Sep 17 00:00:00 2001 From: Mats Petersson Date: Fri, 3 Jan 2025 19:41:27 +0000 Subject: [PATCH 2/3] Add requires to tests --- flang/test/Lower/OpenMP/Todo/allocate-clause-align.f90 | 1 + flang/test/Lower/OpenMP/Todo/allocate-clause-allocator.f90 | 1 + 2 files changed, 2 insertions(+) diff --git a/flang/test/Lower/OpenMP/Todo/allocate-clause-align.f90 b/flang/test/Lower/OpenMP/Todo/allocate-clause-align.f90 index c51ba9be84235..fc721024737bf 100644 --- a/flang/test/Lower/OpenMP/Todo/allocate-clause-align.f90 +++ b/flang/test/Lower/OpenMP/Todo/allocate-clause-align.f90 @@ -1,3 +1,4 @@ +! REQUIRES: openmp_runtime ! 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 diff --git a/flang/test/Lower/OpenMP/Todo/allocate-clause-allocator.f90 b/flang/test/Lower/OpenMP/Todo/allocate-clause-allocator.f90 index 01a91e84a0d47..d33bdf9f9a8db 100644 --- a/flang/test/Lower/OpenMP/Todo/allocate-clause-allocator.f90 +++ b/flang/test/Lower/OpenMP/Todo/allocate-clause-allocator.f90 @@ -1,3 +1,4 @@ +! REQUIRES: openmp_runtime ! 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 From 4c8aa209b69301c31b755a60eded6c4b3f20a936 Mon Sep 17 00:00:00 2001 From: Mats Petersson Date: Mon, 6 Jan 2025 11:26:58 +0000 Subject: [PATCH 3/3] Update test & revert unnecessary code change --- flang/lib/Parser/openmp-parsers.cpp | 4 ++-- flang/test/Lower/OpenMP/Todo/allocate-clause-align.f90 | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/flang/lib/Parser/openmp-parsers.cpp b/flang/lib/Parser/openmp-parsers.cpp index dea4102205be0..67385c03f66c8 100644 --- a/flang/lib/Parser/openmp-parsers.cpp +++ b/flang/lib/Parser/openmp-parsers.cpp @@ -157,8 +157,8 @@ static TypeDeclarationStmt makeIterSpecDecl(std::list &&names) { TYPE_PARSER(construct(scalarIntExpr)) -TYPE_PARSER( - construct("ALIGN"_tok >> parenthesized(scalarIntExpr))) +TYPE_PARSER(construct( // + "ALIGN" >> parenthesized(scalarIntExpr))) TYPE_PARSER(construct( "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 index fc721024737bf..b272d2e76d70c 100644 --- a/flang/test/Lower/OpenMP/Todo/allocate-clause-align.f90 +++ b/flang/test/Lower/OpenMP/Todo/allocate-clause-align.f90 @@ -1,9 +1,7 @@ -! REQUIRES: openmp_runtime ! 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