[Bug tree-optimization/23094] store ccp, or store copy prop misses an optimization

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri May 12 10:46:00 GMT 2017


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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #9375|0                           |1
        is obsolete|                            |

--- Comment #16 from Richard Biener <rguenth at gcc dot gnu.org> ---
Created attachment 41347
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41347&action=edit
patch I'm sitting on

So this is the patch I am sitting on for a while.  It's reasonably a cheap
trick but is at the same time easily fooled by an intermediate (non-aliasing)
store
like in

float *f;
int g(int *a, int *b)
{
  int x = *b;
  *f = 1.;
  *a = x;
  return *b;
}

which is why I haven't pushed it sofar.  OTOH it might be good enough for
the most cases.

To make it more general one would need to store the seen value somewhere
and verify we can use it.  A bit hackish I'd say (well, a new global var
would do, not that we don't already have this kind).


More information about the Gcc-bugs mailing list