On Fri, Nov 04, 2016 at 09:47:26AM +0100, Richard Biener wrote:
> On Thu, Nov 3, 2016 at 4:03 PM, Dominik Vogt <v...@linux.vnet.ibm.com> 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 a sign extend could be replaced by the
> > original quantity in all places, and if so, eliminate the ssa
> > name.  (I guess that won't help with the above code because l is
> > used also as a function argument.)  How could a sensible approach
> > to deal with the situation look like?
> 
> We run into this kind of situation regularly and for general foldings
> in match.pd we settled with single_use () even though it is not perfect.
> Note the usual complaint is not extra extension instructions but
> the increase of register pressure.
> 
> This is because it is hard to do better when you are doing local
> optimization.
> 
> As for the question on whether VRP is the right pass to do this the
> answer is two-fold -- VRP has the most precise range information.
> But the folding itself should be moved to generic code and use
> get_range_info ().

All right, is this a sensible approach then?

  1. Using has_single_use as in the experimental patch is good
     enough (provided further testing does not show serious
     regressions).
  2. Rip the whole top level if-block from simplify_cond_using_ranges().
  3. Translate that code to match.pd syntax.

Ciao

Dominik ^_^  ^_^

-- 

Dominik Vogt
IBM Germany

Reply via email to