[Bug tree-optimization/49872] Missed optimization: Could coalesce neighboring memsets

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jul 28 10:01:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49872

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.07.28 10:00:34
     Ever Confirmed|0                           |1

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-07-28 10:00:34 UTC ---
Confirmed.

It should be hard to implement this, but did you see this in real-world code
(to asses the importance of this optimization)?

Other cases would include (partially) overlapping memsets (or related
functions such as memory copying routines and the respective string variants).

We already optimize some cases (that appeared in GCC IIRC) in
tree-ssa-forwprop.c,
namely

/* *GSI_P is a GIMPLE_CALL to a builtin function.
   Optimize
   memcpy (p, "abcd", 4);
   memset (p + 4, ' ', 3);
   into
   memcpy (p, "abcd   ", 7);
   call if the latter can be stored by pieces during expansion.  */



More information about the Gcc-bugs mailing list