2
0
mirror of git://gcc.gnu.org/git/gcc.git synced 2025-04-24 07:30:31 +08:00

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
This commit is contained in:
Sebastian Pop 2008-05-20 19:17:12 +00:00
parent 9f275479a9
commit 9857228c4c
4 changed files with 50 additions and 0 deletions

@ -1,3 +1,11 @@
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>
Sebastian Pop <sebastian.pop@amd.com>

@ -1,3 +1,9 @@
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>
PR testsuite/36057

@ -0,0 +1,13 @@
/* { 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,
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
primitives. Returns true if some loop was parallelized, false
otherwise. */
@ -1828,6 +1849,8 @@ parallelize_loops (void)
/* And of course, the loop must be parallelizable. */
|| !can_duplicate_loop_p (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))
continue;