[RFC] Check number of uses in simplify_cond_using_ranges().

2016-11-03 Thread Dominik Vogt
I've been trying to fix some bad tree-ssa related optimisation for s390x and come up with the attached experimental patch. The patch is not really good - it breaks some situations in which the optimisation was useful. With this code: void bar(long); void foo (char a) { long l; char

Re: [RFC] Check number of uses in simplify_cond_using_ranges().

2016-11-08 Thread Dominik Vogt
On Fri, Nov 04, 2016 at 01:54:20PM +0100, Richard Biener wrote: > On Fri, Nov 4, 2016 at 12:08 PM, Dominik Vogt wrote: > > On Fri, Nov 04, 2016 at 09:47:26AM +0100, Richard Biener wrote: > >> On Thu, Nov 3, 2016 at 4:03 PM, Dominik Vogt > >> wrote: > >> > Is VRP the right pass to do this optimis

Re: [RFC] Check number of uses in simplify_cond_using_ranges().

2016-11-08 Thread Marc Glisse
On Tue, 8 Nov 2016, Dominik Vogt wrote: On Fri, Nov 04, 2016 at 01:54:20PM +0100, Richard Biener wrote: On Fri, Nov 4, 2016 at 12:08 PM, Dominik Vogt wrote: On Fri, Nov 04, 2016 at 09:47:26AM +0100, Richard Biener wrote: On Thu, Nov 3, 2016 at 4:03 PM, Dominik Vogt wrote: Is VRP the right

Re: [RFC] Check number of uses in simplify_cond_using_ranges().

2016-11-09 Thread Richard Biener
On Tue, Nov 8, 2016 at 5:18 PM, Marc Glisse wrote: > On Tue, 8 Nov 2016, Dominik Vogt wrote: > >> On Fri, Nov 04, 2016 at 01:54:20PM +0100, Richard Biener wrote: >>> >>> On Fri, Nov 4, 2016 at 12:08 PM, Dominik Vogt >>> wrote: On Fri, Nov 04, 2016 at 09:47:26AM +0100, Richard Biener wro

Re: [RFC] Check number of uses in simplify_cond_using_ranges().

2016-11-09 Thread Dominik Vogt
On Wed, Nov 09, 2016 at 01:43:58PM +0100, Richard Biener wrote: > On Tue, Nov 8, 2016 at 5:18 PM, Marc Glisse wrote: > > On Tue, 8 Nov 2016, Dominik Vogt wrote: > > > >> On Fri, Nov 04, 2016 at 01:54:20PM +0100, Richard Biener wrote: > >>> > >>> On Fri, Nov 4, 2016 at 12:08 PM, Dominik Vogt > >>>

Re: [RFC] Check number of uses in simplify_cond_using_ranges().

2016-11-09 Thread Richard Biener
On Wed, Nov 9, 2016 at 3:30 PM, Dominik Vogt wrote: > On Wed, Nov 09, 2016 at 01:43:58PM +0100, Richard Biener wrote: >> On Tue, Nov 8, 2016 at 5:18 PM, Marc Glisse wrote: >> > On Tue, 8 Nov 2016, Dominik Vogt wrote: >> > >> >> On Fri, Nov 04, 2016 at 01:54:20PM +0100, Richard Biener wrote: >> >>

Re: [RFC] Check number of uses in simplify_cond_using_ranges().

2016-11-10 Thread Dominik Vogt
On Wed, Nov 09, 2016 at 03:46:38PM +0100, Richard Biener wrote: > On Wed, Nov 9, 2016 at 3:30 PM, Dominik Vogt wrote: > > Something like the attached patch? Robin and me have spent quite > > some time to figure out the new pattern. Two questions: > > > > 1) In the match expression you cannot jus

Re: [RFC] Check number of uses in simplify_cond_using_ranges().

2016-11-10 Thread Marc Glisse
On Thu, 10 Nov 2016, Dominik Vogt wrote: On Wed, Nov 09, 2016 at 03:46:38PM +0100, Richard Biener wrote: On Wed, Nov 9, 2016 at 3:30 PM, Dominik Vogt wrote: Something like the attached patch? Robin and me have spent quite some time to figure out the new pattern. Two questions: 1) In the ma

Re: [RFC] Check number of uses in simplify_cond_using_ranges().

2016-11-10 Thread Dominik Vogt
On Thu, Nov 10, 2016 at 11:53:07PM +0100, Marc Glisse wrote: > On Thu, 10 Nov 2016, Dominik Vogt wrote: > > >On Wed, Nov 09, 2016 at 03:46:38PM +0100, Richard Biener wrote: > >>On Wed, Nov 9, 2016 at 3:30 PM, Dominik Vogt > >>wrote: > >>>Something like the attached patch? Robin and me have spen

Re: [RFC] Check number of uses in simplify_cond_using_ranges().

2016-11-16 Thread Richard Biener
On Thu, Nov 10, 2016 at 9:52 PM, Dominik Vogt wrote: > On Wed, Nov 09, 2016 at 03:46:38PM +0100, Richard Biener wrote: >> On Wed, Nov 9, 2016 at 3:30 PM, Dominik Vogt wrote: >> > Something like the attached patch? Robin and me have spent quite >> > some time to figure out the new pattern. Two q

Re: [RFC] Check number of uses in simplify_cond_using_ranges().

2016-11-03 Thread Dominik Vogt
On Thu, Nov 03, 2016 at 04:03:22PM +0100, Dominik Vogt wrote: > I've been trying to fix some bad tree-ssa related optimisation for > s390x and come up with the attached experimental patch. The patch > is not really good - it breaks some situations in which the > optimisation was useful. With this

Re: [RFC] Check number of uses in simplify_cond_using_ranges().

2016-11-03 Thread Eric Botcazou
> Is VRP the right pass to do this optimisation or should a later > pass rather attempt to eliminate the new use of b_5 instead? Uli > has brought up the idea a mini "sign extend elimination" pass that > checks if the result of a sign extend could be replaced by the > original quantity in all plac

Re: [RFC] Check number of uses in simplify_cond_using_ranges().

2016-11-03 Thread Dominik Vogt
On Thu, Nov 03, 2016 at 04:29:05PM +0100, Eric Botcazou wrote: > > Is VRP the right pass to do this optimisation or should a later > > pass rather attempt to eliminate the new use of b_5 instead? Uli > > has brought up the idea a mini "sign extend elimination" pass that > > checks if the result of

Re: [RFC] Check number of uses in simplify_cond_using_ranges().

2016-11-04 Thread Richard Biener
On Thu, Nov 3, 2016 at 4:03 PM, Dominik Vogt wrote: > I've been trying to fix some bad tree-ssa related optimisation for > s390x and come up with the attached experimental patch. The patch > is not really good - it breaks some situations in which the > optimisation was useful. With this code: >

Re: [RFC] Check number of uses in simplify_cond_using_ranges().

2016-11-04 Thread Dominik Vogt
On Fri, Nov 04, 2016 at 09:47:26AM +0100, Richard Biener wrote: > On Thu, Nov 3, 2016 at 4:03 PM, Dominik Vogt wrote: > > Is VRP the right pass to do this optimisation or should a later > > pass rather attempt to eliminate the new use of b_5 instead? Uli > > has brought up the idea a mini "sign e

Re: [RFC] Check number of uses in simplify_cond_using_ranges().

2016-11-04 Thread Richard Biener
On Fri, Nov 4, 2016 at 12:08 PM, Dominik Vogt wrote: > On Fri, Nov 04, 2016 at 09:47:26AM +0100, Richard Biener wrote: >> On Thu, Nov 3, 2016 at 4:03 PM, Dominik Vogt wrote: >> > Is VRP the right pass to do this optimisation or should a later >> > pass rather attempt to eliminate the new use of b