@@ -54,9 +54,13 @@ class LiveRange {
54
54
// / A list of destroy_values of the live range.
55
55
SmallVector<Operand *, 2 > destroyingUses;
56
56
57
- // / A list of forwarding instructions that forward our destroys ownership, but
58
- // / that are also able to forward guaranteed ownership.
59
- SmallVector<Operand *, 2 > generalForwardingUses;
57
+ // / A list of forwarding instructions that forward owned ownership, but that
58
+ // / are also able to be converted to guaranteed ownership. If we are able to
59
+ // / eliminate this LiveRange due to it being from a guaranteed value, we must
60
+ // / flip the ownership of all of these instructions to guaranteed from owned.
61
+ // /
62
+ // / Corresponds to isOwnershipForwardingInst(...).
63
+ SmallVector<Operand *, 2 > ownershipForwardingUses;
60
64
61
65
// / Consuming uses that we were not able to understand as a forwarding
62
66
// / instruction or a destroy_value. These must be passed a strongly control
@@ -113,8 +117,8 @@ class LiveRange {
113
117
114
118
OwnedValueIntroducer getIntroducer () const { return introducer; }
115
119
116
- ArrayRef<Operand *> getNonConsumingForwardingUses () const {
117
- return generalForwardingUses ;
120
+ ArrayRef<Operand *> getOwnershipForwardingUses () const {
121
+ return ownershipForwardingUses ;
118
122
}
119
123
120
124
void convertOwnedGeneralForwardingUsesToGuaranteed ();
@@ -185,7 +189,7 @@ LiveRange::DestroyingInstsRange LiveRange::getDestroyingInsts() const {
185
189
186
190
LiveRange::LiveRange (SILValue value)
187
191
: introducer(*OwnedValueIntroducer::get (value)), destroyingUses(),
188
- generalForwardingUses (), unknownConsumingUses() {
192
+ ownershipForwardingUses (), unknownConsumingUses() {
189
193
assert (introducer.value .getOwnershipKind () == ValueOwnershipKind::Owned);
190
194
191
195
// We know that our silvalue produces an @owned value. Look through all of our
@@ -246,7 +250,7 @@ LiveRange::LiveRange(SILValue value)
246
250
247
251
// Ok, this is a forwarding instruction whose ownership we can flip from
248
252
// owned -> guaranteed.
249
- generalForwardingUses .push_back (op);
253
+ ownershipForwardingUses .push_back (op);
250
254
251
255
// If we have a non-terminator, just visit its users recursively to see if
252
256
// the the users force the live range to be alive.
@@ -336,8 +340,8 @@ void LiveRange::insertEndBorrowsAtDestroys(
336
340
}
337
341
338
342
void LiveRange::convertOwnedGeneralForwardingUsesToGuaranteed () {
339
- while (!generalForwardingUses .empty ()) {
340
- auto *i = generalForwardingUses .pop_back_val ()->getUser ();
343
+ while (!ownershipForwardingUses .empty ()) {
344
+ auto *i = ownershipForwardingUses .pop_back_val ()->getUser ();
341
345
342
346
// If this is a term inst, just convert all of its incoming values that are
343
347
// owned to be guaranteed.
0 commit comments