@@ -37,30 +37,18 @@ ApplyInst *getAllocateUninitializedArrayIntrinsicElementAddress(SILValue v) {
37
37
ptai = dyn_cast<PointerToAddressInst>(iai->getOperand (0 ));
38
38
if (!ptai)
39
39
return nullptr ;
40
+ auto *mdi = dyn_cast<MarkDependenceInst>(
41
+ ptai->getOperand ()->getDefiningInstruction ());
42
+ if (!mdi)
43
+ return nullptr ;
40
44
// Return the `array.uninitialized_intrinsic` application, if it exists.
41
45
if (auto *dti = dyn_cast<DestructureTupleInst>(
42
- ptai-> getOperand ()->getDefiningInstruction ()))
46
+ mdi-> getValue ()->getDefiningInstruction ()))
43
47
return ArraySemanticsCall (dti->getOperand (),
44
48
semantics::ARRAY_UNINITIALIZED_INTRINSIC);
45
49
return nullptr ;
46
50
}
47
51
48
- DestructureTupleInst *getSingleDestructureTupleUser (SILValue value) {
49
- bool foundDestructureTupleUser = false ;
50
- if (!value->getType ().is <TupleType>())
51
- return nullptr ;
52
- DestructureTupleInst *result = nullptr ;
53
- for (auto *use : value->getUses ()) {
54
- if (auto *dti = dyn_cast<DestructureTupleInst>(use->getUser ())) {
55
- assert (!foundDestructureTupleUser &&
56
- " There should only be one `destructure_tuple` user of a tuple" );
57
- foundDestructureTupleUser = true ;
58
- result = dti;
59
- }
60
- }
61
- return result;
62
- }
63
-
64
52
bool isSemanticMemberAccessor (SILFunction *original) {
65
53
auto *dc = original->getDeclContext ();
66
54
if (!dc)
@@ -109,7 +97,7 @@ void forEachApplyDirectResult(
109
97
resultCallback (ai);
110
98
return ;
111
99
}
112
- if (auto *dti = getSingleDestructureTupleUser (ai ))
100
+ if (auto *dti = ai-> getSingleUserOfType <DestructureTupleInst>( ))
113
101
for (auto directResult : dti->getResults ())
114
102
resultCallback (directResult);
115
103
break ;
0 commit comments