On Sat, May 30, 2015 at 7:47 AM, Jeff Law <l...@redhat.com> wrote:
> On 05/19/2015 10:12 AM, Aditya K wrote:
>>
>> w.r.t. the PR48052, here is the patch which finds out if scev would wrap
>> or not.
>> The patch symbolically evaluates if valid_niter>= loop->nb_iterations is
>> true. In that case the scev would not wrap (??).
>> Currently, we only look for two special 'patterns', which are sufficient
>> to analyze the simple test cases.
>>
>> valid_niter = ~s (= UNIT_MAX - s)
>> We have to prove that valid_niter>= loop->nb_iterations
>>
>> Pattern1 loop->nb_iterations: s>= e ? s - e : 0
>> Pattern2 loop->nb_iterations: (e - s) -1
>>
>> In the first case we prove that valid_niter>= loop->nb_iterations in both
>> the cases i.e., when s>=e and when not.
>> In the second case we prove valid_niter>= loop->nb_iterations, by simple
>> analysis that  UINT_MAX>= e is true in all cases.
>>
>> I haven't tested this patch completely. I'm looking for feedback and any
>> scope for improvement.
>>
>>
>> hth,
>> -Aditya
>>
>>
>>
>> Vectorize loops which has typecast.
>>
>> 2015-05-19  hiraditya  <hiradi...@msn.com>
>>
>>          * gcc.dg/vect/pr48052.c: New test.
>>
>> gcc/ChangeLog:
>>
>> 2015-05-19  hiraditya  <hiradi...@msn.com>
>>
>>          * tree-ssa-loop-niter.c (fold_binary_cond_p): Fold a conditional
>> operation when additional constraints are
>>          available.
>>          (fold_binary_minus_p): Fold a subtraction operations of the form
>> (A - B -1) when additional constraints are
>>          available.
>>          (scev_probably_wraps_p): Use the above two functions to find
>> whether valid_niter>= loop->nb_iterations.
>
> Is any of this work still useful if Bin Cheng's work on improving overflow
> detection for scev goes forward?  I certainly got the impression that Bin's
> work would solve 48052 and others.

Bin is probably the one to answer this.  His patches are still on my list
of patches to review...

Richard.

> Jeff
>

Reply via email to