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]

[PATCH][RFC] Make parameter aliasing for Fortran more efficient


Currently for parameters to Fortran functions we mark them aliasing only
theirselves by creating a heap object which they point to

 PARM_NOALIAS.594 = &ESCAPED
 PARM_NOALIAS.594.196+196 = &ESCAPED
 self = &PARM_NOALIAS.594

as you may notice that dereferencing self will lead to pointers pointing
to global memory.  This of course makes parameter aliasing quite
uneffective for array descriptors, as the actual array data is just a
pointer in the array descriptor data...  which means the actual data
just is in global memory and will use regular type tags.

Now, the fix is easy - just pretend Fortran arguments transitively
point to distinct memory by doing

 PARM_NOALIAS.594 = &PARM_NOALIAS.594
 self = &PARM_NOALIAS.594

instead.  This allows a whole bunch of optimizations in tonto at least.

Bootstrap / regtest in progress.  I'd appreciate some other Fortran
benchmarking (and verification).

Thanks,
Richard.

2008-08-04  Richard Guenther  <rguenther@suse.de>

	* tree-ssa-structalias.c (create_variable_info_for): Do not
	create fields for heap vars or vars with a noalias state.
	For NO_ALIAS_ANYTHING variables add a self-constraint, not one
	from ESCAPED.

Index: gcc/tree-ssa-structalias.c
===================================================================
*** gcc/tree-ssa-structalias.c	(revision 138611)
--- gcc/tree-ssa-structalias.c	(working copy)
*************** create_variable_info_for (tree decl, con
*** 4354,4360 ****
    if (TREE_CODE (decl) == FUNCTION_DECL && in_ipa_mode)
      return create_function_info_for (decl, name);
  
!   if (var_can_have_subvars (decl) && use_field_sensitive)
      push_fields_onto_fieldstack (decltype, &fieldstack, 0);
  
    /* If the variable doesn't have subvars, we may end up needing to
--- 4354,4364 ----
    if (TREE_CODE (decl) == FUNCTION_DECL && in_ipa_mode)
      return create_function_info_for (decl, name);
  
!   if (var_can_have_subvars (decl) && use_field_sensitive
!       && (!var_ann (decl)
! 	  || var_ann (decl)->noalias_state == 0)
!       && (!var_ann (decl)
! 	  || !var_ann (decl)->is_heapvar))
      push_fields_onto_fieldstack (decltype, &fieldstack, 0);
  
    /* If the variable doesn't have subvars, we may end up needing to
*************** create_variable_info_for (tree decl, con
*** 4380,4386 ****
    VEC_safe_push (varinfo_t, heap, varmap, vi);
    if (is_global && (!flag_whole_program || !in_ipa_mode)
        && could_have_pointers (decl))
!     make_constraint_from (vi, escaped_id);
  
    stats.total_vars++;
    if (use_field_sensitive
--- 4384,4396 ----
    VEC_safe_push (varinfo_t, heap, varmap, vi);
    if (is_global && (!flag_whole_program || !in_ipa_mode)
        && could_have_pointers (decl))
!     {
!       if (var_ann (decl)
! 	  && var_ann (decl)->noalias_state == NO_ALIAS_ANYTHING)
! 	make_constraint_from (vi, vi->id);
!       else
! 	make_constraint_from (vi, escaped_id);
!     }
  
    stats.total_vars++;
    if (use_field_sensitive


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