diff options
author | Tom de Vries <tom@codesourcery.com> | 2015-09-03 11:00:56 +0000 |
---|---|---|
committer | Tom de Vries <vries@gcc.gnu.org> | 2015-09-03 11:00:56 +0000 |
commit | 8cba6b95273ad9d736c977f430fe97638beb8b94 (patch) | |
tree | 0bb96e9029a21ab6591031dd9105fa23c12c3526 | |
parent | f7f186847d9a170f1f1926e77cc4f00c7ca0b92b (diff) | |
download | gcc-8cba6b95273ad9d736c977f430fe97638beb8b94.zip gcc-8cba6b95273ad9d736c977f430fe97638beb8b94.tar.gz gcc-8cba6b95273ad9d736c977f430fe97638beb8b94.tar.bz2 |
Handle simple latch bb in expand_omp_for_static_chunk
2015-09-03 Tom de Vries <tom@codesourcery.com>
* omp-low.c (expand_omp_for_static_chunk): Handle simple latch bb.
From-SVN: r227435
-rw-r--r-- | gcc/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/omp-low.c | 20 |
2 files changed, 22 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1d0f7a3..86317e3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2015-09-03 Tom de Vries <tom@codesourcery.com> + * omp-low.c (expand_omp_for_static_chunk): Handle simple latch bb. + +2015-09-03 Tom de Vries <tom@codesourcery.com> + * doc/invoke.texi (parloops-chunk-size): Add item. * params.def (PARAM_PARLOOPS_CHUNK_SIZE): Add DEFPARAM. * tree-parloops.c: Include params.h. diff --git a/gcc/omp-low.c b/gcc/omp-low.c index aa2a598..16d1922 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -6960,7 +6960,8 @@ expand_omp_for_static_chunk (struct omp_region *region, body_bb = single_succ (seq_start_bb); if (!broken_loop) { - gcc_assert (BRANCH_EDGE (cont_bb)->dest == body_bb); + gcc_assert (BRANCH_EDGE (cont_bb)->dest == body_bb + || single_succ (BRANCH_EDGE (cont_bb)->dest) == body_bb); gcc_assert (EDGE_COUNT (cont_bb->succs) == 2); trip_update_bb = split_edge (FALLTHRU_EDGE (cont_bb)); } @@ -7261,6 +7262,11 @@ expand_omp_for_static_chunk (struct omp_region *region, if (!broken_loop) { se = find_edge (cont_bb, body_bb); + if (se == NULL) + { + se = BRANCH_EDGE (cont_bb); + gcc_assert (single_succ (se->dest) == body_bb); + } if (gimple_omp_for_combined_p (fd->for_stmt)) { remove_edge (se); @@ -7351,14 +7357,24 @@ expand_omp_for_static_chunk (struct omp_region *region, if (!broken_loop) { + struct loop *loop = body_bb->loop_father; struct loop *trip_loop = alloc_loop (); trip_loop->header = iter_part_bb; trip_loop->latch = trip_update_bb; add_loop (trip_loop, iter_part_bb->loop_father); + if (loop != entry_bb->loop_father) + { + gcc_assert (loop->header == body_bb); + gcc_assert (loop->latch == region->cont + || single_pred (loop->latch) == region->cont); + trip_loop->inner = loop; + return; + } + if (!gimple_omp_for_combined_p (fd->for_stmt)) { - struct loop *loop = alloc_loop (); + loop = alloc_loop (); loop->header = body_bb; if (collapse_bb == NULL) loop->latch = cont_bb; |