@@ -473,17 +473,19 @@ void TypeTreeLeafTypeRange::constructFilteredProjections(
473473 llvm_unreachable (" Not understand subtype" );
474474}
475475
476- std::optional<TypeTreeLeafTypeRange>
477- TypeTreeLeafTypeRange::get (Operand *op, SILValue rootValue) {
476+ void TypeTreeLeafTypeRange::get (
477+ Operand *op, SILValue rootValue,
478+ SmallVectorImpl<TypeTreeLeafTypeRange> &ranges) {
478479 auto projectedValue = op->get ();
479480 auto startEltOffset = SubElementOffset::compute (projectedValue, rootValue);
480481 if (!startEltOffset)
481- return std:: nullopt ;
482+ return ;
482483
483484 // A drop_deinit only consumes the deinit bit of its operand.
484485 if (isa<DropDeinitInst>(op->getUser ())) {
485486 auto upperBound = *startEltOffset + TypeSubElementCount (projectedValue);
486- return {{upperBound - 1 , upperBound}};
487+ ranges.push_back ({upperBound - 1 , upperBound});
488+ return ;
487489 }
488490
489491 // An `inject_enum_addr` only initializes the enum tag.
@@ -499,7 +501,8 @@ TypeTreeLeafTypeRange::get(Operand *op, SILValue rootValue) {
499501 }
500502 // TODO: account for deinit component if enum has deinit.
501503 assert (!projectedValue->getType ().isValueTypeWithDeinit ());
502- return {{payloadUpperBound, upperBound}};
504+ ranges.push_back ({payloadUpperBound, upperBound});
505+ return ;
503506 }
504507
505508 // Uses that borrow a value do not involve the deinit bit.
@@ -512,9 +515,9 @@ TypeTreeLeafTypeRange::get(Operand *op, SILValue rootValue) {
512515 deinitBitOffset = 1 ;
513516 }
514517
515- return { {*startEltOffset, *startEltOffset +
516- TypeSubElementCount (projectedValue) -
517- deinitBitOffset}} ;
518+ ranges. push_back ( {*startEltOffset, *startEltOffset +
519+ TypeSubElementCount (projectedValue) -
520+ deinitBitOffset}) ;
518521}
519522
520523void TypeTreeLeafTypeRange::constructProjectionsForNeededElements (
0 commit comments