[PATCH] D140603: Resolve a long-standing FIXME in memcpyopt.
Owen Anderson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 22 20:28:58 PST 2022
resistor updated this revision to Diff 485030.
resistor added a comment.
Remove accidentally added cruft.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D140603/new/
https://reviews.llvm.org/D140603
Files:
llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
Index: llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
+++ llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
@@ -873,7 +873,7 @@
bool MemCpyOptPass::performCallSlotOptzn(Instruction *cpyLoad,
Instruction *cpyStore, Value *cpyDest,
Value *cpySrc, TypeSize cpySize,
- Align cpyAlign, BatchAAResults &BAA,
+ Align cpyDestAlign, BatchAAResults &BAA,
std::function<CallInst *()> GetC) {
// The general transformation to keep in mind is
//
@@ -978,7 +978,7 @@
// Check that dest points to memory that is at least as aligned as src.
Align srcAlign = srcAlloca->getAlign();
- bool isDestSufficientlyAligned = srcAlign <= cpyAlign;
+ bool isDestSufficientlyAligned = srcAlign <= cpyDestAlign;
// If dest is not aligned enough and we can't increase its alignment then
// bail out.
if (!isDestSufficientlyAligned && !isa<AllocaInst>(cpyDest)) {
@@ -1503,11 +1503,9 @@
if (auto *C = dyn_cast<CallInst>(MI)) {
// FIXME: Can we pass in either of dest/src alignment here instead
// of conservatively taking the minimum?
- Align Alignment = std::min(M->getDestAlign().valueOrOne(),
- M->getSourceAlign().valueOrOne());
if (performCallSlotOptzn(M, M, M->getDest(), M->getSource(),
TypeSize::getFixed(CopySize->getZExtValue()),
- Alignment, BAA,
+ M->getDestAlign().valueOrOne(), BAA,
[C]() -> CallInst * { return C; })) {
LLVM_DEBUG(dbgs() << "Performed call slot optimization:\n"
<< " call: " << *C << "\n"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140603.485030.patch
Type: text/x-patch
Size: 2012 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221223/3313167d/attachment.bin>
More information about the llvm-commits
mailing list