@@ -337,9 +337,8 @@ visitPointerToAddressInst(PointerToAddressInst *PTAI) {
337337 OwnershipRAUWHelper helper (ownershipFixupContext, PTAI,
338338 ATPI->getOperand ());
339339 if (helper) {
340- SILBuilderWithScope localBuilder (std::next (PTAI->getIterator ()), Builder);
341340 auto replacement = helper.prepareReplacement ();
342- auto *newInst = localBuilder .createUncheckedAddrCast (
341+ auto *newInst = Builder .createUncheckedAddrCast (
343342 PTAI->getLoc (), replacement, PTAI->getType ());
344343 helper.perform (newInst);
345344 return nullptr ;
@@ -818,15 +817,11 @@ SILCombiner::visitRawPointerToRefInst(RawPointerToRefInst *rawToRef) {
818817 SILValue originalRef = refToRaw->getOperand ();
819818 OwnershipRAUWHelper helper (ownershipFixupContext, rawToRef, originalRef);
820819 if (helper) {
821- // We use the refToRaw's insertion point to insert our
822- // unchecked_ref_cast, since we don't know if our guaranteed value
823- SILBuilderWithScope localBuilder (std::next (refToRaw->getIterator ()),
824- Builder);
825820 // Since we are using std::next, we use getAutogeneratedLocation to
826821 // avoid any issues if our next insertion point is a terminator.
827822 auto loc = RegularLocation::getAutoGeneratedLocation ();
828823 auto replacement = helper.prepareReplacement ();
829- auto *newInst = localBuilder .createUncheckedRefCast (
824+ auto *newInst = Builder .createUncheckedRefCast (
830825 loc, replacement, rawToRef->getType ());
831826 // If we have an operand with ownership, we need to change our
832827 // unchecked_ref_cast to produce an unowned value. This is because
0 commit comments