Skip to content

Commit 1539da4

Browse files
authored
[flang][OpenMP] Add --openmp-enable-delayed-privatization-staging flag (#94749)
1 parent b01ac51 commit 1539da4

File tree

6 files changed

+14
-7
lines changed

6 files changed

+14
-7
lines changed

flang/lib/Lower/OpenMP/OpenMP.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1114,7 +1114,7 @@ static void genTargetClauses(
11141114
llvm::omp::Directive::OMPD_target);
11151115

11161116
// `target private(..)` is only supported in delayed privatization mode.
1117-
if (!enableDelayedPrivatization)
1117+
if (!enableDelayedPrivatizationStaging)
11181118
cp.processTODO<clause::Private>(loc, llvm::omp::Directive::OMPD_target);
11191119
}
11201120

flang/lib/Lower/OpenMP/Utils.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ llvm::cl::opt<bool> enableDelayedPrivatization(
3636
"Emit `[first]private` variables as clauses on the MLIR ops."),
3737
llvm::cl::init(false));
3838

39+
llvm::cl::opt<bool> enableDelayedPrivatizationStaging(
40+
"openmp-enable-delayed-privatization-staging",
41+
llvm::cl::desc("For partially supported constructs, emit `[first]private` "
42+
"variables as clauses on the MLIR ops."),
43+
llvm::cl::init(false));
44+
3945
namespace Fortran {
4046
namespace lower {
4147
namespace omp {

flang/lib/Lower/OpenMP/Utils.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
extern llvm::cl::opt<bool> treatIndexAsSection;
1919
extern llvm::cl::opt<bool> enableDelayedPrivatization;
20+
extern llvm::cl::opt<bool> enableDelayedPrivatizationStaging;
2021

2122
namespace fir {
2223
class FirOpBuilder;

flang/test/Lower/OpenMP/DelayedPrivatization/target-private-allocatable.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
! Tests delayed privatization for `targets ... private(..)` for allocatables.
22

3-
! RUN: %flang_fc1 -emit-hlfir -fopenmp -mmlir --openmp-enable-delayed-privatization \
3+
! RUN: %flang_fc1 -emit-hlfir -fopenmp -mmlir --openmp-enable-delayed-privatization-staging \
44
! RUN: -o - %s 2>&1 | FileCheck %s
5-
! RUN: bbc -emit-hlfir -fopenmp --openmp-enable-delayed-privatization -o - %s 2>&1 \
5+
! RUN: bbc -emit-hlfir -fopenmp --openmp-enable-delayed-privatization-staging -o - %s 2>&1 \
66
! RUN: | FileCheck %s
77

88
subroutine target_allocatable

flang/test/Lower/OpenMP/DelayedPrivatization/target-private-multiple-variables.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
! Tests delayed privatization for `targets ... private(..)` for allocatables.
22

3-
! RUN: %flang_fc1 -emit-hlfir -fopenmp -mmlir --openmp-enable-delayed-privatization \
3+
! RUN: %flang_fc1 -emit-hlfir -fopenmp -mmlir --openmp-enable-delayed-privatization-staging \
44
! RUN: -o - %s 2>&1 | FileCheck %s
5-
! RUN: bbc -emit-hlfir -fopenmp --openmp-enable-delayed-privatization -o - %s 2>&1 \
5+
! RUN: bbc -emit-hlfir -fopenmp --openmp-enable-delayed-privatization-staging -o - %s 2>&1 \
66
! RUN: | FileCheck %s
77

88
subroutine target_allocatable(lb, ub, l)

flang/test/Lower/OpenMP/DelayedPrivatization/target-private-simple.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
! Tests delayed privatization for `targets ... private(..)` for simple variables.
22

3-
! RUN: %flang_fc1 -emit-hlfir -fopenmp -mmlir --openmp-enable-delayed-privatization \
3+
! RUN: %flang_fc1 -emit-hlfir -fopenmp -mmlir --openmp-enable-delayed-privatization-staging \
44
! RUN: -o - %s 2>&1 | FileCheck %s
5-
! RUN: bbc -emit-hlfir -fopenmp --openmp-enable-delayed-privatization -o - %s 2>&1 \
5+
! RUN: bbc -emit-hlfir -fopenmp --openmp-enable-delayed-privatization-staging -o - %s 2>&1 \
66
! RUN: | FileCheck %s
77

88
subroutine target_simple

0 commit comments

Comments
 (0)