[PATCH] D107605: [MemCpyOpt] Teach memcpyopt to handle loads from the constant memory.

Michael Liao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 6 07:58:49 PDT 2021


hliao added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp:1173
   // operands cannot partially overlap, exact equality is allowed.
-  if (!AA->isNoAlias(MemoryLocation(MemCpy->getSource(),
-                                    LocationSize::precise(1)),
-                     MemoryLocation(MemCpy->getDest(),
-                                    LocationSize::precise(1))))
+  if (isModSet(AA->getModRefInfo(MemCpy, MemoryLocation::getForSource(MemCpy))))
     return false;
----------------
efriedma wrote:
> I think the original code was trying to do something slightly different... but I guess there isn't any test coverage? Not completely sure how the difference could matter, anyway; maybe we could do something funny with pointer alignment in certain edge cases.
not regression with all targets enabled, I will check any regression due to this change.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107605/new/

https://reviews.llvm.org/D107605



More information about the llvm-commits mailing list