[PATCH] D107605: [MemCpyOpt] Teach memcpyopt to handle loads from the constant memory.
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 5 22:43:45 PDT 2021
efriedma accepted this revision.
efriedma added a comment.
This revision is now accepted and ready to land.
LGTM
================
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;
----------------
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.
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