On Tue, 17 Nov 2015, Tom de Vries wrote: > 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); > ...
That works for me but please factor out the final value replacement code from scev_const_prop. I think best would be to have a helper that does final value replacement for a single loop so you can call it for loops to paralellize only. Richard. > Thanks, > - Tom > > -- Richard Biener <rguent...@suse.de> SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)