[PATCH] D135653: [MemCpyOpt] Insert memset after memcpy in processMemSetMemCpyDependence

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 11 02:24:26 PDT 2022


bjope created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
bjope requested review of this revision.
Herald added a project: LLVM.

Code comments in processMemSetMemCpyDependence indicated that
the memset would be sunk below the memcpy when being rewritten. That
was however not true as the code actually inserted the MemSet before
the MemCpy. This patch updates the transform to actully insert the
MemSet after the MemCpy.

While being at it, this patch also make sure that the new memset is
reusing the debug location from the old memset rather than taking
the debug location of the memcpy.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D135653

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135653.466740.patch
Type: text/x-patch
Size: 18042 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221011/3d945821/attachment.bin>


More information about the llvm-commits mailing list