public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][committed][PR tree-optimization/82123] 05/06 Use EVRP range data in get_int_range.
@ 2018-02-20 18:57 Jeff Law
  0 siblings, 0 replies; only message in thread
From: Jeff Law @ 2018-02-20 18:57 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 175 bytes --]

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

[-- Attachment #2: P5 --]
[-- Type: text/plain, Size: 1225 bytes --]

	* 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)
 		{

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-02-20 18:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-20 18:57 [PATCH][committed][PR tree-optimization/82123] 05/06 Use EVRP range data in get_int_range Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).