]> git.ipfire.org Git - thirdparty/gcc.git/commit
nested, openmp: Wrap OMP_CLAUSE_*_GIMPLE_SEQ into GIMPLE_BIND for declare_vars [PR108435]
authorJakub Jelinek <jakub@redhat.com>
Thu, 2 Feb 2023 09:06:22 +0000 (10:06 +0100)
committerTobias Burnus <tobias@codesourcery.com>
Thu, 2 Feb 2023 09:06:22 +0000 (10:06 +0100)
commit60524fd9069860a03182d9472863e1c5915db49c
tree792c4934c053b1031c9d1565d2f4288d28886931
parent251c9fdb3bb59c2603b5db526eda1828badd768c
nested, openmp: Wrap OMP_CLAUSE_*_GIMPLE_SEQ into GIMPLE_BIND for declare_vars [PR108435]

When gimplifying OMP_CLAUSE_{LASTPRIVATE,LINEAR}_STMT, we wrap it always
into a GIMPLE_BIND, but when putting statements directly into
OMP_CLAUSE_{LASTPRIVATE,LINEAR}_GIMPLE_SEQ, we do it only if needed (there
are any temporaries that need to be declared in the sequence).
convert_nonlocal_omp_clauses was relying on the GIMPLE_BIND to be there always
because it called declare_vars on it.

The following patch wraps it into GIMPLE_BIND in tree-nested if we need to
declare_vars on it on demand.

2023-02-02  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/108435
* tree-nested.cc (convert_nonlocal_omp_clauses)
<case OMP_CLAUSE_LASTPRIVATE>: If info->new_local_var_chain and *seq
is not a GIMPLE_BIND, wrap the sequence into a new GIMPLE_BIND
before calling declare_vars.
(convert_nonlocal_omp_clauses) <case OMP_CLAUSE_LINEAR>: Merge
with the OMP_CLAUSE_LASTPRIVATE handling except for whether
seq is initialized to &OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (clause)
or &OMP_CLAUSE_LINEAR_GIMPLE_SEQ (clause).

* gcc.dg/gomp/pr108435.c: New test.

(cherry picked from commit 0f349928e16fdc7dba52561e8d40347909f9f0ff)
gcc/ChangeLog.omp
gcc/testsuite/ChangeLog.omp
gcc/testsuite/gcc.dg/gomp/pr108435.c [new file with mode: 0644]
gcc/tree-nested.cc