@@ -54,12 +54,18 @@ class LLVM_LIBRARY_VISIBILITY OwnershipLiveRange {
5454 // / order. This is why it is important not to mutate consumingUses after we
5555 // / construct the LiveRange since going from small -> large could invalidate
5656 // / the uses.
57- SmallVector<Operand *, 6 > consumingUses;
57+ // /
58+ // / These UsePoints may be Operands or SILInstructions (terminators of blocks
59+ // / in dead-end regions along the value's availability boundary).
60+ SmallVector<UsePoint, 6 > consumingUses;
5861
5962 // / A list of destroy_values of the live range.
6063 // /
61- // / This is just a view into consuming uses.
62- ArrayRef<Operand *> destroyingUses;
64+ // / This is just a view into consumingUses.
65+ // /
66+ // / These UsePoints may be Operands or SILInstructions (terminators of blocks
67+ // / in dead-end regions along the value's availability boundary).
68+ ArrayRef<UsePoint> destroyingUses;
6369
6470 // / A list of forwarding instructions that forward owned ownership, but that
6571 // / are also able to be converted to guaranteed ownership.
@@ -76,12 +82,16 @@ class LLVM_LIBRARY_VISIBILITY OwnershipLiveRange {
7682 // / "consumingUses" array the true lifetime of the OwnershipLiveRange.
7783 // /
7884 // / Corresponds to isOwnershipForwardingInst(...).
79- ArrayRef<Operand *> ownershipForwardingUses;
85+ // /
86+ // / These UsePoints must all be Operands.
87+ ArrayRef<UsePoint> ownershipForwardingUses;
8088
8189 // / Consuming uses that we were not able to understand as a forwarding
8290 // / instruction or a destroy_value. These must be passed a strongly control
8391 // / equivalent +1 value.
84- ArrayRef<Operand *> unknownConsumingUses;
92+ // /
93+ // / These UsePoints must all be Operands.
94+ ArrayRef<UsePoint> unknownConsumingUses;
8595
8696public:
8797 OwnershipLiveRange (SILValue value);
@@ -102,28 +112,17 @@ class LLVM_LIBRARY_VISIBILITY OwnershipLiveRange {
102112 HasConsumingUse_t
103113 hasUnknownConsumingUse (bool assumingFixedPoint = false ) const ;
104114
105- // / Return an array ref to /all/ consuming uses. Will include all 3 sorts of
106- // / consuming uses: destroying uses, forwarding consuming uses, and unknown
107- // / forwarding instruction.
108- ArrayRef<Operand *> getAllConsumingUses () const { return consumingUses; }
109-
110- ArrayRef<Operand *> getDestroyingUses () const { return destroyingUses; }
111-
112- ArrayRef<Operand *> getUnknownConsumingUses () const {
113- return unknownConsumingUses;
115+ UsePointInstructionRange getDestroyingInsts () const {
116+ return UsePointInstructionRange (destroyingUses, UsePointToInstruction ());
114117 }
115118
116- SILInstruction::OperandUserRange getDestroyingInsts () const ;
117-
118- SILInstruction::OperandUserRange getAllConsumingInsts () const ;
119+ UsePointInstructionRange getUnknownConsumingInsts () const {
120+ return UsePointInstructionRange (unknownConsumingUses,
121+ UsePointToInstruction ());
122+ }
119123
120- // / If this LiveRange has a single destroying use, return that use. Otherwise,
121- // / return nullptr.
122- Operand *getSingleDestroyingUse () const {
123- if (destroyingUses.size () != 1 ) {
124- return nullptr ;
125- }
126- return destroyingUses.front ();
124+ UsePointInstructionRange getAllConsumingInsts () const {
125+ return UsePointInstructionRange (consumingUses, UsePointToInstruction ());
127126 }
128127
129128 // / If this LiveRange has a single unknown destroying use, return that
@@ -132,13 +131,14 @@ class LLVM_LIBRARY_VISIBILITY OwnershipLiveRange {
132131 if (unknownConsumingUses.size () != 1 ) {
133132 return nullptr ;
134133 }
135- return unknownConsumingUses.front ();
134+ auto point = unknownConsumingUses.front ();
135+ return point.getOperand ();
136136 }
137137
138138 OwnedValueIntroducer getIntroducer () const { return introducer; }
139139
140- ArrayRef<Operand *> getOwnershipForwardingUses () const {
141- return ownershipForwardingUses;
140+ PointOperandRange getOwnershipForwardingUses () const {
141+ return PointOperandRange ( ownershipForwardingUses, PointToOperand ()) ;
142142 }
143143
144144 void convertOwnedGeneralForwardingUsesToGuaranteed () &&;
0 commit comments