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
This commit is contained in:
Tom de Vries 2015-09-03 11:00:56 +00:00 committed by Tom de Vries
parent f7f186847d
commit 8cba6b9527
2 changed files with 22 additions and 2 deletions

View file

@ -1,3 +1,7 @@
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.

View file

@ -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;