Patchwork [ping,1,of,2] Add value range info to SSA_NAME for zero sign extension elimination in RTL

login
register
mail settings
Submitter Christophe Lyon
Date Sept. 24, 2013, 4 p.m.
Message ID <CAKdteObs3aneXxqHLt8BK5SXs_Qb_x4ZuGQCTN16=ODL8LWysA@mail.gmail.com>
Download mbox | patch
Permalink /patch/277532/
State New
Headers show

Comments

Christophe Lyon - Sept. 24, 2013, 4 p.m.
On 23 September 2013 22:34, Eric Botcazou <ebotcazou@adacore.com> wrote:
> Nice patch, but the formatting is totally wrong wrt spaces, please reformat
> using 2-space indentation and 8-space TABs, as already used in the files.
>

Sorry for missing this problem when committing Kugan's patch.

I have just committed the attached patch, which I hope fixes all the
spaces/indentation issues introduced.

Christophe.

2013-09-24  Christophe Lyon  <christophe.lyon@linaro.org>

    * gimple-pretty-print.c: Various whitespace tweaks.
    * tree-core.h: Likewise.
    * tree-pretty-print.c: Likewise.
    * tree-ssa-alias.c: Likewise.
    * tree-ssa-copy.c: Likewise.
    * tree-ssanames.c: Likewise.
    * tree-ssanames.h: Likewise.
    * tree-vrp.c: Likewise.
Eric Botcazou - Sept. 25, 2013, 5:21 p.m.
> Sorry for missing this problem when committing Kugan's patch.
> 
> I have just committed the attached patch, which I hope fixes all the
> spaces/indentation issues introduced.

Thanks a lot!

Patch

Index: gcc/tree-vrp.c
===================================================================
--- gcc/tree-vrp.c	(revision 202868)
+++ gcc/tree-vrp.c	(revision 202869)
@@ -9451,48 +9451,48 @@  vrp_finalize (void)
 
   /* Set value range to non pointer SSA_NAMEs.  */
   for (i  = 0; i < num_vr_values; i++)
-   if (vr_value[i])
-    {
-      tree name = ssa_name (i);
+    if (vr_value[i])
+      {
+	tree name = ssa_name (i);
 
       if (!name
 	  || POINTER_TYPE_P (TREE_TYPE (name))
-          || (vr_value[i]->type == VR_VARYING)
-          || (vr_value[i]->type == VR_UNDEFINED))
-        continue;
-
-      if ((TREE_CODE (vr_value[i]->min) == INTEGER_CST)
-          && (TREE_CODE (vr_value[i]->max) == INTEGER_CST))
-        {
-          if (vr_value[i]->type == VR_RANGE)
-            set_range_info (name,
-                            tree_to_double_int (vr_value[i]->min),
-                            tree_to_double_int (vr_value[i]->max));
-          else if (vr_value[i]->type == VR_ANTI_RANGE)
-            {
-              /* VR_ANTI_RANGE ~[min, max] is encoded compactly as
-                 [max + 1, min - 1] without additional attributes.
-                 When min value > max value, we know that it is
-                 VR_ANTI_RANGE; it is VR_RANGE otherwise.  */
-
-	      /* ~[0,0] anti-range is represented as
-                 range.  */
-              if (TYPE_UNSIGNED (TREE_TYPE (name))
-                  && integer_zerop (vr_value[i]->min)
-                  && integer_zerop (vr_value[i]->max))
-                set_range_info (name,
-                                double_int_one,
-                                double_int::max_value
-                                (TYPE_PRECISION (TREE_TYPE (name)), true));
-              else
-                set_range_info (name,
-                                tree_to_double_int (vr_value[i]->max)
-                                + double_int_one,
-                                tree_to_double_int (vr_value[i]->min)
-                                - double_int_one);
-            }
-        }
-    }
+	  || (vr_value[i]->type == VR_VARYING)
+	  || (vr_value[i]->type == VR_UNDEFINED))
+	continue;
+
+	if ((TREE_CODE (vr_value[i]->min) == INTEGER_CST)
+	    && (TREE_CODE (vr_value[i]->max) == INTEGER_CST))
+	  {
+	    if (vr_value[i]->type == VR_RANGE)
+	      set_range_info (name,
+			      tree_to_double_int (vr_value[i]->min),
+			      tree_to_double_int (vr_value[i]->max));
+	    else if (vr_value[i]->type == VR_ANTI_RANGE)
+	      {
+		/* VR_ANTI_RANGE ~[min, max] is encoded compactly as
+		   [max + 1, min - 1] without additional attributes.
+		   When min value > max value, we know that it is
+		   VR_ANTI_RANGE; it is VR_RANGE otherwise.  */
+
+		/* ~[0,0] anti-range is represented as
+		   range.  */
+		if (TYPE_UNSIGNED (TREE_TYPE (name))
+		    && integer_zerop (vr_value[i]->min)
+		    && integer_zerop (vr_value[i]->max))
+		  set_range_info (name,
+				  double_int_one,
+				  double_int::max_value
+				  (TYPE_PRECISION (TREE_TYPE (name)), true));
+		else
+		  set_range_info (name,
+				  tree_to_double_int (vr_value[i]->max)
+				  + double_int_one,
+				  tree_to_double_int (vr_value[i]->min)
+				  - double_int_one);
+	      }
+	  }
+      }
 
   /* Free allocated memory.  */
   for (i = 0; i < num_vr_values; i++)
Index: gcc/tree-pretty-print.c
===================================================================
--- gcc/tree-pretty-print.c	(revision 202868)
+++ gcc/tree-pretty-print.c	(revision 202869)
@@ -1063,8 +1063,8 @@  dump_generic_node (pretty_printer *buffe
 	  pp_string (buffer, "B"); /* pseudo-unit */
 	}
       else
-        pp_double_int (buffer, tree_to_double_int (node),
-                       TYPE_UNSIGNED (TREE_TYPE (node)));
+	pp_double_int (buffer, tree_to_double_int (node),
+		       TYPE_UNSIGNED (TREE_TYPE (node)));
       break;
 
     case REAL_CST:
@@ -3191,16 +3191,16 @@  pp_double_int (pretty_printer *pp, doubl
       unsigned HOST_WIDE_INT low = d.low;
       HOST_WIDE_INT high = d.high;
       if (!uns && d.is_negative ())
-        {
-          pp_minus (pp);
-          high = ~high + !low;
-          low = -low;
-        }
+	{
+	  pp_minus (pp);
+	  high = ~high + !low;
+	  low = -low;
+	}
       /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
-         systems?  */
+	 systems?  */
       sprintf (pp_buffer (pp)->digit_buffer,
-               HOST_WIDE_INT_PRINT_DOUBLE_HEX,
-               (unsigned HOST_WIDE_INT) high, low);
+	       HOST_WIDE_INT_PRINT_DOUBLE_HEX,
+	       (unsigned HOST_WIDE_INT) high, low);
       pp_string (pp, pp_buffer (pp)->digit_buffer);
     }
 }
Index: gcc/tree-ssa-alias.c
===================================================================
--- gcc/tree-ssa-alias.c	(revision 202868)
+++ gcc/tree-ssa-alias.c	(revision 202869)
@@ -404,7 +404,7 @@  dump_alias_info (FILE *file)
       struct ptr_info_def *pi;
 
       if (ptr == NULL_TREE
-          || !POINTER_TYPE_P (TREE_TYPE (ptr))
+	  || !POINTER_TYPE_P (TREE_TYPE (ptr))
 	  || SSA_NAME_IN_FREE_LIST (ptr))
 	continue;
 
Index: gcc/gimple-pretty-print.c
===================================================================
--- gcc/gimple-pretty-print.c	(revision 202868)
+++ gcc/gimple-pretty-print.c	(revision 202869)
@@ -1632,17 +1632,17 @@  dump_ssaname_info (pretty_printer *buffe
       value_range_type range_type = get_range_info (node, &min, &max);
 
       if (range_type == VR_VARYING)
-        pp_printf (buffer, "# RANGE  VR_VARYING");
+	pp_printf (buffer, "# RANGE  VR_VARYING");
       else if (range_type == VR_RANGE || range_type == VR_ANTI_RANGE)
-        {
-          pp_printf (buffer, "# RANGE ");
-          pp_printf (buffer, "%s[", range_type == VR_RANGE ? "" : "~");
-          pp_double_int (buffer, min, TYPE_UNSIGNED (TREE_TYPE (node)));
-          pp_printf (buffer, ", ");
-          pp_double_int (buffer, max, TYPE_UNSIGNED (TREE_TYPE (node)));
-          pp_printf (buffer, "]");
-          newline_and_indent (buffer, spc);
-        }
+	{
+	  pp_printf (buffer, "# RANGE ");
+	  pp_printf (buffer, "%s[", range_type == VR_RANGE ? "" : "~");
+	  pp_double_int (buffer, min, TYPE_UNSIGNED (TREE_TYPE (node)));
+	  pp_printf (buffer, ", ");
+	  pp_double_int (buffer, max, TYPE_UNSIGNED (TREE_TYPE (node)));
+	  pp_printf (buffer, "]");
+	  newline_and_indent (buffer, spc);
+	}
     }
 }
 
@@ -1661,8 +1661,8 @@  dump_gimple_phi (pretty_printer *buffer,
     dump_ssaname_info (buffer, lhs, spc);
 
   if (flags & TDF_RAW)
-      dump_gimple_fmt (buffer, spc, flags, "%G <%T, ", phi,
-                       gimple_phi_result (phi));
+    dump_gimple_fmt (buffer, spc, flags, "%G <%T, ", phi,
+		     gimple_phi_result (phi));
   else
     {
       dump_generic_node (buffer, lhs, spc, flags, false);
Index: gcc/tree-ssa-copy.c
===================================================================
--- gcc/tree-ssa-copy.c	(revision 202868)
+++ gcc/tree-ssa-copy.c	(revision 202869)
@@ -767,19 +767,19 @@  fini_copy_prop (void)
 	 of the representative to the first solution we find if
 	 it doesn't have one already.  */
       if (copy_of[i].value != var
-          && TREE_CODE (copy_of[i].value) == SSA_NAME)
-        {
-          if (POINTER_TYPE_P (TREE_TYPE (var))
-              && SSA_NAME_PTR_INFO (var)
-              && !SSA_NAME_PTR_INFO (copy_of[i].value))
-            duplicate_ssa_name_ptr_info (copy_of[i].value,
-                                         SSA_NAME_PTR_INFO (var));
-          else if (!POINTER_TYPE_P (TREE_TYPE (var))
-                   && SSA_NAME_RANGE_INFO (var)
-                   && !SSA_NAME_RANGE_INFO (copy_of[i].value))
-            duplicate_ssa_name_range_info (copy_of[i].value,
-                                           SSA_NAME_RANGE_INFO (var));
-        }
+	  && TREE_CODE (copy_of[i].value) == SSA_NAME)
+	{
+	  if (POINTER_TYPE_P (TREE_TYPE (var))
+	      && SSA_NAME_PTR_INFO (var)
+	      && !SSA_NAME_PTR_INFO (copy_of[i].value))
+	    duplicate_ssa_name_ptr_info (copy_of[i].value,
+					 SSA_NAME_PTR_INFO (var));
+	  else if (!POINTER_TYPE_P (TREE_TYPE (var))
+		   && SSA_NAME_RANGE_INFO (var)
+		   && !SSA_NAME_RANGE_INFO (copy_of[i].value))
+	    duplicate_ssa_name_range_info (copy_of[i].value,
+					   SSA_NAME_RANGE_INFO (var));
+	}
     }
 
   /* Don't do DCE if SCEV is initialized.  It would destroy the scev cache.  */
Index: gcc/tree-core.h
===================================================================
--- gcc/tree-core.h	(revision 202868)
+++ gcc/tree-core.h	(revision 202869)
@@ -1058,7 +1058,7 @@  struct GTY(()) tree_ssa_name {
     /* Value range attributes used for zero/sign extension elimination.  */
     struct GTY ((tag ("1"))) range_info_def *range_info;
   } GTY ((desc ("%1.typed.type ?" \
-                "!POINTER_TYPE_P (TREE_TYPE ((tree)&%1)) : 2"))) info;
+		"!POINTER_TYPE_P (TREE_TYPE ((tree)&%1)) : 2"))) info;
 
   /* Immediate uses list for this SSA_NAME.  */
   struct ssa_use_operand_d imm_uses;
Index: gcc/tree-ssanames.c
===================================================================
--- gcc/tree-ssanames.c	(revision 202868)
+++ gcc/tree-ssanames.c	(revision 202869)
@@ -206,7 +206,7 @@  get_range_info (tree name, double_int *m
   /* Return VR_VARYING for SSA_NAMEs with NULL RANGE_INFO or SSA_NAMEs
      with integral types width > 2 * HOST_BITS_PER_WIDE_INT precision.  */
   if (!ri || (GET_MODE_PRECISION (TYPE_MODE (TREE_TYPE (name)))
-              > 2 * HOST_BITS_PER_WIDE_INT))
+	      > 2 * HOST_BITS_PER_WIDE_INT))
     return VR_VARYING;
 
   /* If min > max, it is VR_ANTI_RANGE.  */
@@ -455,14 +455,14 @@  duplicate_ssa_name_fn (struct function *
       struct ptr_info_def *old_ptr_info = SSA_NAME_PTR_INFO (name);
 
       if (old_ptr_info)
-        duplicate_ssa_name_ptr_info (new_name, old_ptr_info);
+	duplicate_ssa_name_ptr_info (new_name, old_ptr_info);
     }
   else
     {
       struct range_info_def *old_range_info = SSA_NAME_RANGE_INFO (name);
 
       if (old_range_info)
-        duplicate_ssa_name_range_info (new_name, old_range_info);
+	duplicate_ssa_name_range_info (new_name, old_range_info);
     }
 
   return new_name;
Index: gcc/tree-ssanames.h
===================================================================
--- gcc/tree-ssanames.h	(revision 202868)
+++ gcc/tree-ssanames.h	(revision 202869)
@@ -71,7 +71,7 @@  enum value_range_type { VR_UNDEFINED, VR
 extern void set_range_info (tree ssa, double_int min, double_int max);
 /* Gets the value range from SSA.  */
 extern enum value_range_type  get_range_info (tree name, double_int *min,
-                                              double_int *max);
+					      double_int *max);
 extern void init_ssanames (struct function *, int);
 extern void fini_ssanames (void);
 extern void ssanames_print_statistics (void);