From: Sebastian Pop Date: Tue, 20 May 2008 19:17:12 +0000 (+0000) Subject: re PR tree-optimization/36181 (Simple for loop generates ICE with -ftree-parallelize... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9857228c4ca42e03fb12177065a14b5dadaf7e00;p=gcc.git re PR tree-optimization/36181 (Simple for loop generates ICE with -ftree-parallelize-loops=2) 2008-05-20 Sebastian Pop Jan Sjodin 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ba15ab57014..65cb134a461 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2008-05-20 Sebastian Pop + Jan Sjodin + + 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 Sebastian Pop diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fae968728a5..0ff1a091d54 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2008-05-20 Jan Sjodin + Sebastian Pop + + PR tree-optimization/36181 + * gcc.dg/tree-ssa/pr36181.c: New. + 2008-05-20 Uros Bizjak PR testsuite/36057 diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr36181.c b/gcc/testsuite/gcc.dg/tree-ssa/pr36181.c new file mode 100644 index 00000000000..6eda0a4270a --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr36181.c @@ -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; +} + diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c index de4f3065a52..109e3058921 100644 --- a/gcc/tree-parloops.c +++ b/gcc/tree-parloops.c @@ -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;