diff options
author | Aldy Hernandez <aldyh@redhat.com> | 2020-04-01 18:52:16 +0200 |
---|---|---|
committer | Aldy Hernandez <aldyh@redhat.com> | 2020-04-02 11:05:34 +0200 |
commit | 762129fe3681760cf93833f81bf3f23a1e8e2591 (patch) | |
tree | 21b5bb2fc81d7632c1e552609cb61034074af981 | |
parent | c6b05b86edbdc0d00e54145a115135c84cbf8402 (diff) | |
download | gcc-762129fe3681760cf93833f81bf3f23a1e8e2591.zip gcc-762129fe3681760cf93833f81bf3f23a1e8e2591.tar.gz gcc-762129fe3681760cf93833f81bf3f23a1e8e2591.tar.bz2 |
Adjust value_inside_range() for irange.
Any uses of VR_ANTI_RANGE are problematic if the caller sent in an
irange that has more than <1> sub-range. So all functions that
receive an irange should be adjusted to NEVER use VR_ANTI_RANGE.
-rw-r--r-- | gcc/value-range.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/value-range.cc b/gcc/value-range.cc index 4a4c487..c2290dc 100644 --- a/gcc/value-range.cc +++ b/gcc/value-range.cc @@ -869,6 +869,15 @@ irange::value_inside_range (tree val) const if (undefined_p ()) return 0; + /* For constants we can just intersect and avoid using VR_ANTI_RANGE + code further below. */ + if (constant_p ()) + { + value_range v (val, val); + v.intersect (this); + return v == value_range (val, val) ? 1 : 0; + } + cmp1 = operand_less_p (val, min ()); if (cmp1 == -2) return -2; |