]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* vr-values.c (vr_values::get_value_range): Use value_range API
authoraldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 9 Nov 2018 09:52:43 +0000 (09:52 +0000)
committeraldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 9 Nov 2018 09:52:43 +0000 (09:52 +0000)
instead of piecing together ranges.
(vr_values::update_value_range): Same.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@265953 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/vr-values.c

index 0389eadb2f7fb93030bf6dcffc8aec1553f2431f..c84b0fd1860f372b3457baa39ce986277113e02d 100644 (file)
@@ -1,3 +1,9 @@
+2018-11-08  Aldy Hernandez  <aldyh@redhat.com>
+
+       * vr-values.c (vr_values::get_value_range): Use value_range API
+       instead of piecing together ranges.
+       (vr_values::update_value_range): Same.
+
 2018-11-08  Aldy Hernandez  <aldyh@redhat.com>
 
        * gimple-fold.c (size_must_be_zero_p): Use value_range API instead
index 8c9fd159146883bcc4c52209ee9860bf49cfdaf1..4edc5a467eee7754f0ca13de17b71cc0d6926567 100644 (file)
@@ -121,15 +121,9 @@ vr_values::get_value_range (const_tree var)
            set_value_range_to_nonnull (vr, TREE_TYPE (sym));
          else if (INTEGRAL_TYPE_P (TREE_TYPE (sym)))
            {
-             wide_int min, max;
-             value_range_kind rtype = get_range_info (var, &min, &max);
-             if (rtype == VR_RANGE || rtype == VR_ANTI_RANGE)
-               set_value_range (vr, rtype,
-                                wide_int_to_tree (TREE_TYPE (var), min),
-                                wide_int_to_tree (TREE_TYPE (var), max),
-                                NULL);
-             else
-               set_value_range_to_varying (vr);
+             get_range_info (var, *vr);
+             if (vr->undefined_p ())
+               vr->set_varying ();
            }
          else
            set_value_range_to_varying (vr);
@@ -178,17 +172,10 @@ vr_values::update_value_range (const_tree var, value_range *new_vr)
      factor that in.  */
   if (INTEGRAL_TYPE_P (TREE_TYPE (var)))
     {
-      wide_int min, max;
-      value_range_kind rtype = get_range_info (var, &min, &max);
+      value_range nr;
+      value_range_kind rtype = get_range_info (var, nr);
       if (rtype == VR_RANGE || rtype == VR_ANTI_RANGE)
-       {
-         tree nr_min, nr_max;
-         nr_min = wide_int_to_tree (TREE_TYPE (var), min);
-         nr_max = wide_int_to_tree (TREE_TYPE (var), max);
-         value_range nr;
-         nr.set_and_canonicalize (rtype, nr_min, nr_max, NULL);
-         new_vr->intersect (&nr);
-       }
+       new_vr->intersect (&nr);
     }
 
   /* Update the value range, if necessary.  */