Skip to content

Commit

Permalink
[MemCpyOpt] Add some debug output to call slot optimization (NFC)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikic committed Jan 19, 2022
1 parent 9c4e93c commit 4dc4815
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
Expand Up @@ -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:
Expand All @@ -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();
Expand Down

0 comments on commit 4dc4815

Please sign in to comment.