On Mon, 31 Oct 2016, Jakub Jelinek wrote:

> Hi!
> 
> Some automatic VAR_DECLs don't get DECL_RTL set - e.g. if its SSA_NAMEs
> expand to multiple rtls, then there is not a single one that can be used.
> Using DECL_RTL on such VAR_DECLs ICEs.
> 
> I've tried to just return 0 in nonoverlapping_memrefs_p if either
> DECL_RTL_SET_P (expr{x,y}) wasn't true, but that triggered way too often
> during bootstrap/regtest (3800+ times).  So the following patch narrows it
> down more and triggers only on the testcase below.

What kind of cases did this trigger on?  I would have expected we
have DECL_RTL_SET_P on (almost?) all decls that can have it.  And for
those that don't it should be uninteresting to have?

> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

Hmm.  Can you try splitting out a decl_can_have_rtl () predicate
from make_decl_rtl and use that?

Thanks,
Richard.

> 2016-10-31  Jakub Jelinek  <ja...@redhat.com>
> 
>       PR target/77834
>       * alias.c (nonoverlapping_memrefs_p): Return 0 if exprx or expry
>       doesn't have rtl set and it can't be safely created.
> 
>       * 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,27 @@ nonoverlapping_memrefs_p (const_rtx x, c
>        || TREE_CODE (expry) == CONST_DECL)
>      return 1;
>  
> +  /* Don't try to create RTL for decls that intentionally don't have
> +     DECL_RTL set (e.g. marked as living in multiple places).  */
> +  if (!DECL_RTL_SET_P (exprx))
> +    {
> +      if (TREE_CODE (exprx) == PARM_DECL
> +       || TREE_CODE (exprx) == RESULT_DECL
> +       || (VAR_P (exprx)
> +           && !TREE_STATIC (exprx)
> +           && !DECL_EXTERNAL (exprx)))
> +     return 0;
> +    }
> +  if (!DECL_RTL_SET_P (expry))
> +    {
> +      if (TREE_CODE (expry) == PARM_DECL
> +       || TREE_CODE (expry) == RESULT_DECL
> +       || (VAR_P (expry)
> +           && !TREE_STATIC (expry)
> +           && !DECL_EXTERNAL (expry)))
> +     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
> 
> 

-- 
Richard Biener <rguent...@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 
21284 (AG Nuernberg)

Reply via email to