[PATCH, 10/16] Add pass_oacc_kernels pass group in passes.def

Tom de Vries Tom_deVries@mentor.com
Tue Nov 17 15:39:00 GMT 2015


On 17/11/15 16:18, Richard Biener wrote:
>>> IMHO autopar needs to handle induction itself.
>> >
>> >I'm not sure what you mean. Could you elaborate?  Autopar handles induction
>> >variables, but it doesn't handle exit phis reading the final value of the
>> >induction variable. Is that what you want fixed? How?
> Yes.  Perform final value replacement.
>

I see. Calling scev_const_prop in pass_parallelize_loops_oacc_kernels 
seems to work fine.

Doing the same for pass_parallelize_loops like this:
...
diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
index 17415a8..d944395 100644
--- a/gcc/tree-parloops.c
+++ b/gcc/tree-parloops.c
@@ -2787,6 +2787,9 @@ pass_parallelize_loops::execute (function *fun)
    if (number_of_loops (fun) <= 1)
      return 0;

+  unsigned int sccp_todo = scev_const_prop ();
+  gcc_assert (sccp_todo == 0);
+
    if (parallelize_loops ())
      {
        fun->curr_properties &= ~(PROP_gimple_eomp);
...
seems to fix PR 68373 - "autopar fails on loop exit phi with argument 
defined outside loop".

The new scev_const_prop call in autopar rewrites this phi into an 
assignment, and that allows parloops to succeed:
...
final value replacement:
   n_2 = PHI <n_4(D)(4)>
   with
   n_2 = n_4(D);
...

Thanks,
- Tom



More information about the Gcc-patches mailing list