Skip to content

[pmo] A copy_addr of a trivial type should be treated as an InitOrAss… #22013

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/SILOptimizer/Mandatory/PMOMemoryUseCollector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,8 @@ bool ElementUseCollector::collectUses(SILValue Pointer) {
auto Kind = ([&]() -> PMOUseKind {
if (UI->getOperandNumber() == CopyAddrInst::Src)
return PMOUseKind::Load;
if (PointeeType.isTrivial(CAI->getModule()))
return PMOUseKind::InitOrAssign;
if (CAI->isInitializationOfDest())
return PMOUseKind::Initialization;
return PMOUseKind::Assign;
Expand Down
2 changes: 1 addition & 1 deletion lib/SILOptimizer/Mandatory/PredictableMemOpt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,7 @@ void AvailableValueDataflowContext::explodeCopyAddr(CopyAddrInst *CAI) {
assert((LoadUse.isValid() || StoreUse.isValid()) &&
"we should have a load or a store, possibly both");
assert(StoreUse.isInvalid() || StoreUse.Kind == Assign ||
StoreUse.Kind == Initialization);
StoreUse.Kind == Initialization || StoreUse.Kind == InitOrAssign);

// Now that we've emitted a bunch of instructions, including a load and store
// but also including other stuff, update the internal state of
Expand Down