PR 64454: Improve VRP for %

Marc Glisse marc.glisse@inria.fr
Mon May 4 13:57:00 GMT 2015


On Mon, 4 May 2015, Richard Biener wrote:

> On Sat, May 2, 2015 at 12:46 AM, Marc Glisse <marc.glisse@inria.fr> wrote:
>> Hello,
>>
>> this patch tries to tighten a bit the range estimate for x%y. slp-perm-7.c
>> started failing by vectorizing more than expected, I assumed it was a good
>> thing and updated the test. I am less conservative than Jakub with division
>> by 0, but I still don't really understand how empty ranges are supposed to
>> be represented in VRP.
>>
>> Bootstrap+testsuite on x86_64-linux-gnu.
>
> Hmm, so I don't like how you (continute to) use trees for the constant 
> computations. wide-ints would be a better fit today.  I also notice that 
> fold_unary_to_constant can return NULL_TREE and neither the old nor your 
> code handles that.

You are right. I was lazy and tried to keep this part of the old code, I 
shouldn't have...

> "empty" ranges are basically UNDEFINED.

Cool, that's what I did. But I don't see code adding calls to 
__builtin_unreachable() when an empty range is detected. Maybe that almost 
never happens?

> Aren't you pessimizing the case where the old code used 
> value_range_nonnegative_p() by just using TYPE_UNSIGNED?

I don't think so. The old code only handled signed types in the positive 
case, while I have a more complete handling of signed types, which should 
do at least as good as the old one even in the positive case.

-- 
Marc Glisse



More information about the Gcc-patches mailing list