diff options
author | Tom de Vries <tom@codesourcery.com> | 2016-01-10 12:44:57 +0000 |
---|---|---|
committer | Tom de Vries <vries@gcc.gnu.org> | 2016-01-10 12:44:57 +0000 |
commit | 3907c6cf931af4e874cb217addd29b24063b6367 (patch) | |
tree | 24f64fe4361e4575dd44f0faa922bd2078f8eb1c /gcc/tree-parloops.c | |
parent | b07b236e84f8d171d0a59227f824429376cc536f (diff) | |
download | gcc-3907c6cf931af4e874cb217addd29b24063b6367.zip gcc-3907c6cf931af4e874cb217addd29b24063b6367.tar.gz gcc-3907c6cf931af4e874cb217addd29b24063b6367.tar.bz2 |
Don't parallelize loops containing phis with addr_exprs
2016-01-10 Tom de Vries <tom@codesourcery.com>
PR tree-optimization/69062
* tree-parloops.c (loop_has_phi_with_address_arg): New function.
(parallelize_loops): Don't paralelize loop that has phi with address
arg.
* gcc.dg/autopar/pr69062.c: New test.
From-SVN: r232199
Diffstat (limited to 'gcc/tree-parloops.c')
-rw-r--r-- | gcc/tree-parloops.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c index 394aba8..5bd9c06 100644 --- a/gcc/tree-parloops.c +++ b/gcc/tree-parloops.c @@ -2640,6 +2640,37 @@ try_create_reduction_list (loop_p loop, return true; } +/* Return true if LOOP contains phis with ADDR_EXPR in args. */ + +static bool +loop_has_phi_with_address_arg (struct loop *loop) +{ + basic_block *bbs = get_loop_body (loop); + bool res = false; + + unsigned i, j; + gphi_iterator gsi; + for (i = 0; i < loop->num_nodes; i++) + for (gsi = gsi_start_phis (bbs[i]); !gsi_end_p (gsi); gsi_next (&gsi)) + { + gphi *phi = gsi.phi (); + for (j = 0; j < gimple_phi_num_args (phi); j++) + { + tree arg = gimple_phi_arg_def (phi, j); + if (TREE_CODE (arg) == ADDR_EXPR) + { + /* This should be handled by eliminate_local_variables, but that + function currently ignores phis. */ + res = true; + goto end; + } + } + } + end: + free (bbs); + return res; +} + /* Detect parallel loops and generate parallel code using libgomp primitives. Returns true if some loop was parallelized, false otherwise. */ @@ -2734,6 +2765,9 @@ parallelize_loops (void) if (!try_create_reduction_list (loop, &reduction_list)) continue; + if (loop_has_phi_with_address_arg (loop)) + continue; + if (!flag_loop_parallelize_all && !loop_parallel_p (loop, &parloop_obstack)) continue; |