https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87984

--- Comment #30 from rguenther at suse dot de <rguenther at suse dot de> ---
On Fri, 29 Mar 2019, jakub at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87984
> 
> --- Comment #29 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
> (In reply to Richard Biener from comment #28)
> > Any comments?
> 
> > --- gcc/gimple.c        (revision 270012)
> > +++ gcc/gimple.c        (working copy)
> > @@ -2727,11 +2738,16 @@ gimple_asm_clobbers_memory_p (const gasm
> >  {
> >    unsigned i;
> >  
> > +  /* While strictly speaking only a "memory" clobber denotes clobbering
> > +     memory in GIMPLE we also treat local hard-register variables as
> > +     memory so simply treat all clobbers as memory.  The only exception
> > +     is the special clobber "cc".  */
> >    for (i = 0; i < gimple_asm_nclobbers (stmt); i++)
> >      {
> >        tree op = gimple_asm_clobber_op (stmt, i);
> > -      if (strcmp (TREE_STRING_POINTER (TREE_VALUE (op)), "memory") == 0)
> > -       return true;
> > +      if (strcmp (TREE_STRING_POINTER (TREE_VALUE (op)), "cc") == 0)
> > +       continue;
> > +      return true;
> >      }
> >  
> >    /* Non-empty basic ASM implicitly clobbers memory.  */
> 
> This will affect not just tree-ssa-operands.c, where it is ok I guess, as it
> will just mean a vdef and the alias oracle then can figure out if something
> aliases or not, but also ipa-pure-const.c and sanopt.  Do we want to say that
> functions with register clobbers are no longer pure/const and for sanopt
> consider them to be potential spots to free memory?

For ipa-pure-const definitely - the calls need to be barriers for
local reg sets.  For sanopt a memory clobber isn't a very good
indication for a spot to free memory anyways...

Btw, getting back optimization for cases with hardreg clobbers would
need to be put into the alias oracle then.

Reply via email to