diff options
author | Aldy Hernandez <aldyh@redhat.com> | 2020-08-04 06:46:09 +0200 |
---|---|---|
committer | Giuliano Belinassi <giuliano.belinassi@usp.br> | 2020-08-17 15:07:28 -0300 |
commit | 737999420f7c4e5ba5fad57efb383e92c6fbdd20 (patch) | |
tree | a966affbdf7624ef9caefd9265e55c6ef1e329af | |
parent | 9a413698860b489ca0962a0b8e7fad450afdf7e1 (diff) | |
download | gcc-737999420f7c4e5ba5fad57efb383e92c6fbdd20.zip gcc-737999420f7c4e5ba5fad57efb383e92c6fbdd20.tar.gz gcc-737999420f7c4e5ba5fad57efb383e92c6fbdd20.tar.bz2 |
Adjust expr_not_equal_to to use irange API.
gcc/ChangeLog:
* fold-const.c (expr_not_equal_to): Adjust for irange API.
-rw-r--r-- | gcc/fold-const.c | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 1324a19..5d27927 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -10194,8 +10194,7 @@ tree_expr_nonzero_p (tree t) bool expr_not_equal_to (tree t, const wide_int &w) { - wide_int min, max, nz; - value_range_kind rtype; + value_range vr; switch (TREE_CODE (t)) { case INTEGER_CST: @@ -10204,17 +10203,9 @@ expr_not_equal_to (tree t, const wide_int &w) case SSA_NAME: if (!INTEGRAL_TYPE_P (TREE_TYPE (t))) return false; - rtype = get_range_info (t, &min, &max); - if (rtype == VR_RANGE) - { - if (wi::lt_p (max, w, TYPE_SIGN (TREE_TYPE (t)))) - return true; - if (wi::lt_p (w, min, TYPE_SIGN (TREE_TYPE (t)))) - return true; - } - else if (rtype == VR_ANTI_RANGE - && wi::le_p (min, w, TYPE_SIGN (TREE_TYPE (t))) - && wi::le_p (w, max, TYPE_SIGN (TREE_TYPE (t)))) + get_range_info (t, vr); + if (!vr.undefined_p () + && !vr.contains_p (wide_int_to_tree (TREE_TYPE (t), w))) return true; /* If T has some known zero bits and W has any of those bits set, then T is known not to be equal to W. */ |