@@ -91,7 +91,9 @@ bool swift::canOpcodeForwardOwnedValues(Operand *use) {
91
91
// points. Transitively find all nested scope-ending instructions by looking
92
92
// through nested reborrows. Nested reborrows are not use points.
93
93
bool swift::findInnerTransitiveGuaranteedUses (
94
- SILValue guaranteedValue, SmallVectorImpl<Operand *> *usePoints) {
94
+ SILValue guaranteedValue, SmallVectorImpl<Operand *> *usePoints) {
95
+
96
+ bool foundPointerEscape = false ;
95
97
96
98
auto leafUse = [&](Operand *use) {
97
99
if (usePoints && use->getOperandOwnership () != OperandOwnership::NonUse) {
@@ -127,7 +129,9 @@ bool swift::findInnerTransitiveGuaranteedUses(
127
129
128
130
case OperandOwnership::ForwardingUnowned:
129
131
case OperandOwnership::PointerEscape:
130
- return false ;
132
+ leafUse (use);
133
+ foundPointerEscape = true ;
134
+ break ;
131
135
132
136
case OperandOwnership::InstantaneousUse:
133
137
case OperandOwnership::UnownedInstantaneousUse:
@@ -143,17 +147,18 @@ bool swift::findInnerTransitiveGuaranteedUses(
143
147
break ;
144
148
145
149
case OperandOwnership::InteriorPointer:
146
- return false ;
147
-
148
150
#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.
152
155
if (InteriorPointerOperand(use).findTransitiveUses(usePoints)
153
156
!= AddressUseKind::NonEscaping) {
154
- return false ;
157
+ foundPointerEscape = true ;
155
158
}
156
159
#endif
160
+ leafUse (use);
161
+ foundPointerEscape = true ;
157
162
break ;
158
163
159
164
case OperandOwnership::ForwardingBorrow: {
@@ -192,7 +197,7 @@ bool swift::findInnerTransitiveGuaranteedUses(
192
197
break ;
193
198
}
194
199
}
195
- return true ;
200
+ return !foundPointerEscape ;
196
201
}
197
202
198
203
// / Find all uses in the extended lifetime (i.e. including copies) of a simple
0 commit comments