@@ -91,7 +91,9 @@ bool swift::canOpcodeForwardOwnedValues(Operand *use) {
9191// points. Transitively find all nested scope-ending instructions by looking
9292// through nested reborrows. Nested reborrows are not use points.
9393bool swift::findInnerTransitiveGuaranteedUses (
94- SILValue guaranteedValue, SmallVectorImpl<Operand *> *usePoints) {
94+ SILValue guaranteedValue, SmallVectorImpl<Operand *> *usePoints) {
95+
96+ bool foundPointerEscape = false ;
9597
9698 auto leafUse = [&](Operand *use) {
9799 if (usePoints && use->getOperandOwnership () != OperandOwnership::NonUse) {
@@ -127,7 +129,9 @@ bool swift::findInnerTransitiveGuaranteedUses(
127129
128130 case OperandOwnership::ForwardingUnowned:
129131 case OperandOwnership::PointerEscape:
130- return false ;
132+ leafUse (use);
133+ foundPointerEscape = true ;
134+ break ;
131135
132136 case OperandOwnership::InstantaneousUse:
133137 case OperandOwnership::UnownedInstantaneousUse:
@@ -143,17 +147,18 @@ bool swift::findInnerTransitiveGuaranteedUses(
143147 break ;
144148
145149 case OperandOwnership::InteriorPointer:
146- return false ;
147-
148150#if 0 // FIXME!!! Enable in a following commit that fixes RAUW
149- // If our base guaranteed value does not have any consuming uses (consider
150- // function arguments), we need to be sure to include interior pointer
151- // operands since we may not get a use from a end_scope instruction.
151+ // If our base guaranteed value does not have any consuming uses
152+ // (consider function arguments), we need to be sure to include interior
153+ // pointer operands since we may not get a use from a end_scope
154+ // instruction.
152155 if (InteriorPointerOperand(use).findTransitiveUses(usePoints)
153156 != AddressUseKind::NonEscaping) {
154- return false ;
157+ foundPointerEscape = true ;
155158 }
156159#endif
160+ leafUse (use);
161+ foundPointerEscape = true ;
157162 break ;
158163
159164 case OperandOwnership::ForwardingBorrow: {
@@ -192,7 +197,7 @@ bool swift::findInnerTransitiveGuaranteedUses(
192197 break ;
193198 }
194199 }
195- return true ;
200+ return !foundPointerEscape ;
196201}
197202
198203// / Find all uses in the extended lifetime (i.e. including copies) of a simple
0 commit comments