[flang-commits] [flang] [flang][OpenMP] Add `private` to `allocate` in parallel-sections.f90 (PR #92185)

Krzysztof Parzyszek via flang-commits flang-commits at lists.llvm.org
Tue May 14 15:40:12 PDT 2024


https://github.com/kparzysz updated https://github.com/llvm/llvm-project/pull/92185

>From 9ee3d53e0f37847dcb26a95a9e3d03158a9c674b Mon Sep 17 00:00:00 2001
From: Krzysztof Parzyszek <Krzysztof.Parzyszek at amd.com>
Date: Tue, 14 May 2024 16:46:47 -0500
Subject: [PATCH 1/2] [flang][OpenMP] Add `private` to `allocate` in
 parallel-sections.f90

Add a privatizing clause to the construct that uses `allocate` clause.
Amend the CHECK lines to reflect the expected output.
---
 flang/test/Lower/OpenMP/parallel-sections.f90 | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/flang/test/Lower/OpenMP/parallel-sections.f90 b/flang/test/Lower/OpenMP/parallel-sections.f90
index 2f78dd4562b0a..ff96bdc29d425 100644
--- a/flang/test/Lower/OpenMP/parallel-sections.f90
+++ b/flang/test/Lower/OpenMP/parallel-sections.f90
@@ -40,12 +40,8 @@ subroutine omp_parallel_sections_allocate(x, y)
   use omp_lib
   integer, intent(inout) :: x, y
   !CHECK: %[[allocator_1:.*]] = arith.constant 4 : i64
-  !CHECK: %[[allocator_2:.*]] = arith.constant 4 : i64
-  !CHECK: omp.parallel allocate(
-  !CHECK: %[[allocator_2]] : i64 -> %{{.*}} : !fir.ref<i32>) {
-  !CHECK: omp.sections allocate(
-  !CHECK: %[[allocator_1]] : i64 -> %{{.*}} : !fir.ref<i32>) {
-  !$omp parallel sections allocate(omp_high_bw_mem_alloc: x)
+  !CHECK: omp.sections allocate(%[[allocator_1]] : i64 -> %{{.*}} : !fir.ref<i32>) {
+  !$omp parallel sections allocate(omp_high_bw_mem_alloc: x) private(x, y)
     !CHECK: omp.section {
     !$omp section
       x = x + 12

>From 36e859f11dfb54910b3fa95318565bfa33af58b7 Mon Sep 17 00:00:00 2001
From: Krzysztof Parzyszek <Krzysztof.Parzyszek at amd.com>
Date: Tue, 14 May 2024 17:39:36 -0500
Subject: [PATCH 2/2] Add check for omp.parallel

---
 flang/test/Lower/OpenMP/parallel-sections.f90 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/flang/test/Lower/OpenMP/parallel-sections.f90 b/flang/test/Lower/OpenMP/parallel-sections.f90
index ff96bdc29d425..285102e06cad1 100644
--- a/flang/test/Lower/OpenMP/parallel-sections.f90
+++ b/flang/test/Lower/OpenMP/parallel-sections.f90
@@ -39,6 +39,7 @@ end subroutine omp_parallel_sections
 subroutine omp_parallel_sections_allocate(x, y)
   use omp_lib
   integer, intent(inout) :: x, y
+  !CHECK: omp.parallel
   !CHECK: %[[allocator_1:.*]] = arith.constant 4 : i64
   !CHECK: omp.sections allocate(%[[allocator_1]] : i64 -> %{{.*}} : !fir.ref<i32>) {
   !$omp parallel sections allocate(omp_high_bw_mem_alloc: x) private(x, y)



More information about the flang-commits mailing list