[llvm] 4dc4815 - [MemCpyOpt] Add some debug output to call slot optimization (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 19 06:51:18 PST 2022
Author: Nikita Popov
Date: 2022-01-19T15:51:10+01:00
New Revision: 4dc4815f561373dd05bdfe1777b547e09335ab36
URL: https://github.com/llvm/llvm-project/commit/4dc4815f561373dd05bdfe1777b547e09335ab36
DIFF: https://github.com/llvm/llvm-project/commit/4dc4815f561373dd05bdfe1777b547e09335ab36.diff
LOG: [MemCpyOpt] Add some debug output to call slot optimization (NFC)
Added:
Modified:
llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp b/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
index dd81c6ffcb530..4a42753fd78bd 100644
--- a/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
+++ b/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
@@ -890,8 +890,10 @@ bool MemCpyOptPass::performCallSlotOptzn(Instruction *cpyLoad,
// trap. Otherwise the transform is invalid since it might cause a trap
// to occur earlier than it otherwise would.
if (!isDereferenceableAndAlignedPointer(cpyDest, Align(1), APInt(64, cpySize),
- DL, C, DT))
+ DL, C, DT)) {
+ LLVM_DEBUG(dbgs() << "Call Slot: Dest pointer not dereferenceable\n");
return false;
+ }
// Make sure that nothing can observe cpyDest being written early. There are
// a number of cases to consider:
@@ -907,8 +909,10 @@ bool MemCpyOptPass::performCallSlotOptzn(Instruction *cpyLoad,
// guaranteed to be executed if C is. As it is a non-atomic access, it
// renders accesses from other threads undefined.
// TODO: This is currently not checked.
- if (mayBeVisibleThroughUnwinding(cpyDest, C, cpyStore))
+ if (mayBeVisibleThroughUnwinding(cpyDest, C, cpyStore)) {
+ LLVM_DEBUG(dbgs() << "Call Slot: Dest may be visible through unwinding");
return false;
+ }
// Check that dest points to memory that is at least as aligned as src.
Align srcAlign = srcAlloca->getAlign();
More information about the llvm-commits
mailing list