@@ -337,9 +337,8 @@ visitPointerToAddressInst(PointerToAddressInst *PTAI) {
337
337
OwnershipRAUWHelper helper (ownershipFixupContext, PTAI,
338
338
ATPI->getOperand ());
339
339
if (helper) {
340
- SILBuilderWithScope localBuilder (std::next (PTAI->getIterator ()), Builder);
341
340
auto replacement = helper.prepareReplacement ();
342
- auto *newInst = localBuilder .createUncheckedAddrCast (
341
+ auto *newInst = Builder .createUncheckedAddrCast (
343
342
PTAI->getLoc (), replacement, PTAI->getType ());
344
343
helper.perform (newInst);
345
344
return nullptr ;
@@ -818,15 +817,11 @@ SILCombiner::visitRawPointerToRefInst(RawPointerToRefInst *rawToRef) {
818
817
SILValue originalRef = refToRaw->getOperand ();
819
818
OwnershipRAUWHelper helper (ownershipFixupContext, rawToRef, originalRef);
820
819
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);
825
820
// Since we are using std::next, we use getAutogeneratedLocation to
826
821
// avoid any issues if our next insertion point is a terminator.
827
822
auto loc = RegularLocation::getAutoGeneratedLocation ();
828
823
auto replacement = helper.prepareReplacement ();
829
- auto *newInst = localBuilder .createUncheckedRefCast (
824
+ auto *newInst = Builder .createUncheckedRefCast (
830
825
loc, replacement, rawToRef->getType ());
831
826
// If we have an operand with ownership, we need to change our
832
827
// unchecked_ref_cast to produce an unowned value. This is because
0 commit comments