Skip to content

Commit 3c23d1f

Browse files
committed
[flang][OpenMP] Enable delayed privatization for omp parallel by default
Flips the delayed privatization switch to be on by default. After the recent fixes related to delayed privatization, the gfortran test suite runs successfully with delayed privatization turned on by defuault for `omp parallel`.
1 parent c905db6 commit 3c23d1f

20 files changed

+70
-25
lines changed

flang/lib/Lower/OpenMP/OpenMP.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2143,7 +2143,7 @@ static void genOMPDispatch(lower::AbstractConverter &converter,
21432143
symTable.pushScope();
21442144
loopDsp.emplace(converter, semaCtx, item->clauses, eval,
21452145
/*shouldCollectPreDeterminedSymbols=*/true,
2146-
enableDelayedPrivatization, &symTable);
2146+
/*useDelayedPrivatization=*/false, &symTable);
21472147
loopDsp->processStep1();
21482148
}
21492149

flang/lib/Lower/OpenMP/Utils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ llvm::cl::opt<bool> enableDelayedPrivatization(
3434
"openmp-enable-delayed-privatization",
3535
llvm::cl::desc(
3636
"Emit `[first]private` variables as clauses on the MLIR ops."),
37-
llvm::cl::init(false));
37+
llvm::cl::init(true));
3838

3939
llvm::cl::opt<bool> enableDelayedPrivatizationStaging(
4040
"openmp-enable-delayed-privatization-staging",

flang/test/Integration/OpenMP/copyprivate.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
!CHECK-NEXT: }
3434

3535
!CHECK-LABEL: define internal void @test_scalar_..omp_par({{.*}})
36-
!CHECK: %[[J:.*]] = alloca i32, i64 1
3736
!CHECK: %[[I:.*]] = alloca i32, i64 1
37+
!CHECK: %[[J:.*]] = alloca i32, i64 1
3838
!CHECK: %[[DID_IT:.*]] = alloca i32
3939
!CHECK: store i32 0, ptr %[[DID_IT]]
4040
!CHECK: %[[THREAD_NUM1:.*]] = call i32 @__kmpc_global_thread_num(ptr @[[LOC:.*]])

flang/test/Lower/OpenMP/Todo/omp-default-clause-inner-loop.f90

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
! This test checks the lowering of parallel do
22

3-
! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s
4-
! RUN: bbc -fopenmp -emit-fir -hlfir=false %s -o - | FileCheck %s
3+
! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp \
4+
! RUN: -mmlir --openmp-enable-delayed-privatization=false %s -o - \
5+
! RUN: | FileCheck %s
6+
7+
! RUN: bbc -fopenmp -emit-fir -hlfir=false \
8+
! RUN: --openmp-enable-delayed-privatization=false %s -o - \
9+
! RUN: | FileCheck %s
510

611
! The string "EXPECTED" denotes the expected FIR
712

flang/test/Lower/OpenMP/copyprivate.f90

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
! Test COPYPRIVATE.
2-
! RUN: %flang_fc1 -emit-hlfir -fopenmp -o - %s 2>&1 | FileCheck %s
2+
! RUN: %flang_fc1 -emit-hlfir -fopenmp \
3+
! RUN: -mmlir --openmp-enable-delayed-privatization=false -o - %s 2>&1 \
4+
! RUN: | FileCheck %s
35

46
!CHECK-DAG: func private @_copy_i64(%{{.*}}: !fir.ref<i64>, %{{.*}}: !fir.ref<i64>)
57
!CHECK-DAG: func private @_copy_f32(%{{.*}}: !fir.ref<f32>, %{{.*}}: !fir.ref<f32>)

flang/test/Lower/OpenMP/copyprivate2.f90

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
! Test lowering of COPYPRIVATE with allocatable/pointer variables.
2-
! RUN: %flang_fc1 -emit-hlfir -fopenmp -o - %s 2>&1 | FileCheck %s
2+
! RUN: %flang_fc1 -emit-hlfir -fopenmp \
3+
! RUN: -mmlir --openmp-enable-delayed-privatization=false \
4+
! RUN: -o - %s 2>&1 | FileCheck %s
35

46
!CHECK-LABEL: func private @_copy_box_ptr_i32(
57
!CHECK-SAME: %[[ARG0:.*]]: !fir.ref<!fir.box<!fir.ptr<i32>>>,

flang/test/Lower/OpenMP/critical.f90

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
! REQUIRES: openmp_runtime
22

3-
!RUN: %flang_fc1 -emit-hlfir %openmp_flags %s -o - | FileCheck %s
3+
!RUN: %flang_fc1 -emit-hlfir \
4+
!RUN: -mmlir --openmp-enable-delayed-privatization=false \
5+
!RUN: %openmp_flags %s -o - | FileCheck %s
46

57
!CHECK: omp.critical.declare @help2
68
!CHECK: omp.critical.declare @help1 hint(contended)

flang/test/Lower/OpenMP/default-clause-byref.f90

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
! This test checks lowering of OpenMP parallel directive
22
! with `DEFAULT` clause present.
33

4-
! RUN: %flang_fc1 -emit-hlfir -fopenmp -mmlir --force-byref-reduction %s -o - | FileCheck %s
5-
! RUN: bbc -fopenmp -emit-hlfir --force-byref-reduction %s -o - | FileCheck %s
4+
! RUN: %flang_fc1 -emit-hlfir -fopenmp -mmlir --force-byref-reduction \
5+
! RUN: -mmlir --openmp-enable-delayed-privatization=false %s -o - \
6+
! RUN: | FileCheck %s
7+
8+
! RUN: bbc -fopenmp -emit-hlfir --force-byref-reduction \
9+
! RUN: --openmp-enable-delayed-privatization=false %s -o - \
10+
! RUN: | FileCheck %s
611

712

813
!CHECK: func @_QQmain() attributes {fir.bindc_name = "default_clause_lowering"} {

flang/test/Lower/OpenMP/default-clause.f90

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
! This test checks lowering of OpenMP parallel directive
22
! with `DEFAULT` clause present.
33

4-
! RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
5-
! RUN: bbc -fopenmp -emit-hlfir %s -o - | FileCheck %s
4+
! RUN: %flang_fc1 -emit-hlfir -fopenmp \
5+
! RUN: -mmlir --openmp-enable-delayed-privatization=false %s -o - \
6+
! RUN: | FileCheck %s
7+
8+
! RUN: bbc -fopenmp -emit-hlfir \
9+
! RUN: --openmp-enable-delayed-privatization=false %s -o - \
10+
! RUN: | FileCheck %s
611

712

813
!CHECK: func @_QQmain() attributes {fir.bindc_name = "default_clause_lowering"} {

flang/test/Lower/OpenMP/firstprivate-commonblock.f90

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
! RUN: %flang_fc1 -emit-hlfir -fopenmp -o - %s 2>&1 | FileCheck %s
1+
! RUN: %flang_fc1 -emit-hlfir -fopenmp \
2+
! RUN: -mmlir --openmp-enable-delayed-privatization=false -o - %s 2>&1 \
3+
! RUN: | FileCheck %s
24

35
!CHECK: func.func @_QPfirstprivate_common() {
46
!CHECK: %[[val_0:.*]] = fir.address_of(@c_) : !fir.ref<!fir.array<8xi8>>

0 commit comments

Comments
 (0)