aboutsummaryrefslogtreecommitdiff
path: root/gcc/ipa-prop.c
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2019-10-07 11:43:13 +0000
committerAldy Hernandez <aldyh@gcc.gnu.org>2019-10-07 11:43:13 +0000
commit523fe5b61119c17d9b5adf4a6a4cffa10cfaacf7 (patch)
tree4617fdf345a30e048b11728ab4f252205401b94e /gcc/ipa-prop.c
parent3faf75d458529592007436a0972f44e14ebf46f6 (diff)
downloadgcc-523fe5b61119c17d9b5adf4a6a4cffa10cfaacf7.zip
gcc-523fe5b61119c17d9b5adf4a6a4cffa10cfaacf7.tar.gz
gcc-523fe5b61119c17d9b5adf4a6a4cffa10cfaacf7.tar.bz2
Disentangle range_fold_*ary_expr() into various independent pieces.
From-SVN: r276654
Diffstat (limited to 'gcc/ipa-prop.c')
-rw-r--r--gcc/ipa-prop.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index e79add1..20a0bdd 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -5109,6 +5109,18 @@ ipcp_update_bits (struct cgraph_node *node)
}
}
+bool
+ipa_vr::nonzero_p (tree expr_type) const
+{
+ if (type == VR_ANTI_RANGE && wi::eq_p (min, 0) && wi::eq_p (max, 0))
+ return true;
+
+ unsigned prec = TYPE_PRECISION (expr_type);
+ return (type == VR_RANGE
+ && wi::eq_p (min, wi::one (prec))
+ && wi::eq_p (max, wi::max_value (prec, TYPE_SIGN (expr_type))));
+}
+
/* Update value range of formal parameters as described in
ipcp_transformation. */
@@ -5181,9 +5193,7 @@ ipcp_update_vr (struct cgraph_node *node)
TYPE_SIGN (type)));
}
else if (POINTER_TYPE_P (TREE_TYPE (ddef))
- && vr[i].type == VR_ANTI_RANGE
- && wi::eq_p (vr[i].min, 0)
- && wi::eq_p (vr[i].max, 0))
+ && vr[i].nonzero_p (TREE_TYPE (ddef)))
{
if (dump_file)
fprintf (dump_file, "Setting nonnull for %u\n", i);