Skip to content

Commit 4842e23

Browse files
committed
[semantic-arc-opts] Rename LiveRange::{general,ownership}ForwardingUse.
This is a clearer name. It is also corresponds with the function isOwnershipForwardingInst that classifies such operands.
1 parent 52fe9ba commit 4842e23

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

lib/SILOptimizer/Transforms/SemanticARCOpts.cpp

+13-9
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,13 @@ class LiveRange {
5454
/// A list of destroy_values of the live range.
5555
SmallVector<Operand *, 2> destroyingUses;
5656

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;
6064

6165
/// Consuming uses that we were not able to understand as a forwarding
6266
/// instruction or a destroy_value. These must be passed a strongly control
@@ -113,8 +117,8 @@ class LiveRange {
113117

114118
OwnedValueIntroducer getIntroducer() const { return introducer; }
115119

116-
ArrayRef<Operand *> getNonConsumingForwardingUses() const {
117-
return generalForwardingUses;
120+
ArrayRef<Operand *> getOwnershipForwardingUses() const {
121+
return ownershipForwardingUses;
118122
}
119123

120124
void convertOwnedGeneralForwardingUsesToGuaranteed();
@@ -185,7 +189,7 @@ LiveRange::DestroyingInstsRange LiveRange::getDestroyingInsts() const {
185189

186190
LiveRange::LiveRange(SILValue value)
187191
: introducer(*OwnedValueIntroducer::get(value)), destroyingUses(),
188-
generalForwardingUses(), unknownConsumingUses() {
192+
ownershipForwardingUses(), unknownConsumingUses() {
189193
assert(introducer.value.getOwnershipKind() == ValueOwnershipKind::Owned);
190194

191195
// We know that our silvalue produces an @owned value. Look through all of our
@@ -246,7 +250,7 @@ LiveRange::LiveRange(SILValue value)
246250

247251
// Ok, this is a forwarding instruction whose ownership we can flip from
248252
// owned -> guaranteed.
249-
generalForwardingUses.push_back(op);
253+
ownershipForwardingUses.push_back(op);
250254

251255
// If we have a non-terminator, just visit its users recursively to see if
252256
// the the users force the live range to be alive.
@@ -336,8 +340,8 @@ void LiveRange::insertEndBorrowsAtDestroys(
336340
}
337341

338342
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();
341345

342346
// If this is a term inst, just convert all of its incoming values that are
343347
// owned to be guaranteed.

0 commit comments

Comments
 (0)