https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92033

--- Comment #4 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> 
---
Author: rsandifo
Date: Wed Oct 16 09:50:44 2019
New Revision: 277056

URL: https://gcc.gnu.org/viewcvs?rev=277056&root=gcc&view=rev
Log:
Deal with incoming POLY_INT_CST ranges (PR92033)

This patch makes value_range_base::set convert POLY_INT_CST bounds
into the worst-case INTEGER_CST bounds.  The main case in which this
gives useful ranges is a lower bound of A + B * X becoming A when B >= 0.
E.g.:

  [32 + 16X, 100] -> [32, 100]
  [32 + 16X, 32 + 16X] -> [32, MAX]

But the same thing can be useful for the upper bound with negative
X coefficients.

2019-10-16  Richard Sandiford  <richard.sandif...@arm.com>

gcc/
        PR middle-end/92033
        * poly-int.h (constant_lower_bound_with_limit): New function.
        (constant_upper_bound_with_limit): Likewise.
        * doc/poly-int.texi: Document them.
        * tree-vrp.c (value_range_base::set): Convert POLY_INT_CST bounds
        into the worst-case INTEGER_CST bounds.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/doc/poly-int.texi
    trunk/gcc/poly-int.h
    trunk/gcc/tree-vrp.c

Reply via email to