[Bug tree-optimization/80944] redundant memcpy/memset with non-constant size not eliminated

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jun 2 14:40:00 GMT 2017


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

--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
Good point!  It never occurred to me.  That explains why no compiler does it.

That suggests that the optimization opportunity is up to the user.  I.e., a
class like std::string could optimize this case by adding a constraint/assert
that s->s doesn't point at s.  Let me look into that.


More information about the Gcc-bugs mailing list