diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2019-10-16 09:50:44 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2019-10-16 09:50:44 +0000 |
commit | 96eb7d7a642085f651e9940f0ee75568d7c4441d (patch) | |
tree | f7eca938631203946dc47f7d9408210613dc0571 /gcc/doc | |
parent | 4307a485c39fd1c317d6cead2707a903052c4753 (diff) | |
download | gcc-96eb7d7a642085f651e9940f0ee75568d7c4441d.zip gcc-96eb7d7a642085f651e9940f0ee75568d7c4441d.tar.gz gcc-96eb7d7a642085f651e9940f0ee75568d7c4441d.tar.bz2 |
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.sandiford@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.
From-SVN: r277056
Diffstat (limited to 'gcc/doc')
-rw-r--r-- | gcc/doc/poly-int.texi | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/doc/poly-int.texi b/gcc/doc/poly-int.texi index 1023e82..d60bb02 100644 --- a/gcc/doc/poly-int.texi +++ b/gcc/doc/poly-int.texi @@ -803,6 +803,18 @@ the assertion is known to hold. @item constant_lower_bound (@var{a}) Assert that @var{a} is nonnegative and return the smallest value it can have. +@item constant_lower_bound_with_limit (@var{a}, @var{b}) +Return the least value @var{a} can have, given that the context in +which @var{a} appears guarantees that the answer is no less than @var{b}. +In other words, the caller is asserting that @var{a} is greater than or +equal to @var{b} even if @samp{known_ge (@var{a}, @var{b})} doesn't hold. + +@item constant_upper_bound_with_limit (@var{a}, @var{b}) +Return the greatest value @var{a} can have, given that the context in +which @var{a} appears guarantees that the answer is no greater than @var{b}. +In other words, the caller is asserting that @var{a} is less than or equal +to @var{b} even if @samp{known_le (@var{a}, @var{b})} doesn't hold. + @item lower_bound (@var{a}, @var{b}) Return a value that is always less than or equal to both @var{a} and @var{b}. It will be the greatest such value for some indeterminate values |