Re: SSA range class and removal of VR_ANTI_RANGEs

2017-06-22 Thread Martin Sebor
On 06/22/2017 06:16 AM, Richard Sandiford wrote: Aldy Hernandez writes: On 06/20/2017 10:59 AM, Martin Sebor wrote: On 06/20/2017 02:41 AM, Aldy Hernandez wrote: On 05/23/2017 03:26 PM, Martin Sebor wrote: On 05/23/2017 04:48 AM, Aldy Hernandez wrote: + void Union (wide_int x, wide_int y

Re: SSA range class and removal of VR_ANTI_RANGEs

2017-06-22 Thread Richard Sandiford
Aldy Hernandez writes: > On 06/20/2017 10:59 AM, Martin Sebor wrote: >> On 06/20/2017 02:41 AM, Aldy Hernandez wrote: >>> On 05/23/2017 03:26 PM, Martin Sebor wrote: On 05/23/2017 04:48 AM, Aldy Hernandez wrote: >>> + void Union (wide_int x, wide_int y); + bool Union (const irange

Re: SSA range class and removal of VR_ANTI_RANGEs

2017-06-21 Thread Aldy Hernandez
Hi folks. The following is another iteration of the SSA range class, taking into account many of the suggestions posted on this thread, especially the addition of a memory efficient class for storage, folding non-zero bits back into the range information, C++ suggestions by Martin, and some m

Re: SSA range class and removal of VR_ANTI_RANGEs

2017-06-20 Thread Aldy Hernandez
On 06/20/2017 10:59 AM, Martin Sebor wrote: On 06/20/2017 02:41 AM, Aldy Hernandez wrote: On 05/23/2017 03:26 PM, Martin Sebor wrote: On 05/23/2017 04:48 AM, Aldy Hernandez wrote: + void Union (wide_int x, wide_int y); + bool Union (const irange &r); + bool Union (const irange &r1, co

Re: SSA range class and removal of VR_ANTI_RANGEs

2017-06-20 Thread Martin Sebor
On 06/20/2017 02:41 AM, Aldy Hernandez wrote: On 05/23/2017 03:26 PM, Martin Sebor wrote: On 05/23/2017 04:48 AM, Aldy Hernandez wrote: + void Union (wide_int x, wide_int y); + bool Union (const irange &r); + bool Union (const irange &r1, const irange &r2); + + // THIS = THIS ^ [X,Y].

Re: SSA range class and removal of VR_ANTI_RANGEs

2017-06-20 Thread Aldy Hernandez
On 05/23/2017 03:26 PM, Martin Sebor wrote: On 05/23/2017 04:48 AM, Aldy Hernandez wrote: + void Union (wide_int x, wide_int y); + bool Union (const irange &r); + bool Union (const irange &r1, const irange &r2); + + // THIS = THIS ^ [X,Y]. Return TRUE if result is non-empty. + bool Int

Re: SSA range class and removal of VR_ANTI_RANGEs

2017-06-06 Thread Jeff Law
On 05/23/2017 08:34 AM, Jakub Jelinek wrote: > On Tue, May 23, 2017 at 10:29:58AM -0400, David Malcolm wrote: >>> Do we really want methods starting with capital letters? >>> I understand why you can't use union, but I don't think we use >>> CamelCase >>> anywhere. >> >> FWIW in the JIT, I have a c

Re: SSA range class and removal of VR_ANTI_RANGEs

2017-06-06 Thread Jeff Law
On 05/23/2017 05:28 AM, Nathan Sidwell wrote: > On 05/23/2017 06:48 AM, Aldy Hernandez wrote: > >> The class can live outside of his work, as can be demonstrated by the >> attached patch. With it, I was able to rewrite the post-VRP range >> information to use this class and get rid of VR_ANTI_RAN

Re: SSA range class and removal of VR_ANTI_RANGEs

2017-05-31 Thread Richard Biener
On May 31, 2017 6:28:26 PM GMT+02:00, Jakub Jelinek wrote: >On Wed, May 31, 2017 at 05:36:12PM +0200, Richard Biener wrote: >> On May 31, 2017 5:10:04 PM GMT+02:00, Jakub Jelinek > wrote: >> >On Wed, May 31, 2017 at 10:20:51AM -0400, Aldy Hernandez wrote: >> >> The biggest number of SSA_NAMEs I sa

Re: SSA range class and removal of VR_ANTI_RANGEs

2017-05-31 Thread Jakub Jelinek
On Wed, May 31, 2017 at 05:36:12PM +0200, Richard Biener wrote: > On May 31, 2017 5:10:04 PM GMT+02:00, Jakub Jelinek wrote: > >On Wed, May 31, 2017 at 10:20:51AM -0400, Aldy Hernandez wrote: > >> The biggest number of SSA_NAMEs I saw was actually 472,225. Of > >these, > >> 357,032 were non-point

Re: SSA range class and removal of VR_ANTI_RANGEs

2017-05-31 Thread Richard Biener
On May 31, 2017 5:10:04 PM GMT+02:00, Jakub Jelinek wrote: >On Wed, May 31, 2017 at 10:20:51AM -0400, Aldy Hernandez wrote: >> The biggest number of SSA_NAMEs I saw was actually 472,225. Of >these, >> 357,032 were non-pointers, so could conceivably have range >information. In >> reality, 77,398 h

Re: SSA range class and removal of VR_ANTI_RANGEs

2017-05-31 Thread Jakub Jelinek
On Wed, May 31, 2017 at 10:20:51AM -0400, Aldy Hernandez wrote: > The biggest number of SSA_NAMEs I saw was actually 472,225. Of these, > 357,032 were non-pointers, so could conceivably have range information. In > reality, 77,398 had range information, so 16% of all pointer and non-pointer > SSA_

Re: SSA range class and removal of VR_ANTI_RANGEs

2017-05-31 Thread Aldy Hernandez
On 05/23/2017 08:11 AM, Jakub Jelinek wrote: On Tue, May 23, 2017 at 06:48:15AM -0400, Aldy Hernandez wrote: [ughh, one more time, but CCing the list.] Sorry, for the delayed response. I was fighting with Firefox + LTO to gather some data :). I'm worried a lot here about compile time memo

Re: SSA range class and removal of VR_ANTI_RANGEs

2017-05-29 Thread Martin Jambor
Hi, On Wed, May 24, 2017 at 10:25:40AM +0200, Richard Biener wrote: > Well, anti-ranges are "evil" for actual working with ranges. They are nice > for optimizing the storage requirements though. > > As I'm replying late I'll add that yes, it does make a difference in memory > use. We've seen th

Re: SSA range class and removal of VR_ANTI_RANGEs

2017-05-26 Thread Richard Biener
On Wed, May 24, 2017 at 6:04 PM, Richard Biener wrote: > On May 24, 2017 5:38:53 PM GMT+02:00, Andrew MacLeod > wrote: >>On 05/24/2017 04:25 AM, Richard Biener wrote: >>> > What's this overflow flag for anyway? >> >>The new on-demand range calculators do operations on ranges, and that >>flag is

Re: SSA range class and removal of VR_ANTI_RANGEs

2017-05-26 Thread Richard Biener
On Thu, May 25, 2017 at 5:05 PM, Mike Stump wrote: > On May 24, 2017, at 1:25 AM, Richard Biener > wrote: >> >> There's trailing_wide_ints. But having 6 of them is still expensive. >> >> Something nice would be to make wide_ints not tied to use HOST_WIDE_INT >> as basic element type but for exa

Re: SSA range class and removal of VR_ANTI_RANGEs

2017-05-25 Thread Mike Stump
On May 24, 2017, at 1:25 AM, Richard Biener wrote: > > There's trailing_wide_ints. But having 6 of them is still expensive. > > Something nice would be to make wide_ints not tied to use HOST_WIDE_INT > as basic element type but for example uint32. wide_int was made so that they would be calcul

Re: SSA range class and removal of VR_ANTI_RANGEs

2017-05-24 Thread Richard Biener
On May 24, 2017 5:38:53 PM GMT+02:00, Andrew MacLeod wrote: >On 05/24/2017 04:25 AM, Richard Biener wrote: >> > What's this overflow flag for anyway? > >The new on-demand range calculators do operations on ranges, and that >flag is set when a range calculation may have overflowed... which is of

Re: SSA range class and removal of VR_ANTI_RANGEs

2017-05-24 Thread Andrew MacLeod
stlll bounced.. html must have snuck in somewhere, and the mailer sent it anyway -P trying again... On 05/24/2017 11:38 AM, Andrew MacLeod wrote: On 05/24/2017 04:25 AM, Richard Biener wrote: >> What's this overflow flag for anyway? The new on-demand range calculators do operations on ranges,

Re: SSA range class and removal of VR_ANTI_RANGEs

2017-05-24 Thread Richard Biener
..On Tue, May 23, 2017 at 5:24 PM, Andrew MacLeod wrot > On 05/23/2017 10:54 AM, Jakub Jelinek wrote: >> >> On Tue, May 23, 2017 at 10:38:44AM -0400, Andrew MacLeod wrote: >>> >>> As follow on work we have discussed an interface which would be able to >>> calculate a bitmask (for either zeros or o

Re: SSA range class and removal of VR_ANTI_RANGEs

2017-05-24 Thread Richard Biener
On Tue, May 23, 2017 at 12:48 PM, Aldy Hernandez wrote: > Howdy! > > For Andrew's upcoming on-demand range work I have created a range class for > use in his engine. Currently, the range class is only for SSA integers, but > there is no reason why we couldn't adapt this for RTL or non-integer typ

Re: SSA range class and removal of VR_ANTI_RANGEs

2017-05-23 Thread Andrew MacLeod
On 05/23/2017 03:26 PM, Martin Sebor wrote: On 05/23/2017 04:48 AM, Aldy Hernandez wrote: Howdy! +typedef class irange *irange_p; FWIW, I find pointer typedefs more trouble than worth. They obscure the fact that they are pointers and cannot be made const by adding the const qualifier. E.g.,

Re: SSA range class and removal of VR_ANTI_RANGEs

2017-05-23 Thread Martin Sebor
On 05/23/2017 04:48 AM, Aldy Hernandez wrote: Howdy! For Andrew's upcoming on-demand range work I have created a range class for use in his engine. Currently, the range class is only for SSA integers, but there is no reason why we couldn't adapt this for RTL or non-integer types at a later time

Re: SSA range class and removal of VR_ANTI_RANGEs

2017-05-23 Thread Martin Sebor
--- /dev/null +++ b/gcc/range.h + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_RANGE_H +#define GCC_RANGE_H +#define MAX_RANGES 6 + +typedef class irange *irange_p; +en

Re: SSA range class and removal of VR_ANTI_RANGEs

2017-05-23 Thread Andrew MacLeod
On 05/23/2017 10:54 AM, Jakub Jelinek wrote: On Tue, May 23, 2017 at 10:38:44AM -0400, Andrew MacLeod wrote: As follow on work we have discussed an interface which would be able to calculate a bitmask (for either zeros or ones) from a range and vice versa.. Sometimes the range vs. nonzero_bits

Re: SSA range class and removal of VR_ANTI_RANGEs

2017-05-23 Thread Richard Sandiford
Andrew MacLeod writes: > On 05/23/2017 08:11 AM, Jakub Jelinek wrote: >> On Tue, May 23, 2017 at 06:48:15AM -0400, Aldy Hernandez wrote: >>> --- a/gcc/tree-ssanames.h >>> +++ b/gcc/tree-ssanames.h >>> @@ -45,14 +45,12 @@ struct GTY(()) ptr_info_def >>> unsigned int misalign; >>> }; >>> >>

Re: SSA range class and removal of VR_ANTI_RANGEs

2017-05-23 Thread Jakub Jelinek
On Tue, May 23, 2017 at 10:38:44AM -0400, Andrew MacLeod wrote: > As follow on work we have discussed an interface which would be able to > calculate a bitmask (for either zeros or ones) from a range and vice versa.. Sometimes the range vs. nonzero_bits info is redundant, you can compute one from

Re: SSA range class and removal of VR_ANTI_RANGEs

2017-05-23 Thread Andrew MacLeod
On 05/23/2017 10:34 AM, Jakub Jelinek wrote: On Tue, May 23, 2017 at 10:29:58AM -0400, David Malcolm wrote: Do we really want methods starting with capital letters? I understand why you can't use union, but I don't think we use CamelCase anywhere. FWIW in the JIT, I have a class switch_ (i.e. w

Re: SSA range class and removal of VR_ANTI_RANGEs

2017-05-23 Thread Andrew MacLeod
On 05/23/2017 08:11 AM, Jakub Jelinek wrote: On Tue, May 23, 2017 at 06:48:15AM -0400, Aldy Hernandez wrote: --- a/gcc/tree-ssanames.h +++ b/gcc/tree-ssanames.h @@ -45,14 +45,12 @@ struct GTY(()) ptr_info_def unsigned int misalign; }; -/* Value range information for SSA_NAMEs representi

Re: SSA range class and removal of VR_ANTI_RANGEs

2017-05-23 Thread Jakub Jelinek
On Tue, May 23, 2017 at 10:29:58AM -0400, David Malcolm wrote: > > Do we really want methods starting with capital letters? > > I understand why you can't use union, but I don't think we use > > CamelCase > > anywhere. > > FWIW in the JIT, I have a class switch_ (i.e. with a trailing > underscore)

Re: SSA range class and removal of VR_ANTI_RANGEs

2017-05-23 Thread David Malcolm
On Tue, 2017-05-23 at 14:11 +0200, Jakub Jelinek wrote: > On Tue, May 23, 2017 at 06:48:15AM -0400, Aldy Hernandez wrote: [...] > > --- /dev/null > > +++ b/gcc/range.h > > + > > +You should have received a copy of the GNU General Public License > > +along with GCC; see the file COPYING3. If not

Re: SSA range class and removal of VR_ANTI_RANGEs

2017-05-23 Thread Jakub Jelinek
On Tue, May 23, 2017 at 06:48:15AM -0400, Aldy Hernandez wrote: > --- a/gcc/tree-ssanames.h > +++ b/gcc/tree-ssanames.h > @@ -45,14 +45,12 @@ struct GTY(()) ptr_info_def >unsigned int misalign; > }; > > -/* Value range information for SSA_NAMEs representing non-pointer variables. > */ > -

Re: SSA range class and removal of VR_ANTI_RANGEs

2017-05-23 Thread Nathan Sidwell
On 05/23/2017 06:48 AM, Aldy Hernandez wrote: The class can live outside of his work, as can be demonstrated by the attached patch. With it, I was able to rewrite the post-VRP range information to use this class and get rid of VR_ANTI_RANGE throughout the compiler. A VR_ANTI_RANGE of ~[5,10]