This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [gomp4][PATCH] Handle casts in bound in try_transform_to_exit_first_loop_alt
- From: Richard Biener <rguenther at suse dot de>
- To: Tom de Vries <Tom_deVries at mentor dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Jakub Jelinek <jakub at redhat dot com>
- Date: Mon, 22 Jun 2015 16:36:04 +0200 (CEST)
- Subject: Re: [gomp4][PATCH] Handle casts in bound in try_transform_to_exit_first_loop_alt
- Authentication-results: sourceware.org; auth=none
- References: <557C3D11 dot 8080303 at mentor dot com> <55826D6B dot 5090204 at mentor dot com>
On Thu, 18 Jun 2015, Tom de Vries wrote:
> On 13/06/15 16:24, Tom de Vries wrote:
> > Hi,
> >
> > this patch allows try_transform_to_exit_first_loop_alt to succeed when
> > handling cases where the expression representing the number of
> > iterations contains a cast.
> >
> > Currently, transform_to_exit_first_loop_alt testcase
> > gfortran/parloops-exit-first-loop-alt.f95 will fail.
> >
> > The nit is _19, which is defined as follows:
> > ...
> > _20 = _6 + -1;
> > _19 = (unsigned int) _20;
> > ...
> > And transform_to_exit_first_loop_alt currently only handles nits with
> > defining stmt 'nit = x - 1', for which it finds alt_bound 'x'.
> >
> > The patch:
> > - uses try_get_loop_niter to get nit as a nested tree expression
> > '(unsigned int) (_6 + -1)'
> > - strips the outer nops (assuming no change in value)
> > - uses '(unsigned int)_6' as the alt_bound, and
> > - gimplifies the expression.
> >
> > Bootstrapped and reg-tested on x86_64.
> >
>
> Cleaned up whitespace in testcases.
>
> Committed to gomp-4_0-branch as atttached.
>
> > OK for trunk?
> >
I assume the above also handles the reverse, (int) (_6 + -1)?
In this case what happens if _6 == INT_MAX + 1? nit is INT_MAX
but (int) _6 is INT_MIN.
Likewise what happens if _6 + -1 under-/overflows?
Richard.
> Thanks,
> - Tom
>
>
--
Richard Biener <rguenther@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Dilip Upmanyu, Graham Norton, HRB 21284 (AG Nuernberg)