From 8cba6b95273ad9d736c977f430fe97638beb8b94 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Thu, 3 Sep 2015 11:00:56 +0000 Subject: [PATCH] Handle simple latch bb in expand_omp_for_static_chunk 2015-09-03 Tom de Vries * omp-low.c (expand_omp_for_static_chunk): Handle simple latch bb. From-SVN: r227435 --- gcc/ChangeLog | 4 ++++ gcc/omp-low.c | 20 ++++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1d0f7a3fa6a..86317e3e165 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2015-09-03 Tom de Vries + + * omp-low.c (expand_omp_for_static_chunk): Handle simple latch bb. + 2015-09-03 Tom de Vries * doc/invoke.texi (parloops-chunk-size): Add item. diff --git a/gcc/omp-low.c b/gcc/omp-low.c index aa2a598238d..16d19220192 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; -- 2.30.2