[PATCH, pretty-ipa] Fix an acats testcase failure caused by new intra-SRA

Martin Jambor mjambor@suse.cz
Tue Mar 17 22:49:00 GMT 2009


Hi,

I have  found out why my  new intra-SRA was causing  an acats testcase
failure.  It is in  fact a serious bug and I am  very surprised it did
not turn  up earlier.   I have bootstrapped  and tested  the following
patch,  I will  commit  it  tomorrow unless  Honza  (or someone  else)
objects.

Thanks,

Martin


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

	* ipa-sra.c (build_access_tree_1): Propagate grp_write flag
	downwards in the access tree.

Index: isra/gcc/ipa-sra.c
===================================================================
--- isra.orig/gcc/ipa-sra.c
+++ isra/gcc/ipa-sra.c
@@ -207,7 +207,8 @@ struct access
      always performed when the function is run? */
   unsigned always_safe : 1;
 
-  /* Does this group contain a write access?  */
+  /* Does this group contain a write access?  This flag is propagated down the
+     acess tree.  */
   unsigned grp_write : 1;
   /* Does this group contain a read access?  This flag is propagated down the
      acess tree.  */
@@ -2948,7 +2949,7 @@ enum build_access_tree_result
 
 static enum build_access_tree_result
 build_access_tree_1 (struct access **access, bool allow_replacements,
-		     bool mark_read)
+		     bool mark_read, bool mark_write)
 {
   struct access *root = *access, *last_child = NULL;
   HOST_WIDE_INT limit = root->offset + root->size;
@@ -2961,6 +2962,11 @@ build_access_tree_1 (struct access **acc
   else if (root->grp_read)
     mark_read = true;
 
+  if (mark_write)
+    root->grp_write = true;
+  else if (root->grp_write)
+    mark_write = true;
+
   *access = (*access)->next_grp;
   while  (*access && (*access)->offset + (*access)->size <= limit)
     {
@@ -2978,7 +2984,7 @@ build_access_tree_1 (struct access **acc
       last_child = *access;
 
       subres = build_access_tree_1 (access, allow_replacements && !scalar,
-				    mark_read);
+				    mark_read, mark_write);
       if (subres != SRA_BAT_NONE)
 	sth_created = true;
       if (subres != SRA_BAT_SCALAR_COVERADGE)
@@ -3030,7 +3036,8 @@ build_access_tree (struct access *access
     {
       struct access *root = access;
 
-      ret |= (build_access_tree_1 (&access, true, false) != SRA_BAT_NONE);
+      ret |= (build_access_tree_1 (&access, true, false,
+				   false) != SRA_BAT_NONE);
       root->next_grp = access;
     }
 



More information about the Gcc-patches mailing list