]> git.ipfire.org Git - thirdparty/gcc.git/commit - gcc/omp-expand.c
openmp: Non-rectangular loop support for non-composite worksharing loops and distribute
authorJakub Jelinek <jakub@redhat.com>
Sat, 27 Jun 2020 10:43:36 +0000 (12:43 +0200)
committerJakub Jelinek <jakub@redhat.com>
Sat, 27 Jun 2020 10:43:36 +0000 (12:43 +0200)
commitaed3ab253dada2b7d2ed63cc6a8e15e263d5dd35
tree3fd34073f92ce78c1c3031fee739b8b0d0aa7f75
parent37995960984ea2222346dd9d168d332cd6f7adf0
openmp: Non-rectangular loop support for non-composite worksharing loops and distribute

This implements the fallback mentioned in
https://gcc.gnu.org/pipermail/gcc/2020-June/232874.html
Special cases for triangular loops etc. to follow later, also composite
constructs not supported yet (need to check the passing of temporaries around)
and lastprivate might not give the same answers as serial loop if the last
innermost body iteration isn't the last one for some of the outer loops
(that will need to be solved separately together with rectangular loops that have no
innermost body iterations, but some of the outer loops actually iterate).
Also, simd needs work.

2020-06-27  Jakub Jelinek  <jakub@redhat.com>

* omp-general.h (struct omp_for_data_loop): Add non_rect_referenced
member, move outer member.
(struct omp_for_data): Add first_nonrect and last_nonrect members.
* omp-general.c (omp_extract_for_data): Initialize first_nonrect,
last_nonrect and non_rect_referenced members.
* omp-expand.c (expand_omp_for_init_counts): Handle non-rectangular
loops.
(expand_omp_for_init_vars): Add nonrect_bounds parameter.  Handle
non-rectangular loops.
(extract_omp_for_update_vars): Likewise.
(expand_omp_for_generic, expand_omp_for_static_nochunk,
expand_omp_for_static_chunk, expand_omp_simd,
expand_omp_taskloop_for_outer, expand_omp_taskloop_for_inner): Adjust
expand_omp_for_init_vars and extract_omp_for_update_vars callers.
(expand_omp_for): Don't sorry on non-composite worksharing-loop or
distribute.

* testsuite/libgomp.c/loop-17.c: New test.
* testsuite/libgomp.c/loop-18.c: New test.
gcc/omp-expand.c
gcc/omp-general.c
gcc/omp-general.h
libgomp/testsuite/libgomp.c/loop-17.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c/loop-18.c [new file with mode: 0644]