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

--- Comment #2 from Jan Hubicka <hubicka at ucw dot cz> ---
> This is aggregate copy prop.  What we could do is replace the last copy
> by
> 
> __builtin_memcpy (_108, "this text is longer than 15 characters", 38);
> 
> but this might be a pessimization in case none of the copies gets optimized.

Why?
I think doing
  __builtin_memcpy (_55, "this text is longer than 15 characters", 38);
  __builtin_memcpy (_108, "this text is longer than 15 characters", 38);
is probably improvement over:
  __builtin_memcpy (_55, "this text is longer than 15 characters", 38);
  __builtin_memcpy (_108, _55, 38);
One can copy in parallel. Which will likely happen - since block size is
constant, RTL will break up the memcpy to series of loads and stores and
hopefully will be able to constant propagate.

We probably ought to move memcpy/memset lowering to gimple level, so
last value numbering passs has chance to optimize it.

Reply via email to