This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, PR68373 ] Call scev_const_prop in pass_parallelize_loops::execute
- From: Richard Biener <rguenther at suse dot de>
- To: Tom de Vries <Tom_deVries at mentor dot com>
- Cc: Richard Biener <richard dot guenther at gmail dot com>, "gcc-patches at gnu dot org" <gcc-patches at gnu dot org>, Jakub Jelinek <jakub at redhat dot com>
- Date: Fri, 20 Nov 2015 11:15:09 +0100 (CET)
- Subject: Re: [PATCH, PR68373 ] Call scev_const_prop in pass_parallelize_loops::execute
- Authentication-results: sourceware.org; auth=none
- References: <5640BD31 dot 2060602 at mentor dot com> <5640FB07 dot 6010008 at mentor dot com> <alpine dot LSU dot 2 dot 11 dot 1511111159040 dot 4884 at t29 dot fhfr dot qr> <5649C41A dot 40403 at mentor dot com> <alpine dot LSU dot 2 dot 11 dot 1511161341420 dot 4884 at t29 dot fhfr dot qr> <564A64B3 dot 7080305 at mentor dot com> <CAFiYyc0i3BX=9Ae1w-a=ySUwLbXNLE-TbKLOjqYRGExPJJ_A_Q at mail dot gmail dot com> <564B3F69 dot 50600 at mentor dot com> <alpine dot LSU dot 2 dot 11 dot 1511171618210 dot 4884 at t29 dot fhfr dot qr> <564B49F6 dot 308 at mentor dot com> <564BA844 dot 1010103 at mentor dot com> <564D97F4 dot 1020507 at mentor dot com>
On Thu, 19 Nov 2015, Tom de Vries wrote:
> On 17/11/15 23:20, Tom de Vries wrote:
> > [ was: Re: [PATCH, 10/16] Add pass_oacc_kernels pass group in passes.def ]
> >
> > Hi,
> >
> > Consider test-case test.c, with a use of the final value of the
> > iteration variable (return i):
> > ...
> > unsigned int
> > foo (int *a, unsigned int n)
> > {
> > unsigned int i;
> > for (i = 0; i < n; ++i)
> > a[i] = 1;
> >
> > return i;
> > }
> > ...
> >
> > Compiled with:
> > ...
> > $ gcc -S -O2 test.c -ftree-parallelize-loops=2 -fdump-tree-all-details
> > ...
> >
> > Before parloops, we have:
> > ...
> > <bb 4>:
> > # i_12 = PHI <0(3), i_10(5)>
> > _5 = (long unsigned int) i_12;
> > _6 = _5 * 4;
> > _8 = a_7(D) + _6;
> > *_8 = 1;
> > i_10 = i_12 + 1;
> > if (n_4(D) > i_10)
> > goto <bb 5>;
> > else
> > goto <bb 6>;
> >
> > <bb 5>:
> > goto <bb 4>;
> >
> > <bb 6>:
> > # i_14 = PHI <n_4(D)(4), 0(2)>
> > ...
> >
> > Parloops will fail because:
> > ...
> > phi is n_2 = PHI <n_4(D)(4)>
> > arg of phi to exit: value n_4(D) used outside loop
> > checking if it a part of reduction pattern:
> > FAILED: it is not a part of reduction....
> > ...
> > [ note that the phi looks slightly different. In
> > gather_scalar_reductions -> vect_analyze_loop_form ->
> > vect_analyze_loop_form_1 -> split_loop_exit_edge we split the edge from
> > bb4 to bb6. ]
> >
> > This patch uses scev_const_prop at the start of parloops.
> > scev_const_prop first also splits the exit edge, and then replaces the
> > phi with a assignment:
> > ...
> > final value replacement:
> > n_2 = PHI <n_4(D)(4)>
> > with
> > n_2 = n_4(D);
> > ...
> >
> > This allows parloops to succeed.
> >
> > And there's a similar story when we compile with -fno-tree-scev-cprop in
> > addition.
> >
> > Bootstrapped and reg-tested on x86_64.
> >
> > OK for stage3/stage1?
>
> The patch has been updated to do the final value replacement only for the loop
> that parloops is processing, as suggested in review comment at
> https://gcc.gnu.org/ml/gcc-patches/2015-11/msg02166.html .
>
> That means the patch is now also required for the kernels patch series.
>
> Bootstrapped and reg-tested on x86_64.
>
> OK for stage 3 trunk?
Ok. Please mention tree-optimization/68373 in the changelog.
Thanks,
Richard.
> Thanks,
> - Tom
>
--
Richard Biener <rguenther@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)
- References:
- [PATCH series, 16] Use parloops to parallelize oacc kernels regions
- [PATCH, 10/16] Add pass_oacc_kernels pass group in passes.def
- Re: [PATCH, 10/16] Add pass_oacc_kernels pass group in passes.def
- Re: [PATCH, 10/16] Add pass_oacc_kernels pass group in passes.def
- Re: [PATCH, 10/16] Add pass_oacc_kernels pass group in passes.def
- Re: [PATCH, 10/16] Add pass_oacc_kernels pass group in passes.def
- Re: [PATCH, 10/16] Add pass_oacc_kernels pass group in passes.def
- Re: [PATCH, 10/16] Add pass_oacc_kernels pass group in passes.def
- Re: [PATCH, 10/16] Add pass_oacc_kernels pass group in passes.def
- Re: [PATCH, 10/16] Add pass_oacc_kernels pass group in passes.def
- [PATCH, PR68373 ] Call scev_const_prop in pass_parallelize_loops::execute
- Re: [PATCH, PR68373 ] Call scev_const_prop in pass_parallelize_loops::execute