[patch]Follow-on for aliasing on vector replacements to match original

Keith Besaw kbesaw@us.ibm.com
Thu May 26 12:17:00 GMT 2005


This patch continues the effort to have new_type_alias (ptr, var) create a 
type tag
for ptr whose aliasing matches that of var.  The addition in this patch 
looks for
a may_aliases list in the var_decl var and if found creates a duplicate 
list for the
may_aliases of the newly created type tag.  Otherwise when var has an 
empty
may_aliases list then the new type tag gets a may_aliases list of just 
var.

The patch includes the entire procedure new_type_alias because it is a new
procedure in a patch that has yet-to-be committed.  See
http://gcc.gnu.org/ml/gcc-patches/2005-05/msg02462.html.

tested on ppc it fixes a verify_ssa error in SPEC gcc reload1.c

OK for mainline?

Keith

Changelog:

      2005-05-26  Keith Besaw  <kbesaw@us.ibm.com>

      * tree-ssa-alias.c (new_type_alias): If the variable
        has a may_aliases list then duplicate it for the
        may_aliases list of the new type tag.

Index: tree-ssa-alias.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/tree-ssa-alias.c,v
retrieving revision 2.92
diff -u -3 -p -r2.92 tree-ssa-alias.c
--- tree-ssa-alias.c    24 May 2005 19:57:52 -0000      2.92
+++ tree-ssa-alias.c    26 May 2005 07:27:10 -0000
@@ -2776,6 +2776,57 @@ found_tag:
 }
 
 
+/* Create a new type tag for PTR.  Construct the may-alias list of this 
type tag
+   so that it has the aliasing of VAR.  */
+
+void
+new_type_alias (tree ptr, tree var)
+{
+  var_ann_t p_ann = var_ann (ptr);
+  tree tag_type = TREE_TYPE (TREE_TYPE (ptr));
+  var_ann_t v_ann = var_ann (var);
+  tree tag;
+  subvar_t svars;
+
+  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; 
+      for (sv = svars; sv; sv = sv->next)
+        add_may_alias (tag, sv->var);
+    }
+  else
+    {
+      /* The following is similar to code in add_stmt_operand so that 
replacing
+         a reference to var with an INDIRECT_REF to ptr will append the 
same
+         defs and uses.  */
+      varray_type aliases = v_ann->may_aliases;
+
+      if (aliases == NULL)
+        add_may_alias (tag, var);
+      else
+        {
+          /* FIXME, if aliases has just one member mbr which satisfies
+             get_var_ann (mbr)->mem_tag_kind == TYPE_TAG then should
+             p_ann->type_mem_tag be set to mbr (and avoid the call to
+             create_memory_tag)?  */
+          size_t i;
+          for (i = 0; i < VARRAY_ACTIVE_SIZE (aliases); i++)
+            add_may_alias (tag, VARRAY_TREE (aliases, i));
+        }
+    }
+
+  /* Note, TAG and its set of aliases are not marked for renaming.  */
+}
+
+
 /* This structure is simply used during pushing fields onto the 
fieldstack
    to track the offset of the field, since bitpos_of_field gives it 
relative
    to its immediate containing type, and we want it relative to the 
ultimate



More information about the Gcc-patches mailing list