aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/config
diff options
context:
space:
mode:
authorSandra Loosemore <sandra@codesourcery.com>2023-08-24 17:35:01 +0000
committerSandra Loosemore <sandra@codesourcery.com>2023-08-25 19:42:51 +0000
commitb7c4a12a9df3170090a431fa4364b97b30b87752 (patch)
treeb3d1948a8d20f46c8b729110346688b9f76e161e /libgfortran/config
parent410df0843dbf08280813165bca72cfdaa21c8f23 (diff)
downloadgcc-b7c4a12a9df3170090a431fa4364b97b30b87752.zip
gcc-b7c4a12a9df3170090a431fa4364b97b30b87752.tar.gz
gcc-b7c4a12a9df3170090a431fa4364b97b30b87752.tar.bz2
OpenMP: Fortran support for imperfectly-nested loops
OpenMP 5.0 removed the restriction that multiple collapsed loops must be perfectly nested, allowing "intervening code" (including nested BLOCKs) before or after each nested loop. In GCC this code is moved into the inner loop body by the respective front ends. In the Fortran front end, most of the semantic processing happens during the translation phase, so the parse phase just collects the intervening statements, checks them for errors, and splices them around the loop body. gcc/fortran/ChangeLog * gfortran.h (struct gfc_namespace): Add omp_structured_block bit. * openmp.cc: Include omp-api.h. (resolve_omp_clauses): Consolidate inscan reduction clause conflict checking here. (find_nested_loop_in_chain): New. (find_nested_loop_in_block): New. (gfc_resolve_omp_do_blocks): Set omp_current_do_collapse properly. Handle imperfectly-nested loops when looking for nested omp scan. Refactor to move inscan reduction clause conflict checking to resolve_omp_clauses. (gfc_resolve_do_iterator): Handle imperfectly-nested loops. (struct icode_error_state): New. (icode_code_error_callback): New. (icode_expr_error_callback): New. (diagnose_intervening_code_errors_1): New. (diagnose_intervening_code_errors): New. (make_structured_block): New. (restructure_intervening_code): New. (is_outer_iteration_variable): Do not assume loops are perfectly nested. (check_nested_loop_in_chain): New. (check_nested_loop_in_block_state): New. (check_nested_loop_in_block_symbol): New. (check_nested_loop_in_block): New. (expr_uses_intervening_var): New. (is_intervening_var): New. (expr_is_invariant): Do not assume loops are perfectly nested. (resolve_omp_do): Handle imperfectly-nested loops. * trans-stmt.cc (gfc_trans_block_construct): Generate OMP_STRUCTURED_BLOCK if magic bit is set on block namespace. gcc/testsuite/ChangeLog * gfortran.dg/gomp/collapse1.f90: Adjust expected errors. * gfortran.dg/gomp/collapse2.f90: Likewise. * gfortran.dg/gomp/imperfect-gotos.f90: New. * gfortran.dg/gomp/imperfect-invalid-scope.f90: New. * gfortran.dg/gomp/imperfect1.f90: New. * gfortran.dg/gomp/imperfect2.f90: New. * gfortran.dg/gomp/imperfect3.f90: New. * gfortran.dg/gomp/imperfect4.f90: New. * gfortran.dg/gomp/imperfect5.f90: New. libgomp/ChangeLog * testsuite/libgomp.fortran/imperfect-destructor.f90: New. * testsuite/libgomp.fortran/imperfect1.f90: New. * testsuite/libgomp.fortran/imperfect2.f90: New. * testsuite/libgomp.fortran/imperfect3.f90: New. * testsuite/libgomp.fortran/imperfect4.f90: New. * testsuite/libgomp.fortran/target-imperfect1.f90: New. * testsuite/libgomp.fortran/target-imperfect2.f90: New. * testsuite/libgomp.fortran/target-imperfect3.f90: New. * testsuite/libgomp.fortran/target-imperfect4.f90: New.
Diffstat (limited to 'libgfortran/config')
0 files changed, 0 insertions, 0 deletions