This fixes the issue I mentioned in https://reviews.llvm.org/D89190#2323496. If the memcpy operands are the same (which is allowed since D86815) then the memcpy is effectively a no-op and the partially overlapping memset is not dead.
It's probably also worth looking into whether we can just drop this transform from memcpyopt altogether. After these fixes, the only thing this code should offer over partial store elimination in DSE is that it handles dynamic sizes, and that seems of somewhat dubious usefulness to me.