diff mbox

[RFC,IPA-VRP] Teach tree-vrp to use the VR set in params

Message ID 57886AEC.5000603@linaro.org
State New
Headers show

Commit Message

Kugan Vivekanandarajah July 15, 2016, 4:47 a.m. UTC
Hi,



This patch teaches tree-vrp to use the VR set in params.



Thanks,

Kugan



gcc/ChangeLog:



2016-07-14  Kugan Vivekanandarajah  <kuganv@linaro.org>



          * tree-vrp.c (get_value_range): Teach PARM_DECL to use ipa-vrp

          results.
diff mbox

Patch

From 1900ff9210f1dd673f815b3a421c6ec1e02f6e05 Mon Sep 17 00:00:00 2001
From: Kugan Vivekanandarajah <kugan.vivekanandarajah@linaro.org>
Date: Thu, 14 Jul 2016 19:28:10 +1000
Subject: [PATCH 6/6] Teach tree-vrp to use ipa-vrp results

---
 gcc/tree-vrp.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 8c87c06..ad3891c 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -667,6 +667,20 @@  get_value_range (const_tree var)
 	  if (POINTER_TYPE_P (TREE_TYPE (sym))
 	      && nonnull_arg_p (sym))
 	    set_value_range_to_nonnull (vr, TREE_TYPE (sym));
+	  else if (!POINTER_TYPE_P (TREE_TYPE (sym)))
+	    {
+	      wide_int min, max;
+	      value_range_type rtype = get_range_info (var, &min, &max);
+	      if (rtype == VR_RANGE || rtype == VR_ANTI_RANGE)
+		{
+		  vr->type = rtype;
+		  vr->min = wide_int_to_tree (TREE_TYPE (var), min);
+		  vr->max = wide_int_to_tree (TREE_TYPE (var), max);
+		  vr->equiv = NULL;
+		}
+	      else
+		set_value_range_to_varying (vr);
+	    }
 	  else
 	    set_value_range_to_varying (vr);
 	}
-- 
1.9.1