@@ -473,17 +473,19 @@ void TypeTreeLeafTypeRange::constructFilteredProjections(
473
473
llvm_unreachable (" Not understand subtype" );
474
474
}
475
475
476
- std::optional<TypeTreeLeafTypeRange>
477
- TypeTreeLeafTypeRange::get (Operand *op, SILValue rootValue) {
476
+ void TypeTreeLeafTypeRange::get (
477
+ Operand *op, SILValue rootValue,
478
+ SmallVectorImpl<TypeTreeLeafTypeRange> &ranges) {
478
479
auto projectedValue = op->get ();
479
480
auto startEltOffset = SubElementOffset::compute (projectedValue, rootValue);
480
481
if (!startEltOffset)
481
- return std::nullopt ;
482
+ return ;
482
483
483
484
// A drop_deinit only consumes the deinit bit of its operand.
484
485
if (isa<DropDeinitInst>(op->getUser ())) {
485
486
auto upperBound = *startEltOffset + TypeSubElementCount (projectedValue);
486
- return {{upperBound - 1 , upperBound}};
487
+ ranges.push_back ({upperBound - 1 , upperBound});
488
+ return ;
487
489
}
488
490
489
491
// An `inject_enum_addr` only initializes the enum tag.
@@ -499,7 +501,8 @@ TypeTreeLeafTypeRange::get(Operand *op, SILValue rootValue) {
499
501
}
500
502
// TODO: account for deinit component if enum has deinit.
501
503
assert (!projectedValue->getType ().isValueTypeWithDeinit ());
502
- return {{payloadUpperBound, upperBound}};
504
+ ranges.push_back ({payloadUpperBound, upperBound});
505
+ return ;
503
506
}
504
507
505
508
// Uses that borrow a value do not involve the deinit bit.
@@ -512,9 +515,9 @@ TypeTreeLeafTypeRange::get(Operand *op, SILValue rootValue) {
512
515
deinitBitOffset = 1 ;
513
516
}
514
517
515
- return { {*startEltOffset, *startEltOffset +
516
- TypeSubElementCount (projectedValue) -
517
- deinitBitOffset}} ;
518
+ ranges. push_back ( {*startEltOffset, *startEltOffset +
519
+ TypeSubElementCount (projectedValue) -
520
+ deinitBitOffset}) ;
518
521
}
519
522
520
523
void TypeTreeLeafTypeRange::constructProjectionsForNeededElements (
0 commit comments