[PATCH] Fix PR34330, ICE with alias mismatch after vectorizer

Richard Guenther rguenther@suse.de
Tue May 13 13:07:00 GMT 2008


If tree-parloops recomputes aliasing after the vectorizer came along
and uses old SMTs for new vector pointers we trigger the assert in
get_smt_for that asserts the SMT for a pointer is exactly matching
its type alias set.  This is a too strict check which we can loosen
to only require that accesses through that pointer alias the SMT.

In the case of the PR struct { short s1, s2, s3, s4 } is accessed
via a pointer to vector short which is ok, as vector short has the
same alias set as short and thus aliases the struct.

Bootstrapped and tested on x86_64-unknown-linux-gnu, I'll apply this
later this week.

Thanks,
Richard.

2008-05-13  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/34330
	* tree-ssa-alias.c (get_smt_for): Only assert that accesses
	through the pointer will alias the SMT.

	* gcc.dg/torture/pr34330.c: New testcase.

Index: tree-ssa-alias.c
===================================================================
*** tree-ssa-alias.c	(revision 135255)
--- tree-ssa-alias.c	(working copy)
*************** get_smt_for (tree ptr, struct alias_info
*** 3025,3032 ****
    TREE_THIS_VOLATILE (tag) |= TREE_THIS_VOLATILE (tag_type);
  
    /* Make sure that the symbol tag has the same alias set as the
!      pointed-to type.  */
!   gcc_assert (tag_set == get_alias_set (tag));
  
    return tag;
  }
--- 3025,3035 ----
    TREE_THIS_VOLATILE (tag) |= TREE_THIS_VOLATILE (tag_type);
  
    /* Make sure that the symbol tag has the same alias set as the
!      pointed-to type or at least accesses through the pointer will
!      alias that set.  The latter can happen after the vectorizer
!      created pointers of vector type.  */
!   gcc_assert (tag_set == get_alias_set (tag)
! 	      || alias_set_subset_of (tag_set, get_alias_set (tag)));
  
    return tag;
  }
Index: testsuite/gcc.dg/torture/pr34330.c
===================================================================
*** testsuite/gcc.dg/torture/pr34330.c	(revision 0)
--- testsuite/gcc.dg/torture/pr34330.c	(revision 0)
***************
*** 0 ****
--- 1,21 ----
+ /* { dg-do compile } */
+ /* { dg-options "-ftree-parallelize-loops=4 -ftree-vectorize" } */
+ 
+ struct T
+ {
+   int t;
+   struct { short s1, s2, s3, s4; } *s;
+ };
+ 
+ void
+ foo (int *a, int *b, int *c, int *d, struct T *e)
+ {
+   int i;
+   for (i = 0; i < e->t; i++)
+     {
+       e->s[i].s1 = a[i];
+       e->s[i].s2 = b[i];
+       e->s[i].s3 = c[i];
+       e->s[i].s4 = d[i];
+     }
+ }



More information about the Gcc-patches mailing list