]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fortran: Add support for OMP non-rectangular loops.
authorSandra Loosemore <sandra@codesourcery.com>
Thu, 5 May 2022 18:37:16 +0000 (11:37 -0700)
committerSandra Loosemore <sandra@codesourcery.com>
Thu, 5 May 2022 18:49:49 +0000 (11:49 -0700)
commit705bcedf6eae2d7c68bd3df2c98dad4f06650fde
treed3aa0681b4c9f2bf39db4ea1c4788e946022c210
parent982fd4cd765664d737eb4346a2d2400b6a74c4ec
Fortran: Add support for OMP non-rectangular loops.

This patch adds support for OMP 5.1 "canonical loop nest form" to the
Fortran front end, marks non-rectangular loops for processing
by the middle end, and implements missing checks in the gimplifier
for additional prohibitions on non-rectangular loops.

Note that the OMP spec also prohibits non-rectangular loops with the TILE
construct; that construct hasn't been implemented yet, so that error will
need to be filled in later.

gcc/fortran/
* gfortran.h (struct gfc_omp_clauses): Add non_rectangular bit.
* openmp.cc (is_outer_iteration_variable): New function.
(expr_is_invariant): New function.
(bound_expr_is_canonical): New function.
(resolve_omp_do): Replace existing non-rectangularity error with
check for canonical form and setting non_rectangular bit.
* trans-openmp.cc (gfc_trans_omp_do): Transfer non_rectangular
flag to generated tree structure.

gcc/
* gimplify.cc (gimplify_omp_for): Update messages for SCHEDULED
and ORDERED clause conflict errors.  Add check for GRAINSIZE and
NUM_TASKS on TASKLOOP.

gcc/testsuite/
* c-c++-common/gomp/loop-6.c (f3): New function to test TASKLOOP
diagnostics.
* gfortran.dg/gomp/collapse1.f90: Update expected messages.
* gfortran.dg/gomp/pr85313.f90: Remove dg-error on non-rectangular
loops that are now accepted.
* gfortran.dg/gomp/non-rectangular-loop.f90: New file.
* gfortran.dg/gomp/canonical-loop-1.f90: New file.
* gfortran.dg/gomp/canonical-loop-2.f90: New file.
gcc/fortran/gfortran.h
gcc/fortran/openmp.cc
gcc/fortran/trans-openmp.cc
gcc/gimplify.cc
gcc/testsuite/c-c++-common/gomp/loop-6.c
gcc/testsuite/gfortran.dg/gomp/canonical-loop-1.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/canonical-loop-2.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/collapse1.f90
gcc/testsuite/gfortran.dg/gomp/non-rectangular-loop.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/pr85313.f90