[PATCH] D89192: [MemCpyOpt] Don't shorten memset if memcpy operands may be the same

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 10 10:03:21 PDT 2020


nikic created this revision.
nikic added reviewers: efriedma, jdoerfert, fhahn.
Herald added subscribers: llvm-commits, dexonsmith, hiraditya.
Herald added a project: LLVM.
nikic requested review of this revision.

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 <https://reviews.llvm.org/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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D89192

Files:
  llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
  llvm/test/Transforms/MemCpyOpt/memset-memcpy-redundant-memset.ll
  llvm/test/Transforms/MemCpyOpt/preserve-memssa.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89192.297423.patch
Type: text/x-patch
Size: 7516 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201010/18fb979c/attachment.bin>


More information about the llvm-commits mailing list