[PATCH][committed][PR tree-optimization/82123] 05/06 Use EVRP range data in get_int_range.
Jeff Law
law@redhat.com
Tue Feb 20 18:57:00 GMT 2018
This is the 5th patch in the series. It updates another global range
query to instead use the EVRP range data. Bootstrapped and regression
tested on x86_64-linux-gnu.
Jeff
-------------- next part --------------
* gimple-ssa-sprintf.c (get_int_range): Query EVRP range analyzer for
range data rather than using global data.
diff --git a/gcc/gimple-ssa-sprintf.c b/gcc/gimple-ssa-sprintf.c
index 54c9132..b3ffaec 100644
--- a/gcc/gimple-ssa-sprintf.c
+++ b/gcc/gimple-ssa-sprintf.c
@@ -1149,9 +1149,10 @@ get_int_range (tree arg, HOST_WIDE_INT *pmin, HOST_WIDE_INT *pmax,
&& TYPE_PRECISION (argtype) <= TYPE_PRECISION (type))
{
/* Try to determine the range of values of the integer argument. */
- wide_int min, max;
- enum value_range_type range_type = get_range_info (arg, &min, &max);
- if (range_type == VR_RANGE)
+ value_range *vr = vr_values->get_value_range (arg);
+ if (vr->type == VR_RANGE
+ && TREE_CODE (vr->min) == INTEGER_CST
+ && TREE_CODE (vr->max) == INTEGER_CST)
{
HOST_WIDE_INT type_min
= (TYPE_UNSIGNED (argtype)
@@ -1160,8 +1161,8 @@ get_int_range (tree arg, HOST_WIDE_INT *pmin, HOST_WIDE_INT *pmax,
HOST_WIDE_INT type_max = tree_to_uhwi (TYPE_MAX_VALUE (argtype));
- *pmin = min.to_shwi ();
- *pmax = max.to_shwi ();
+ *pmin = TREE_INT_CST_LOW (vr->min);
+ *pmax = TREE_INT_CST_LOW (vr->max);
if (*pmin < *pmax)
{
More information about the Gcc-patches
mailing list