[v3,00/11] OpenMP 5.0: Struct & mapping clause expansion rework

Message ID cover.1663101299.git.julian@codesourcery.com
Headers
Series OpenMP 5.0: Struct & mapping clause expansion rework |

Message

Julian Brown Sept. 13, 2022, 9:01 p.m. UTC
  This is a new version of the first few patches of the series (up to
"Handle reference-typed struct members"):

  https://gcc.gnu.org/pipermail/gcc-patches/2022-March/591973.html

Relative to the previously-posted series, this version addresses
several review comments, but more significantly it largely reworks how
OpenMP/OpenACC mapping clause expansion works in the C and C++ front
ends and in gimplify.cc, following discovery of some quite serious
shortcomings in the existing & previous support for same. (For the new
"baseptrs-4.C" test, approximately 135 out of 274 tests failed.)

Revisions/rework have been completed up to the 8th patch in the series.
The remaining patches address some previous review comments and are
included to support the direction of the first eight patches, but are
not ready for full re-review yet.

Individual patches bootstrapped (except the "trivial" ones) and regression
tested with offloading to NVPTX (up to "OpenMP/OpenACC: Rework clause
expansion and nested struct handling").

Further commentary on individual patches.

Julian Brown (11):
  OpenMP 5.0: Clause ordering for OpenMP 5.0 (topological sorting by
    base pointer)
  Remove omp_target_reorder_clauses
  OpenMP/OpenACC struct sibling list gimplification extension and rework
  OpenMP/OpenACC: mapping group list-handling improvements
  OpenMP: push attaches to end of clause list in "target" regions
  OpenMP: Pointers and member mappings
  OpenMP/OpenACC: Reindent TO/FROM/_CACHE_ stanza in
    {c_}finish_omp_clause
  OpenMP/OpenACC: Rework clause expansion and nested struct handling
  FYI/unfinished: OpenMP: lvalue parsing for map clauses (C++)
  Use OMP_ARRAY_SECTION instead of TREE_LIST in C++ FE
  FYI/unfinished: OpenMP 5.0 "declare mapper" support for C++

 gcc/c-family/c-common.h                       |   68 +
 gcc/c-family/c-omp.cc                         |  780 +++-
 gcc/c/c-typeck.cc                             |  750 ++--
 gcc/cp/cp-gimplify.cc                         |    6 +
 gcc/cp/cp-objcp-common.h                      |    2 +
 gcc/cp/cp-tree.h                              |   10 +
 gcc/cp/decl.cc                                |   18 +-
 gcc/cp/error.cc                               |    9 +
 gcc/cp/mangle.cc                              |    5 +-
 gcc/cp/name-lookup.cc                         |    3 +-
 gcc/cp/parser.cc                              |  543 ++-
 gcc/cp/parser.h                               |    3 +
 gcc/cp/pt.cc                                  |  144 +-
 gcc/cp/semantics.cc                           | 1570 ++++---
 gcc/fortran/parse.cc                          |    3 +
 gcc/fortran/trans-openmp.cc                   |  160 +-
 gcc/gimplify.cc                               | 3702 +++++++++++++----
 gcc/langhooks-def.h                           |    3 +
 gcc/langhooks.cc                              |    9 +
 gcc/langhooks.h                               |    4 +
 gcc/omp-general.cc                            |  426 ++
 gcc/omp-general.h                             |  109 +
 gcc/omp-low.cc                                |   26 +-
 gcc/testsuite/c-c++-common/goacc/mdc-2.c      |    2 +
 gcc/testsuite/c-c++-common/gomp/clauses-2.c   |    2 +-
 gcc/testsuite/c-c++-common/gomp/map-6.c       |   10 +-
 gcc/testsuite/c-c++-common/gomp/target-50.c   |   23 +
 .../c-c++-common/gomp/target-implicit-map-2.c |    2 +-
 gcc/testsuite/g++.dg/goacc/mdc.C              |    2 +
 gcc/testsuite/g++.dg/goacc/member-array-acc.C |   13 +
 gcc/testsuite/g++.dg/gomp/declare-mapper-1.C  |   58 +
 gcc/testsuite/g++.dg/gomp/declare-mapper-2.C  |   30 +
 gcc/testsuite/g++.dg/gomp/declare-mapper-3.C  |   27 +
 gcc/testsuite/g++.dg/gomp/declare-mapper-4.C  |   74 +
 gcc/testsuite/g++.dg/gomp/ind-base-3.C        |   37 +
 gcc/testsuite/g++.dg/gomp/map-assignment-1.C  |   12 +
 gcc/testsuite/g++.dg/gomp/map-inc-1.C         |   10 +
 gcc/testsuite/g++.dg/gomp/map-lvalue-ref-1.C  |   19 +
 gcc/testsuite/g++.dg/gomp/map-ptrmem-1.C      |   37 +
 gcc/testsuite/g++.dg/gomp/map-ptrmem-2.C      |   40 +
 .../g++.dg/gomp/map-static-cast-lvalue-1.C    |   17 +
 gcc/testsuite/g++.dg/gomp/map-ternary-1.C     |   20 +
 gcc/testsuite/g++.dg/gomp/member-array-2.C    |   91 +
 gcc/testsuite/g++.dg/gomp/member-array-omp.C  |   13 +
 gcc/testsuite/g++.dg/gomp/pr67522.C           |    2 +-
 .../g++.dg/gomp/static-component-1.C          |   23 +
 gcc/testsuite/g++.dg/gomp/target-3.C          |    4 +-
 gcc/testsuite/g++.dg/gomp/target-lambda-1.C   |    6 +-
 gcc/testsuite/g++.dg/gomp/target-this-2.C     |    2 +-
 gcc/testsuite/g++.dg/gomp/target-this-3.C     |    4 +-
 gcc/testsuite/g++.dg/gomp/target-this-4.C     |    4 +-
 gcc/testsuite/gcc.dg/gomp/target-3.c          |    2 +-
 gcc/tree-core.h                               |    4 +
 gcc/tree-pretty-print.cc                      |   56 +
 gcc/tree.cc                                   |    2 +
 gcc/tree.def                                  |   10 +
 gcc/tree.h                                    |   25 +
 include/gomp-constants.h                      |    8 +-
 libgomp/target.c                              |   31 +-
 libgomp/testsuite/libgomp.c++/baseptrs-3.C    |  275 ++
 libgomp/testsuite/libgomp.c++/baseptrs-4.C    | 3148 ++++++++++++++
 libgomp/testsuite/libgomp.c++/baseptrs-5.C    |   62 +
 libgomp/testsuite/libgomp.c++/class-array-1.C |   59 +
 .../testsuite/libgomp.c++/declare-mapper-1.C  |   87 +
 .../testsuite/libgomp.c++/declare-mapper-2.C  |   55 +
 .../testsuite/libgomp.c++/declare-mapper-3.C  |   63 +
 .../testsuite/libgomp.c++/declare-mapper-4.C  |   63 +
 .../testsuite/libgomp.c++/declare-mapper-5.C  |   52 +
 .../testsuite/libgomp.c++/declare-mapper-6.C  |   37 +
 .../testsuite/libgomp.c++/declare-mapper-7.C  |   48 +
 .../testsuite/libgomp.c++/declare-mapper-8.C  |   61 +
 libgomp/testsuite/libgomp.c++/ind-base-1.C    |  162 +
 libgomp/testsuite/libgomp.c++/ind-base-2.C    |   49 +
 libgomp/testsuite/libgomp.c++/map-comma-1.C   |   15 +
 .../testsuite/libgomp.c++/map-rvalue-ref-1.C  |   22 +
 libgomp/testsuite/libgomp.c++/struct-ref-1.C  |   97 +
 libgomp/testsuite/libgomp.c++/target-48.C     |   32 +
 libgomp/testsuite/libgomp.c++/target-49.C     |   37 +
 .../libgomp.c-c++-common/array-field-1.c      |   35 +
 .../libgomp.c-c++-common/array-of-struct-1.c  |   65 +
 .../libgomp.c-c++-common/array-of-struct-2.c  |   65 +
 .../libgomp.c-c++-common/baseptrs-1.c         |   50 +
 .../libgomp.c-c++-common/baseptrs-2.c         |   70 +
 libgomp/testsuite/libgomp.c/target-22.c       |    3 +-
 .../libgomp.fortran/map-subarray.f90          |   33 +
 .../libgomp.fortran/map-subcomponents.f90     |   32 +
 .../libgomp.fortran/struct-elem-map-1.f90     |   10 +-
 .../testsuite/libgomp.oacc-c++/deep-copy-17.C |  101 +
 .../libgomp.oacc-c-c++-common/deep-copy-15.c  |   68 +
 .../libgomp.oacc-c-c++-common/deep-copy-16.c  |  231 +
 .../deep-copy-arrayofstruct.c                 |    2 +-
 91 files changed, 12350 insertions(+), 1914 deletions(-)
 create mode 100644 gcc/testsuite/c-c++-common/gomp/target-50.c
 create mode 100644 gcc/testsuite/g++.dg/goacc/member-array-acc.C
 create mode 100644 gcc/testsuite/g++.dg/gomp/declare-mapper-1.C
 create mode 100644 gcc/testsuite/g++.dg/gomp/declare-mapper-2.C
 create mode 100644 gcc/testsuite/g++.dg/gomp/declare-mapper-3.C
 create mode 100644 gcc/testsuite/g++.dg/gomp/declare-mapper-4.C
 create mode 100644 gcc/testsuite/g++.dg/gomp/ind-base-3.C
 create mode 100644 gcc/testsuite/g++.dg/gomp/map-assignment-1.C
 create mode 100644 gcc/testsuite/g++.dg/gomp/map-inc-1.C
 create mode 100644 gcc/testsuite/g++.dg/gomp/map-lvalue-ref-1.C
 create mode 100644 gcc/testsuite/g++.dg/gomp/map-ptrmem-1.C
 create mode 100644 gcc/testsuite/g++.dg/gomp/map-ptrmem-2.C
 create mode 100644 gcc/testsuite/g++.dg/gomp/map-static-cast-lvalue-1.C
 create mode 100644 gcc/testsuite/g++.dg/gomp/map-ternary-1.C
 create mode 100644 gcc/testsuite/g++.dg/gomp/member-array-2.C
 create mode 100644 gcc/testsuite/g++.dg/gomp/member-array-omp.C
 create mode 100644 gcc/testsuite/g++.dg/gomp/static-component-1.C
 create mode 100644 libgomp/testsuite/libgomp.c++/baseptrs-3.C
 create mode 100644 libgomp/testsuite/libgomp.c++/baseptrs-4.C
 create mode 100644 libgomp/testsuite/libgomp.c++/baseptrs-5.C
 create mode 100644 libgomp/testsuite/libgomp.c++/class-array-1.C
 create mode 100644 libgomp/testsuite/libgomp.c++/declare-mapper-1.C
 create mode 100644 libgomp/testsuite/libgomp.c++/declare-mapper-2.C
 create mode 100644 libgomp/testsuite/libgomp.c++/declare-mapper-3.C
 create mode 100644 libgomp/testsuite/libgomp.c++/declare-mapper-4.C
 create mode 100644 libgomp/testsuite/libgomp.c++/declare-mapper-5.C
 create mode 100644 libgomp/testsuite/libgomp.c++/declare-mapper-6.C
 create mode 100644 libgomp/testsuite/libgomp.c++/declare-mapper-7.C
 create mode 100644 libgomp/testsuite/libgomp.c++/declare-mapper-8.C
 create mode 100644 libgomp/testsuite/libgomp.c++/ind-base-1.C
 create mode 100644 libgomp/testsuite/libgomp.c++/ind-base-2.C
 create mode 100644 libgomp/testsuite/libgomp.c++/map-comma-1.C
 create mode 100644 libgomp/testsuite/libgomp.c++/map-rvalue-ref-1.C
 create mode 100644 libgomp/testsuite/libgomp.c++/struct-ref-1.C
 create mode 100644 libgomp/testsuite/libgomp.c++/target-48.C
 create mode 100644 libgomp/testsuite/libgomp.c++/target-49.C
 create mode 100644 libgomp/testsuite/libgomp.c-c++-common/array-field-1.c
 create mode 100644 libgomp/testsuite/libgomp.c-c++-common/array-of-struct-1.c
 create mode 100644 libgomp/testsuite/libgomp.c-c++-common/array-of-struct-2.c
 create mode 100644 libgomp/testsuite/libgomp.c-c++-common/baseptrs-1.c
 create mode 100644 libgomp/testsuite/libgomp.c-c++-common/baseptrs-2.c
 create mode 100644 libgomp/testsuite/libgomp.fortran/map-subarray.f90
 create mode 100644 libgomp/testsuite/libgomp.fortran/map-subcomponents.f90
 create mode 100644 libgomp/testsuite/libgomp.oacc-c++/deep-copy-17.C
 create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-15.c
 create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-16.c
 rename {gcc/testsuite/c-c++-common/goacc => libgomp/testsuite/libgomp.oacc-c-c++-common}/deep-copy-arrayofstruct.c (98%)