Skip to content

Commit e4f406d

Browse files
authored
Merge pull request #36862 from eeckstein/remove-mv-result-nodes
SIL: remove the sub-classes of MultipleValueInstructionResult
2 parents 68f9fd1 + 0975565 commit e4f406d

15 files changed

+131
-236
lines changed

include/swift/SIL/MemAccessUtils.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,7 +1372,7 @@ class AccessUseDefChainVisitor {
13721372
Result visitGlobalAccess(SILValue global) {
13731373
return asImpl().visitBase(global, AccessedStorage::Global);
13741374
}
1375-
Result visitYieldAccess(BeginApplyResult *yield) {
1375+
Result visitYieldAccess(MultipleValueInstructionResult *yield) {
13761376
return asImpl().visitBase(yield, AccessedStorage::Yield);
13771377
}
13781378
Result visitStackAccess(AllocStackInst *stack) {
@@ -1448,8 +1448,10 @@ Result AccessUseDefChainVisitor<Impl, Result>::visit(SILValue sourceAddr) {
14481448

14491449
// A yield is effectively a nested access, enforced independently in
14501450
// the caller and callee.
1451-
case ValueKind::BeginApplyResult:
1452-
return asImpl().visitYieldAccess(cast<BeginApplyResult>(sourceAddr));
1451+
case ValueKind::MultipleValueInstructionResult:
1452+
if (auto *baResult = isaResultOf<BeginApplyInst>(sourceAddr))
1453+
return asImpl().visitYieldAccess(baResult);
1454+
break;
14531455

14541456
// A function argument is effectively a nested access, enforced
14551457
// independently in the caller and callee.

include/swift/SIL/OwnershipUtils.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -894,8 +894,10 @@ class OwnedValueIntroducerKind {
894894
;
895895
case ValueKind::ApplyInst:
896896
return Kind::Apply;
897-
case ValueKind::BeginApplyResult:
898-
return Kind::BeginApply;
897+
case ValueKind::MultipleValueInstructionResult:
898+
if (isaResultOf<BeginApplyInst>(value))
899+
return Kind::BeginApply;
900+
return Kind::Invalid;
899901
case ValueKind::StructInst:
900902
return Kind::Struct;
901903
case ValueKind::TupleInst:

include/swift/SIL/PatternMatch.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -411,9 +411,11 @@ template <typename LTy> struct tupleextractoperation_ty {
411411
L.match((ValueBase *)TEI->getOperand());
412412
}
413413

414-
if (auto *DTR = dyn_cast<DestructureTupleResult>(V)) {
415-
return DTR->getIndex() == index &&
416-
L.match((ValueBase *)DTR->getParent()->getOperand());
414+
if (auto *DTR = dyn_cast<MultipleValueInstructionResult>(V)) {
415+
if (auto *DT = dyn_cast<DestructureTupleInst>(DTR->getParent())) {
416+
return DTR->getIndex() == index &&
417+
L.match((ValueBase *)DT->getOperand());
418+
}
417419
}
418420

419421
return false;

0 commit comments

Comments
 (0)