]> gcc.gnu.org Git - gcc.git/commit
openmp: Add support for firstprivate and allocate clauses on scope construct
authorJakub Jelinek <jakub@redhat.com>
Tue, 5 Jul 2022 08:01:09 +0000 (10:01 +0200)
committerTobias Burnus <tobias@codesourcery.com>
Tue, 5 Jul 2022 08:01:20 +0000 (10:01 +0200)
commit0ca11d9d7fb02f96809eb79c5f9128a6701a6ff4
tree74ffa7d55cc01e514ccf001b16e25076f56960aa
parent5d894208cd5c36dd929f9324cf4166645d686f7e
openmp: Add support for firstprivate and allocate clauses on scope construct

OpenMP 5.2 adds support for firstprivate and allocate clauses on the scope
construct and this patch adds that support to GCC.
5.2 unfortunately (IMNSHO mistakenly) marked scope construct as worksharing,
which implies that it isn't possible to nest inside of it other scope,
worksharing loop, sections, explicit barriers, single etc. which would
make scope far less useful.  I'm not implementing that part, keeping the
5.1 behavior here, and will file an issue to revert that for OpenMP 6.0.
But, for firstprivate it keeps the restriction that is now implied from
worksharing construct that listed var can't be private in outer context,
where for reduction 5.1 had similar restriction explicit even for scope
and 5.2 has it implicitly through worksharing construct.

2022-05-31  Jakub Jelinek  <jakub@redhat.com>

gcc/
* omp-low.cc (build_outer_var_ref): For code == OMP_CLAUSE_ALLOCATE
allow var to be private in the outer context.
(lower_private_allocate): Pass OMP_CLAUSE_ALLOCATE as last argument
to build_outer_var_ref.
gcc/c/
* c-parser.cc (OMP_SCOPE_CLAUSE_MASK): Add firstprivate and allocate
clauses.
gcc/cp/
* parser.cc (OMP_SCOPE_CLAUSE_MASK): Add firstprivate and allocate
clauses.
gcc/testsuite/
* c-c++-common/gomp/scope-5.c: New test.
* c-c++-common/gomp/scope-6.c: New test.
* g++.dg/gomp/attrs-1.C (bar): Add firstprivate and allocate clauses
to scope construct.
* g++.dg/gomp/attrs-2.C (bar): Likewise.
libgomp/
* testsuite/libgomp.c-c++-common/allocate-1.c (foo): Add testcase for
scope construct with allocate clause.
* testsuite/libgomp.c-c++-common/allocate-3.c (foo): Likewise.
* testsuite/libgomp.c-c++-common/scope-2.c: New test.

(cherry picked from commit f38b20d68fade5a922b9f68c4c3841e653d1b83c)
15 files changed:
gcc/ChangeLog.omp
gcc/c/ChangeLog.omp
gcc/c/c-parser.cc
gcc/cp/ChangeLog.omp
gcc/cp/parser.cc
gcc/omp-low.cc
gcc/testsuite/ChangeLog.omp
gcc/testsuite/c-c++-common/gomp/scope-5.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/gomp/scope-6.c [new file with mode: 0644]
gcc/testsuite/g++.dg/gomp/attrs-1.C
gcc/testsuite/g++.dg/gomp/attrs-2.C
libgomp/ChangeLog.omp
libgomp/testsuite/libgomp.c-c++-common/allocate-1.c
libgomp/testsuite/libgomp.c-c++-common/allocate-3.c
libgomp/testsuite/libgomp.c-c++-common/scope-2.c [new file with mode: 0644]
This page took 0.066261 seconds and 6 git commands to generate.