aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2020-08-04 07:09:59 +0200
committerAldy Hernandez <aldyh@redhat.com>2020-08-04 07:23:42 +0200
commit92877ab81bf07ba732a3ac3263bcf3ecd45ec266 (patch)
treed77ccd8dc87b8599bd32ec818afa6872e959c9c2 /gcc
parent01aa5fcad27f87af833a003cf7b014bf9627e48c (diff)
downloadgcc-92877ab81bf07ba732a3ac3263bcf3ecd45ec266.zip
gcc-92877ab81bf07ba732a3ac3263bcf3ecd45ec266.tar.gz
gcc-92877ab81bf07ba732a3ac3263bcf3ecd45ec266.tar.bz2
Use irange API in test_for_singularity.
gcc/ChangeLog: * vr-values.c (test_for_singularity): Use irange API. (simplify_using_ranges::simplify_cond_using_ranges_1): Do not special case VR_RANGE.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/vr-values.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/gcc/vr-values.c b/gcc/vr-values.c
index 90ba8fc..e78b255 100644
--- a/gcc/vr-values.c
+++ b/gcc/vr-values.c
@@ -3480,10 +3480,13 @@ test_for_singularity (enum tree_code cond_code, tree op0,
value range information we have for op0. */
if (min && max)
{
- if (compare_values (vr->min (), min) == 1)
- min = vr->min ();
- if (compare_values (vr->max (), max) == -1)
- max = vr->max ();
+ tree type = TREE_TYPE (op0);
+ tree tmin = wide_int_to_tree (type, vr->lower_bound ());
+ tree tmax = wide_int_to_tree (type, vr->upper_bound ());
+ if (compare_values (tmin, min) == 1)
+ min = tmin;
+ if (compare_values (tmax, max) == -1)
+ max = tmax;
/* If the new min/max values have converged to a single value,
then there is only one value which can satisfy the condition,
@@ -3594,7 +3597,7 @@ simplify_using_ranges::simplify_cond_using_ranges_1 (gcond *stmt)
/* If we have range information for OP0, then we might be
able to simplify this conditional. */
- if (vr->kind () == VR_RANGE)
+ if (!vr->undefined_p () && !vr->varying_p ())
{
tree new_tree = test_for_singularity (cond_code, op0, op1, vr);
if (new_tree)