[RFC][VRP] Improve intersect_ranges

kugan kugan.vivekanandarajah@linaro.org
Sat Oct 8 19:38:00 GMT 2016


Hi Richard,

Thanks for the review.
On 07/10/16 20:11, Richard Biener wrote:
> On Fri, Oct 7, 2016 at 12:00 AM, kugan
> <kugan.vivekanandarajah@linaro.org> wrote:
>> Hi,
>>
>> In vrp intersect_ranges, Richard recently changed it to create integer value
>> ranges when it is integer singleton.
>>
>> Maybe we should do the same when the other range is a complex ranges with
>> SSA_NAME (like [x+2, +INF])?
>>
>> Attached patch tries to do this. There are cases where it will be beneficial
>> as the  testcase in the patch. (For this testcase to work with Early VRP, we
>> need the patch posted at
>> https://gcc.gnu.org/ml/gcc-patches/2016-10/msg00413.html)
>>
>> Bootstrapped and regression tested on x86_64-linux-gnu with no new
>> regressions.
>
> This is not clearly a win, in fact it can completely lose an ASSERT_EXPR
> because there is no way to add its effect back as an equivalence.  The
> current choice of always using the "left" keeps the ASSERT_EXPR range
> and is able to record the other range via an equivalence.

How about changing the order in Early VRP when we are dealing with the 
same SSA_NAME in inner and outer scope. Here is a patch that does this. 
Is this OK if no new regressions?

Thanks,
Kugan




> My thought on this was that we need to separate "ranges" and associated
> SSA names so we can introduce new ranges w/o the need for an SSA name
> (and thus we can create an equivalence to the ASSERT_EXPR range).
> IIRC I started on this at some point but never finished it ...
>
> Richard.
>
>> Thanks,
>> Kugan
>>
>>
>> gcc/testsuite/ChangeLog:
>>
>> 2016-10-07  Kugan Vivekanandarajah  <kuganv@linaro.org>
>>
>>         * gcc.dg/tree-ssa/evrp6.c: New test.
>>
>> gcc/ChangeLog:
>>
>> 2016-10-07  Kugan Vivekanandarajah  <kuganv@linaro.org>
>>
>>         * tree-vrp.c (intersect_ranges): If we failed to handle
>>         the intersection and the other range involves computation with
>>         symbolic values, choose integer range if available.
>>
>>
>>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-Revese-value-range-before-calling-interset_range.patch
Type: text/x-patch
Size: 2104 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20161008/bd177c86/attachment.bin>


More information about the Gcc-patches mailing list