On November 4, 2016 5:27:11 PM GMT+01:00, Jakub Jelinek <ja...@redhat.com> 
wrote:
>Hi!
>
>On Wed, Nov 02, 2016 at 10:46:40AM +0100, Richard Biener wrote:
>> Yeah, plus if a followup test would have disambiguated things (the
>> dispatch to the tree oracle for example).
>
>After discussing this on IRC that the dse.c and sched-deps.c (call (mem
>...) )
>changes are probably not safe, I'm proposing following patch which
>should be
>safe to backport to release branches too, the only occurrences of
>!DECL_RTL_SET_P where DECL_RTL worked fine in my bootstraps/regtests
>were
>FUNCTION_DECLs, so the patch should only turn ICEs into returning the
>safe
>return value that the expressions might overlap.
>
>If/once this is in, I'm planning to test/submit a patch adding
>  /* If one decl is known to be a function or label in a function and
>     the other is some kind of data, they can't overlap.  */
>  if ((TREE_CODE (exprx) == FUNCTION_DECL
>       || TREE_CODE (exprx) == LABEL_DECL)
>      != (TREE_CODE (expry) == FUNCTION_DECL
>         || TREE_CODE (expry) == LABEL_DECL))
>    return 1;
>before that.
>
>Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

OK for trunk and branches (if appropriate)

Richard.

>2016-11-04  Jakub Jelinek  <ja...@redhat.com>
>
>       PR target/77834
>       * alias.c (nonoverlapping_memrefs_p): Return 0 if exprx or expry
>       doesn't have rtl set.
>
>       * gcc.dg/pr77834.c: New test.
>
>--- gcc/alias.c.jj     2016-10-21 17:06:27.000000000 +0200
>+++ gcc/alias.c        2016-10-31 11:38:29.448031590 +0100
>@@ -2755,6 +2755,13 @@ nonoverlapping_memrefs_p (const_rtx x, c
>       || TREE_CODE (expry) == CONST_DECL)
>     return 1;
> 
>+  /* If either of the decls doesn't have DECL_RTL set (e.g. marked as
>+     living in multiple places), we can't tell anything.  Exception
>+     are FUNCTION_DECLs for which we can create DECL_RTL on demand. 
>*/
>+  if ((!DECL_RTL_SET_P (exprx) && TREE_CODE (exprx) != FUNCTION_DECL)
>+      || (!DECL_RTL_SET_P (expry) && TREE_CODE (expry) !=
>FUNCTION_DECL))
>+    return 0;
>+
>   rtlx = DECL_RTL (exprx);
>   rtly = DECL_RTL (expry);
> 
>--- gcc/testsuite/gcc.dg/pr77834.c.jj  2016-10-31 11:41:46.290521464
>+0100
>+++ gcc/testsuite/gcc.dg/pr77834.c     2016-10-31 11:41:24.000000000 +0100
>@@ -0,0 +1,18 @@
>+/* PR target/77834 */
>+/* { dg-do compile } */
>+/* { dg-options "-O -ftree-pre -Wno-psabi" } */
>+/* { dg-additional-options "-mstringop-strategy=libcall" { target
>i?86-*-* x86_64-*-* } } */
>+
>+typedef int V __attribute__ ((vector_size (64)));
>+
>+V
>+foo (V u, V v, int w)
>+{
>+  do
>+    {
>+      if (u[0]) v ^= u[w];
>+    }
>+  while ((V) { 0, u[w] }[1]);
>+  u = (V) { v[v[0]], u[u[0]] };
>+  return v + u;
>+}
>
>
>       Jakub


Reply via email to