Commit 9857228c by Sebastian Pop

re PR tree-optimization/36181 (Simple for loop generates ICE with -ftree-parallelize-loops=2)

2008-05-20  Sebastian Pop  <sebastian.pop@amd.com>
	    Jan Sjodin  <jan.sjodin@amd.com>

	PR tree-optimization/36181
	* tree-parloops.c (loop_has_vector_phi_nodes): New.
	(parallelize_loops): Don't parallelize when the loop has vector
	phi nodes.

	* gcc.dg/tree-ssa/pr36181.c: New.

From-SVN: r135673
parent 9f275479
2008-05-20 Sebastian Pop <sebastian.pop@amd.com>
Jan Sjodin <jan.sjodin@amd.com>
PR tree-optimization/36181
* tree-parloops.c (loop_has_vector_phi_nodes): New.
(parallelize_loops): Don't parallelize when the loop has vector
phi nodes.
2008-05-20 Jan Sjodin <jan.sjodin@amd.com> 2008-05-20 Jan Sjodin <jan.sjodin@amd.com>
Sebastian Pop <sebastian.pop@amd.com> Sebastian Pop <sebastian.pop@amd.com>
......
2008-05-20 Jan Sjodin <jan.sjodin@amd.com>
Sebastian Pop <sebastian.pop@amd.com>
PR tree-optimization/36181
* gcc.dg/tree-ssa/pr36181.c: New.
2008-05-20 Uros Bizjak <ubizjak@gmail.com> 2008-05-20 Uros Bizjak <ubizjak@gmail.com>
PR testsuite/36057 PR testsuite/36057
......
/* { dg-do compile } */
/* { dg-options "-O3 -ftree-parallelize-loops=2" } */
int foo ()
{
int i, sum = 0, data[1024];
for(i = 0; i<1024; i++)
sum += data[i];
return sum;
}
...@@ -1797,6 +1797,27 @@ gen_parallel_loop (struct loop *loop, htab_t reduction_list, ...@@ -1797,6 +1797,27 @@ gen_parallel_loop (struct loop *loop, htab_t reduction_list,
omp_expand_local (parallel_head); omp_expand_local (parallel_head);
} }
/* Returns true when LOOP contains vector phi nodes. */
static bool
loop_has_vector_phi_nodes (struct loop *loop)
{
unsigned i;
basic_block *bbs = get_loop_body_in_dom_order (loop);
bool res = true;
tree phi;
for (i = 0; i < loop->num_nodes; i++)
for (phi = phi_nodes (bbs[i]); phi; phi = PHI_CHAIN (phi))
if (TREE_CODE (TREE_TYPE (PHI_RESULT (phi))) == VECTOR_TYPE)
goto end;
res = false;
end:
free (bbs);
return res;
}
/* Detect parallel loops and generate parallel code using libgomp /* Detect parallel loops and generate parallel code using libgomp
primitives. Returns true if some loop was parallelized, false primitives. Returns true if some loop was parallelized, false
otherwise. */ otherwise. */
...@@ -1828,6 +1849,8 @@ parallelize_loops (void) ...@@ -1828,6 +1849,8 @@ parallelize_loops (void)
/* And of course, the loop must be parallelizable. */ /* And of course, the loop must be parallelizable. */
|| !can_duplicate_loop_p (loop) || !can_duplicate_loop_p (loop)
|| loop_has_blocks_with_irreducible_flag (loop) || loop_has_blocks_with_irreducible_flag (loop)
/* FIXME: the check for vector phi nodes could be removed. */
|| loop_has_vector_phi_nodes (loop)
|| !loop_parallel_p (loop, reduction_list, &niter_desc)) || !loop_parallel_p (loop, reduction_list, &niter_desc))
continue; continue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment