This is an archive of the discontinued LLVM Phabricator instance.

[MemCpyOpt] Don't shorten memset if memcpy operands may be the same
ClosedPublic

Authored by nikic on Oct 10 2020, 10:03 AM.

Details

Summary

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.

Diff Detail

Event Timeline

nikic created this revision.Oct 10 2020, 10:03 AM
nikic requested review of this revision.Oct 10 2020, 10:03 AM
This revision is now accepted and ready to land.Oct 11 2020, 3:04 PM
This revision was landed with ongoing or failed builds.Oct 13 2020, 12:19 PM
This revision was automatically updated to reflect the committed changes.