re PR target/77834 (ICE: in make_decl_rtl, at varasm.c:1311 with -O -ftree-pre -mstri...
authorJakub Jelinek <jakub@redhat.com>
Fri, 4 Nov 2016 19:14:07 +0000 (20:14 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 4 Nov 2016 19:14:07 +0000 (20:14 +0100)
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.

From-SVN: r241859

gcc/ChangeLog
gcc/alias.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr77834.c [new file with mode: 0644]

index d062157ab7adf2b5d394b1bed4bd8dcdf1801bf5..7e4a50df854fac5f9b393ddea82d45078d9b0381 100644 (file)
@@ -1,3 +1,9 @@
+2016-11-04  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/77834
+       * alias.c (nonoverlapping_memrefs_p): Return 0 if exprx or expry
+       doesn't have rtl set.
+
 2016-11-04  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
        * config/rs6000/rs6000.c (gimple-ssa.h): New #include.
index ca475ff92afcd590ead37161effbef9fd9ca5f07..fd3dec4d0e3e31c61703c3c4eb34bcbc637762e1 100644 (file)
@@ -2755,6 +2755,13 @@ nonoverlapping_memrefs_p (const_rtx x, const_rtx y, bool loop_invariant)
       || 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);
 
index eae75f1c453438362b8d9c3cbcad8a66a528184b..4ca326b5759405f318b8b88f11a19017567b9ad1 100644 (file)
@@ -1,3 +1,8 @@
+2016-11-04  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/77834
+       * gcc.dg/pr77834.c: New test.
+
 2016-11-04  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/67980
diff --git a/gcc/testsuite/gcc.dg/pr77834.c b/gcc/testsuite/gcc.dg/pr77834.c
new file mode 100644 (file)
index 0000000..a9085b9
--- /dev/null
@@ -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;
+}