Skip to content

Commit a57dee1

Browse files
authored
Merge pull request #22012 from gottesmm/pr-6bbbe995ebae0d51fccdfcb1cf06536fb8e0e5f3
2 parents babee8b + 58cc7b0 commit a57dee1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/SILOptimizer/Mandatory/PredictableMemOpt.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -930,6 +930,12 @@ void AvailableValueDataflowContext::explodeCopyAddr(CopyAddrInst *CAI) {
930930
// something else), track it as an access.
931931
if (StoreUse.isValid()) {
932932
StoreUse.Inst = NewInst;
933+
// If our store use by the copy_addr is an assign, then we know that
934+
// before we store the new value, we loaded the old value implying that
935+
// our store is technically initializing memory when it occurs. So
936+
// change the kind to Initialization.
937+
if (StoreUse.Kind == Assign)
938+
StoreUse.Kind = Initialization;
933939
NonLoadUses[NewInst] = Uses.size();
934940
Uses.push_back(StoreUse);
935941
}

0 commit comments

Comments
 (0)