RFC: VTA alias set discrepancy

Jakub Jelinek jakub@redhat.com
Thu Mar 18 17:53:00 GMT 2010


On Thu, Mar 18, 2010 at 05:06:15PM +0100, Richard Guenther wrote:
> > +rtx
> > +make_decl_rtl_for_debug (tree decl)
> > +{
> > +  unsigned int save_aliasing_flag;
> > +  rtx rtl;
> 
> While existing callers are under !DECL_RTL_SET_P it is not obvious
> that that is true here, so please add
> 
>   if (DECL_RTL_SET_P (decl))
>     return DECL_RTL (decl);
> 
> here.

Perhaps all the checks could go in this new function instead of
the callers.
So

rtx
make_decl_rtl_for_debug (tree decl)
{
  unsigned int save_aliasing_flag, save_mudflap_flag;
  rtx rtl;

  if (DECL_RTL_SET_P (decl))
    return DECL_RTL (decl);

  if (TREE_CODE (decl) != VAR_DECL
      || DECL_EXTERNAL (decl)
      || !TREE_STATIC (decl)
      || !DECL_NAME (decl)
      || DECL_HARD_REGISTER (decl)
      || DECL_MODE (decl) == VOIDmode)
    return NULL_RTX;

  /* Kludge alert!  Somewhere down the call chain, make_decl_rtl will
     call new_alias_set.  If running with -fcompare-debug, sometimes
     we do not want to create alias sets that will throw the alias
     numbers off in the comparison dumps.  So... clearing
     flag_strict_aliasing will keep new_alias_set() from creating a
     new set.
     Avoid this decl from being registered with mudflap too.  */
  save_aliasing_flag = flag_strict_aliasing;
  flag_strict_aliasing = 0;
  save_mudflap_flag = flag_mudflap;
  flag_mudflap = 0;

  rtl = DECL_RTL (decl);
  /* Reset DECL_RTL back, as various parts of the compiler expects
     DECL_RTL set meaning it is actually going to be output.  */
  SET_DECL_RTL (decl, NULL);

  flag_strict_aliasing = save_aliasing_flag;
  flag_mudflap = save_mudflap_flag;

  return rtl;
}

and, please change also cfgexpand.c to call this routine.

	Jakub



More information about the Gcc-patches mailing list