This is the mail archive of the gcc-patches@gcc.gnu.org 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]

[tree-ssa] Aliasing issues revisited


Hi,
after deeper tought and some sleep, the whole issue of aliasing is so
dificult to track with because too many components are affected by
changed aliasing decisions.  We do have three independent areas of
problems:

1) Saving parm/var decls needed for re-compilation
2) Tree-ssa optimizers directly using aliasing information
3) expanders having different notion of semantics of addressable flags
4) front-end specific code relying on orignal semantics of the flags.

After last week confusion it is more than clear that changing all at
once is behind my abilities and thus it seems to me that we can do it in
three steps. (2,3,1+4). Doing step 2) would make it possible to add
sanity checking, tail recursion and remove FIXME hacks in the mustalias
that is itself very important for Diego's and mine's future plans.

The attached patch contains pure bugfixes to mustalias needed to get aliasing
infromation right on conservative side and an temporary hack to save the
addresability flags and restore them before expansion.

There are no regressions on i686-pc-gnu-linux nor x86-64 (x86-64 with yesterday
moring tree, today tree no longer bootstraps libjava for me).  Bootstrap is
fixed on my Debian i386 machine.
The gcc.c-torture/execute/20010403-1.c failures is fixed by this patch.

As an alternative, I can create branch (tree-ssa-checking) where I can do the
incremental steps and try to merge it at once once this is stabilized on
several platforms.  In that case, I would very welcome if patches to that
branch has been reviewed the usual was as for tree-ssa-branch so merging
procedure would be fluent.

Hope this helps,
Honza Hubicka
2003-11-23  Jan Hubicka  <jh@suse.cz>
	Temporary hack to save addressable flags & fixes to mustalias.
	* tree-dfa.c (referenced_vars_addressable_p): New.
	(add_referenced_vars): Save addressable flag.
	* tree-flow.h (referenced_vars_addressable_p): Declare
	* tree-mustalias.c (find_addressable_vars): Deal with complex addresses.
	(promote_var): Clear may_point_to_global_mem.
	* tree-ssa.c (init_tree_ssa): Initialize new referenced_vars_addressable_p.
	(delete_tree_ssa): Restore addressable flags.
Index: tree-dfa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-dfa.c,v
retrieving revision 1.1.4.187
diff -c -3 -p -r1.1.4.187 tree-dfa.c
*** tree-dfa.c	21 Nov 2003 23:17:17 -0000	1.1.4.187
--- tree-dfa.c	23 Nov 2003 10:10:11 -0000
*************** static tree find_hidden_use_vars_r (tree
*** 147,152 ****
--- 147,153 ----
  
  /* Array of all variables referenced in the function.  */
  varray_type referenced_vars;
+ varray_type referenced_vars_addressable_p;
  
  /* Arrays for all the call clobbered variables in the function.  */
  varray_type call_clobbered_vars;
*************** add_referenced_var (tree var, struct wal
*** 2577,2582 ****
--- 2578,2584 ----
  	*slot = (void *) var;
        v_ann->uid = num_referenced_vars;
        VARRAY_PUSH_TREE (referenced_vars, var);
+       VARRAY_PUSH_CHAR (referenced_vars_addressable_p, TREE_ADDRESSABLE (var));
  
        /* Arguments or global variable pointers may point to memory outside
  	 the current function.  */
Index: tree-flow.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-flow.h,v
retrieving revision 1.1.4.158
diff -c -3 -p -r1.1.4.158 tree-flow.h
*** tree-flow.h	20 Nov 2003 20:54:39 -0000	1.1.4.158
--- tree-flow.h	23 Nov 2003 10:10:11 -0000
*************** static inline bitmap dom_children (basic
*** 339,344 ****
--- 339,345 ----
  ---------------------------------------------------------------------------*/
  /* Array of all variables referenced in the function.  */
  extern GTY(()) varray_type referenced_vars;
+ extern GTY(()) varray_type referenced_vars_addressable_p;
  
  #define num_referenced_vars VARRAY_ACTIVE_SIZE (referenced_vars)
  #define referenced_var(i) VARRAY_TREE (referenced_vars, i)
Index: tree-must-alias.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-must-alias.c,v
retrieving revision 1.1.2.10
diff -c -3 -p -r1.1.2.10 tree-must-alias.c
*** tree-must-alias.c	21 Nov 2003 22:56:00 -0000	1.1.2.10
--- tree-must-alias.c	23 Nov 2003 10:10:11 -0000
*************** find_addressable_vars (sbitmap addresses
*** 172,180 ****
--- 172,191 ----
  	    {
  	      tree t = PHI_ARG_DEF (phi, i);
  
+ 	      if (TREE_CODE (t) == NOP_EXPR)
+ 		t = TREE_OPERAND (t, 0);
+ 
+ 	      if (TREE_CODE (t) == PLUS_EXPR)
+ 		t = TREE_OPERAND (t, 0);
+ 
  	      if (TREE_CODE (t) != ADDR_EXPR)
  		continue;
  	      t = TREE_OPERAND (t, 0);
+ 	      if (TREE_CODE (t) == ARRAY_REF
+ 		  || TREE_CODE (t) == COMPONENT_REF
+ 		  || TREE_CODE (t) == REALPART_EXPR
+ 		  || TREE_CODE (t) == IMAGPART_EXPR)
+ 		t = TREE_OPERAND (t, 0);
  	      if (TREE_CODE (t) != VAR_DECL && TREE_CODE (t) != PARM_DECL)
  		continue;
  	      SET_BIT (addresses_needed, var_ann (t)->uid);
*************** promote_var (tree var, sbitmap vars_to_r
*** 217,223 ****
    ann->may_aliases = NULL;
    ann->is_call_clobbered = 0;
    ann->may_alias_global_mem = 0;
-   ann->may_point_to_global_mem = 0;
  
    /* If the variable was an alias tag, remove it from every variable that
       had it in its may-alias set.  */
--- 228,233 ----
Index: tree-ssa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa.c,v
retrieving revision 1.1.4.160
diff -c -3 -p -r1.1.4.160 tree-ssa.c
*** tree-ssa.c	22 Nov 2003 04:13:49 -0000	1.1.4.160
--- tree-ssa.c	23 Nov 2003 10:10:12 -0000
*************** void
*** 2955,2960 ****
--- 2955,2961 ----
  init_tree_ssa (void)
  {
    VARRAY_TREE_INIT (referenced_vars, 20, "referenced_vars");
+   VARRAY_CHAR_INIT (referenced_vars_addressable_p, 20, "referenced_vars_addressable_p");
    VARRAY_TREE_INIT (call_clobbered_vars, 20, "call_clobbered_vars");
    init_ssanames ();
    memset (&ssa_stats, 0, sizeof (ssa_stats));
*************** delete_tree_ssa (tree fndecl)
*** 2974,2984 ****
--- 2975,2990 ----
  
    /* Remove annotations from every referenced variable.  */
    for (i = 0; i < num_referenced_vars; i++)
+   {
      referenced_var (i)->common.ann = NULL;
+     if (VARRAY_ACTIVE_SIZE (referenced_vars_addressable_p) > i)
+     TREE_ADDRESSABLE (referenced_var (i)) = VARRAY_CHAR (referenced_vars_addressable_p, i);
+   }
  
    fini_ssanames ();
  
    referenced_vars = NULL;
+   referenced_vars_addressable_p = NULL;
    global_var = NULL_TREE;
    call_clobbered_vars = NULL;
  }


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