This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gomp4][PATCH] Handle casts in bound in try_transform_to_exit_first_loop_alt


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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]