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, pretty-ipa] More granular decisions about potential by_reference -> by_value conversion


Hi,

while  re-trying  my simple  testcases,  I  have  found that  function
splice_all_param_accesses  was  returning   a  wrong  value  when  all
to-be-broken-up  aggregate  parameters passed  by  reference had  some
modified access group even  though there were unmodified access groups
as well.

The precedence should be exactly the  other way round and that is what
the patch below does.  it is currently bootstrapping, I will commit it
tomorrow if everything is OK and nobody objects.

Thanks,

Martin

2009-03-24  Martin Jambor  <mjambor@suse.cz>

	* ipa-sra.c (splice_param_accesses): Replaced parameter parm_modified
	with parameter ro_grp.
	(splice_all_param_accesses): Return UNMODIF_BY_REF_ACCESSES
	whenever (at least once) returned ro_grp is true.

Index: isra/gcc/ipa-sra.c
===================================================================
--- isra.orig/gcc/ipa-sra.c
+++ isra/gcc/ipa-sra.c
@@ -1498,10 +1498,12 @@ compare_access_positions (const void *a,
    each accessed region and link them together.  Return NULL if there are no
    accesses or if there are different but overlapping accesses, return the
    special ptr value meaning there are no accesses for this parameter if that
-   is the case and return the first representative otherwise.  */
+   is the case and return the first representative otherwise.  If non-NULL, set
+   *RO_GRP if there is a group of accesses with only read (i.e. no write)
+   accesses. */
 
 static struct access *
-splice_param_accesses (tree parm, bool *parm_modified)
+splice_param_accesses (tree parm, bool *ro_grp)
 {
   int i, j, access_count, group_count;
   int agg_size, total_size = 0;
@@ -1564,8 +1566,8 @@ splice_param_accesses (tree parm, bool *
 
       group_count++;
       access->grp_maybe_modified = modification;
-      if (modification && parm_modified)
-	*parm_modified = true;
+      if (!modification && ro_grp)
+	*ro_grp = true;
       *prev_acc_ptr = access;
       prev_acc_ptr = &access->next_grp;
       total_size += access->size;
@@ -1700,15 +1702,15 @@ splice_all_param_accesses (VEC (access_p
 	}
       else if (bitmap_bit_p (candidate_bitmap, DECL_UID (parm)))
 	{
-	  bool modified = false;
-	  repr = splice_param_accesses (parm, &modified);
+	  bool ro_grp = false;
+	  repr = splice_param_accesses (parm, &ro_grp);
 	  VEC_quick_push (access_p, *representatives, repr);
 
 	  if (repr && !no_accesses_p (repr))
 	    {
 	      if (POINTER_TYPE_P (TREE_TYPE (parm)))
 		{
-		  if (!modified)
+		  if (ro_grp)
 		    result = UNMODIF_BY_REF_ACCESSES;
 		  else if (result < MODIF_BY_REF_ACCESSES)
 		    result = MODIF_BY_REF_ACCESSES;


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