This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch]Update new_type_alias

new_type_alias (tree ptr, tree var) is being called by the vectorizer to 
construct a
type tag for a pointer PTR that holds the address of the array VAR.  The 
new type tag
currently gets a may_aliases list that is a copy of the may_aliases of the 
array VAR.
With this change, if VAR has a single may_aliases which is a type tag then 
of constructing a new type tag for PTR, the type tag from VAR's 
may_aliases is
assigned to the type_mem_tag PTR.

As an example, from read-arch.c in the SPEC vpr benchmark.

Before Vectorization a loop contains the following statement:

#   TMT.643D.7803_38 = V_MAY_DEF <TMT.643D.7803_26>;
isreadD.4001[iD.4093_444] = 0;

isrreadD.4001 has a single member in its may_aliases list
TMT.643D.7803.  After vectorization, the array element reference
to isread is replaced with an INDIRECT_REF to a pointer to vector.
The version of new_type_alias assigns the tag TMT.643D.7803 to the
type_mem_tag of the pointer which keeps the aliasing identical.
debug_generic_stmt shows the replacement vectorized statement as:

#   TMT.643D.7803_38 = V_MAY_DEF <TMT.643D.7803_26>;
*vect_pisread.681D.7944_502 = vect_cst_.680D.7943_509;

There are uses of array isread after the vectorized loop which
continue to use the type memory tag.
For example.

#   VUSE <TMT.643D.7803_230>;
D.4379_651 = isreadD.4001[4];

tested on ppc

OK for mainline?



      2005-06-03  Keith Besaw  <>

      * tree-ssa-alias.c (new_type_alias): Use existing type
      tag if VAR has just one in its may_aliases list.

Index: tree-ssa-alias.c
RCS file: /cvsroot/gcc/gcc/gcc/tree-ssa-alias.c,v
retrieving revision 2.93
diff -u -3 -p -r2.93 tree-ssa-alias.c
--- tree-ssa-alias.c    29 May 2005 13:14:42 -0000      2.93
+++ tree-ssa-alias.c    3 Jun 2005 23:51:40 -0000
@@ -2776,8 +2776,11 @@ found_tag:
-/* Create a type tag for PTR.  Construct the may-alias list of this type 
-   so that it has the aliasing of VAR.  */
+/* Create a new type tag for PTR.  Construct the may-alias list of this 
+   tag so that it has the aliasing of VAR. 
+   Note, the set of aliases represented by the new type tag are not 
+   for renaming.  */
 new_type_alias (tree ptr, tree var)
@@ -2790,22 +2793,50 @@ new_type_alias (tree ptr, tree var)
   gcc_assert (p_ann->type_mem_tag == NULL_TREE);
   gcc_assert (v_ann->mem_tag_kind == NOT_A_TAG);
-  tag = create_memory_tag (tag_type, true);
-  p_ann->type_mem_tag = tag;
   /* Add VAR to the may-alias set of PTR's new type tag.  If VAR has
      subvars, add the subvars to the tag instead of the actual var.  */
   if (var_can_have_subvars (var)
       && (svars = get_subvars_for_var (var)))
-      subvar_t sv; 
+      subvar_t sv;
+      tag = create_memory_tag (tag_type, true);
+      p_ann->type_mem_tag = tag;
       for (sv = svars; sv; sv = sv->next)
         add_may_alias (tag, sv->var);
-    add_may_alias (tag, var);
-  /* Note, TAG and its set of aliases are not marked for renaming.  */
+    {
+      /* The following is based on code in add_stmt_operand to ensure 
that the
+         same defs/uses/vdefs/vuses will be found after replacing a 
+         to var (or ARRAY_REF to var) with an INDIRECT_REF to ptr whose 
+         is the address of var.  */
+      varray_type aliases = v_ann->may_aliases;
+      if ((aliases != NULL)
+          && (VARRAY_ACTIVE_SIZE (aliases) == 1))
+        {
+          tree ali = VARRAY_TREE (aliases, 0);
+          if (get_var_ann (ali)->mem_tag_kind == TYPE_TAG)
+            {
+              p_ann->type_mem_tag = ali;
+              return;
+            }
+        }
+      tag = create_memory_tag (tag_type, true);
+      p_ann->type_mem_tag = tag;
+      if (aliases == NULL)
+        add_may_alias (tag, var);
+      else
+        {
+          size_t i;
+          for (i = 0; i < VARRAY_ACTIVE_SIZE (aliases); i++)
+            add_may_alias (tag, VARRAY_TREE (aliases, i));
+        }
+    }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]