Skip to content

Commit d4339bf

Browse files
authored
Merge pull request swiftlang#40373 from gottesmm/pr-77e61178a9b7855604c6156940fdd2163c87c530
[mem-access-utils] Teach memInstMustInitialize that indirect out parameters are initializing.
2 parents 1e0d5b8 + 3c411cb commit d4339bf

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/SIL/Utils/MemAccessUtils.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1893,6 +1893,7 @@ static bool isScratchBuffer(SILValue value) {
18931893

18941894
bool swift::memInstMustInitialize(Operand *memOper) {
18951895
SILValue address = memOper->get();
1896+
18961897
SILInstruction *memInst = memOper->getUser();
18971898

18981899
switch (memInst->getKind()) {
@@ -1908,6 +1909,12 @@ bool swift::memInstMustInitialize(Operand *memOper) {
19081909
case SILInstructionKind::InjectEnumAddrInst:
19091910
return true;
19101911

1912+
case SILInstructionKind::BeginApplyInst:
1913+
case SILInstructionKind::TryApplyInst:
1914+
case SILInstructionKind::ApplyInst: {
1915+
FullApplySite applySite(memInst);
1916+
return applySite.isIndirectResultOperand(*memOper);
1917+
}
19111918
case SILInstructionKind::StoreInst:
19121919
return cast<StoreInst>(memInst)->getOwnershipQualifier()
19131920
== StoreOwnershipQualifier::Init;

0 commit comments

Comments
 (0)