There's no point in copying around constants, so, when all else fails, I think we can still transform memcpy of memset into two independent memsets. To quote the example, we can turn:
memset(dst1, c, dst1_size); memcpy(dst2, dst1, dst2_size);
into:
memset(dst1, c, dst1_size); memset(dst2, c, dst2_size);
When dst2_size <= dst1_size.
Like D498 for copy constructors, I think this pattern can occur in move constructors.
So, this looks like a valid optimization, and in fact, i expect things like GVN would like this form better than the original.
But I am curious how often it actually happens.
Do you have real programs where this triggers?