@@ -538,7 +538,7 @@ void TempRValueOptPass::tryOptimizeCopyIntoTemp(CopyAddrInst *copyInst) {
538538 // If the source of the copyInst is taken, we must insert a compensating
539539 // destroy_addr. This must be done at the right spot: after the last use
540540 // tempObj, but before any (potential) re-initialization of the source.
541- bool needToInsertDestroy = copyInst->isTakeOfSrc ();
541+ bool needFinalDeinit = copyInst->isTakeOfSrc ();
542542
543543 // Scan all uses of the temporary storage (tempObj) to verify they all refer
544544 // to the value initialized by this copy. It is sufficient to check that the
@@ -557,7 +557,7 @@ void TempRValueOptPass::tryOptimizeCopyIntoTemp(CopyAddrInst *copyInst) {
557557
558558 // Also, destroys are allowed to be in a different block.
559559 if (isa<DestroyAddrInst>(user)) {
560- if (!isOSSA && needToInsertDestroy ) {
560+ if (!isOSSA && needFinalDeinit ) {
561561 // In non-OSSA mode, for the purpose of inserting the destroy of
562562 // copySrc, we have to be conservative and assume that the lifetime of
563563 // tempObj goes beyond it's last use - until the final destroy_addr.
@@ -588,7 +588,7 @@ void TempRValueOptPass::tryOptimizeCopyIntoTemp(CopyAddrInst *copyInst) {
588588 // Example:
589589 // copy_addr [take] %copySrc to [init] %tempObj // copyInst
590590 // copy_addr [take] %tempObj to [init] %copySrc // lastLoadInst
591- if (needToInsertDestroy && lastLoadInst != copyInst &&
591+ if (needFinalDeinit && lastLoadInst != copyInst &&
592592 !isa<DestroyAddrInst>(lastLoadInst) &&
593593 aa->mayWriteToMemory (lastLoadInst, copySrc))
594594 return ;
@@ -601,7 +601,7 @@ void TempRValueOptPass::tryOptimizeCopyIntoTemp(CopyAddrInst *copyInst) {
601601
602602 LLVM_DEBUG (llvm::dbgs () << " Success: replace temp" << *tempObj);
603603
604- if (needToInsertDestroy ) {
604+ if (needFinalDeinit ) {
605605 // Compensate the [take] of the original copyInst.
606606 SILBuilderWithScope::insertAfter (lastLoadInst, [&] (SILBuilder &builder) {
607607 builder.createDestroyAddr (builder.getInsertionPoint ()->getLoc (), copySrc);
0 commit comments