Hi,
This is (hopefully) a permanent fix to pr46886.c
I removed the condition preventing parallelization of do_while loops, as
it
was blocking parallelizing important loops in spec-2006.
The patch fixes the number of iterations for cases where the body could
appear in the latch, as in pr46886.c.
2012-03-26 Razya Ladelsky <[email protected]>
PR tree-optimization/46886
* tree-parloops.c (transform_to_exit_first_loop):Set
number of iterations correctly when the body may appear at the latch.
(pallelize_loops): Remove the condition preventing
do-while loops.
Bootstrap and testsuite psss successfully on power7 linux machine.
Ok to commit?
Thanks,
Index: tree-parloops.c
===================================================================
--- tree-parloops.c (revision 185775)
+++ tree-parloops.c (working copy)
@@ -1522,7 +1522,10 @@ transform_to_exit_first_loop (struct loop *loop, h
the condition, moving the condition to the entry requires
decrementing one iteration. */
exit_1 = EDGE_SUCC (exit->src, EDGE_SUCC (exit->src, 0) == exit);
- if (exit_1->dest == loop->latch)
+
+ /* if the latch contains more than the one statemnt of control variable
+ increment then it contains the body. */
+ if (exit_1->dest == loop->latch && last_and_only_stmt (loop->latch))
new_rhs = gimple_cond_rhs (cond_stmt);
else
{
@@ -2146,7 +2149,6 @@ parallelize_loops (void)
return false;
if (cfun->has_nonlocal_label)
return false;
-
gcc_obstack_init (&parloop_obstack);
reduction_list = htab_create (10, reduction_info_hash,
reduction_info_eq, free);
@@ -2187,10 +2189,7 @@ parallelize_loops (void)
|| loop_has_blocks_with_irreducible_flag (loop)
|| (loop_preheader_edge (loop)->src->flags & BB_IRREDUCIBLE_LOOP)
/* FIXME: the check for vector phi nodes could be removed. */
- || loop_has_vector_phi_nodes (loop)
- /* FIXME: transform_to_exit_first_loop does not handle not
- header-copied loops correctly - see PR46886. */
- || !do_while_loop_p (loop))
+ || loop_has_vector_phi_nodes (loop))
continue;
estimated = max_stmt_executions_int (loop, false);
/* FIXME: Bypass this check as graphite doesn't update the
@@ -2213,6 +2212,7 @@ parallelize_loops (void)
continue;
changed = true;
+
if (dump_file && (dump_flags & TDF_DETAILS))
{
if (loop->inner)
=