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] Fix wave ICE in SRA


Hi,

the patch  below fixes  an ICE on  assert in intra-SRA  when compiling
boost (this issue is already fixed in the trunk patch).

The problem is that I wrongly assumed that in an assignment in between
types  conforming  to useless_type_conversion_p()  the  sizes of  both
sides would be the same.  Obviously  they need not to be.  In fact the
RHS  was  substantially  bigger  in  this case,  which  might  confuse
propagating accesses.   I try to  be as bold  as I can and  only limit
propagation of sub-accesses that would be outside their new base.

The following patch does just  that, fixes the issue and bootstraps on
trunk.  Pretty-ipa  branch does not bootstrap for  me, I'll bootstrap,
test and commit the patch once it does.


Thanks,

Martin

2009-04-29  Martin Jambor  <mjambor@suse.cz>

	* ipa-sra.c (propagate_subacesses_accross_link): Check that
	new sub-accesses would not be outside of their new base.
	(build_accesses_from_assign): Remove size equality assert.


Index: isra/gcc/ipa-sra.c
===================================================================
--- isra.orig/gcc/ipa-sra.c
+++ isra/gcc/ipa-sra.c
@@ -1309,7 +1309,6 @@ build_accesses_from_assign (gimple *stmt
     {
       struct assign_link *link;
 
-      gcc_assert (lacc->size == racc->size);
       link = (struct assign_link *) pool_alloc (link_pool);
       memset (link, 0, sizeof (struct assign_link));
 
@@ -3008,19 +3007,19 @@ propagate_subacesses_accross_link (struc
 {
   struct access *rchild;
   HOST_WIDE_INT norm_delta = lacc->offset - racc->offset;
+  HOST_WIDE_INT lbase_size = tree_low_cst (DECL_SIZE (lacc->base), 1);
   bool ret = false;
 
-  if (is_sra_scalar_type (lacc->type) && lacc->grp_unscalarizable_region)
+  if (is_sra_scalar_type (lacc->type) || lacc->grp_unscalarizable_region)
     return false;
 
-  gcc_assert (lacc->size == racc->size);
-
   for (rchild = racc->first_child; rchild; rchild = rchild->next_sibling)
     {
       struct access *new_acc = NULL;
       HOST_WIDE_INT norm_offset = rchild->offset + norm_delta;
 
-      if (rchild->grp_unscalarizable_region)
+      if (rchild->grp_unscalarizable_region
+	  || norm_offset + rchild->size > lbase_size)
 	continue;
 
       if (child_would_conflict_in_lacc (lacc, norm_offset, rchild->size,


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