diff options
author | Jakub Jelinek <jakub@redhat.com> | 2020-08-13 09:06:05 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2020-08-13 09:06:05 +0200 |
commit | 2e47c8c6eac405ceb599bf5e31ac3717c22a008c (patch) | |
tree | 6b548e09bcebf00f74983be40030d2acc78db3ac /gcc/omp-expand.c | |
parent | 7123217afb33d4a2860f552ad778a819cc8dea5e (diff) | |
download | gcc-2e47c8c6eac405ceb599bf5e31ac3717c22a008c.zip gcc-2e47c8c6eac405ceb599bf5e31ac3717c22a008c.tar.gz gcc-2e47c8c6eac405ceb599bf5e31ac3717c22a008c.tar.bz2 |
openmp: Add support for non-rectangular loops in taskloop construct
2020-08-13 Jakub Jelinek <jakub@redhat.com>
* gimplify.c (gimplify_omp_taskloop_expr): New function.
(gimplify_omp_for): Use it. For OMP_FOR_NON_RECTANGULAR
loops adjust in outer taskloop the var-outer decls.
* omp-expand.c (expand_omp_taskloop_for_inner): Handle non-rectangular
loops.
(expand_omp_for): Don't reject non-rectangular taskloop.
* omp-general.c (omp_extract_for_data): Don't assert that
non-rectangular loops have static schedule, instead treat loop->m1
or loop->m2 as if loop->n1 or loop->n2 is non-constant.
* testsuite/libgomp.c/loop-22.c (main): Add some further tests.
* testsuite/libgomp.c/loop-23.c (main): Likewise.
* testsuite/libgomp.c/loop-24.c: New test.
Diffstat (limited to 'gcc/omp-expand.c')
-rw-r--r-- | gcc/omp-expand.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/gcc/omp-expand.c b/gcc/omp-expand.c index eb37b38..8f1286e 100644 --- a/gcc/omp-expand.c +++ b/gcc/omp-expand.c @@ -6917,8 +6917,20 @@ expand_omp_taskloop_for_inner (struct omp_region *region, assign_stmt = gimple_build_assign (fd->loop.v, NOP_EXPR, e); gsi_insert_after (&gsi, assign_stmt, GSI_CONTINUE_LINKING); } + + tree *nonrect_bounds = NULL; if (fd->collapse > 1) - expand_omp_for_init_vars (fd, &gsi, counts, NULL, inner_stmt, startvar); + { + if (fd->non_rect) + { + nonrect_bounds = XALLOCAVEC (tree, fd->last_nonrect + 1); + memset (nonrect_bounds, 0, sizeof (tree) * (fd->last_nonrect + 1)); + } + gcc_assert (gsi_bb (gsi) == entry_bb); + expand_omp_for_init_vars (fd, &gsi, counts, nonrect_bounds, inner_stmt, + startvar); + entry_bb = gsi_bb (gsi); + } if (!broken_loop) { @@ -6953,7 +6965,8 @@ expand_omp_taskloop_for_inner (struct omp_region *region, gsi_remove (&gsi, true); if (fd->collapse > 1 && !gimple_omp_for_combined_p (fd->for_stmt)) - collapse_bb = extract_omp_for_update_vars (fd, NULL, cont_bb, body_bb); + collapse_bb = extract_omp_for_update_vars (fd, nonrect_bounds, + cont_bb, body_bb); } /* Remove the GIMPLE_OMP_FOR statement. */ @@ -7643,9 +7656,6 @@ expand_omp_for (struct omp_region *region, gimple *inner_stmt) } else if (gimple_omp_for_kind (fd.for_stmt) == GF_OMP_FOR_KIND_TASKLOOP) { - if (fd.non_rect) - sorry_at (gimple_location (fd.for_stmt), - "non-rectangular %<taskloop%> not supported yet"); if (gimple_omp_for_combined_into_p (fd.for_stmt)) expand_omp_taskloop_for_inner (region, &fd, inner_stmt); else |