@@ -538,7 +538,7 @@ void TempRValueOptPass::tryOptimizeCopyIntoTemp(CopyAddrInst *copyInst) {
538
538
// If the source of the copyInst is taken, we must insert a compensating
539
539
// destroy_addr. This must be done at the right spot: after the last use
540
540
// tempObj, but before any (potential) re-initialization of the source.
541
- bool needToInsertDestroy = copyInst->isTakeOfSrc ();
541
+ bool needFinalDeinit = copyInst->isTakeOfSrc ();
542
542
543
543
// Scan all uses of the temporary storage (tempObj) to verify they all refer
544
544
// to the value initialized by this copy. It is sufficient to check that the
@@ -557,7 +557,7 @@ void TempRValueOptPass::tryOptimizeCopyIntoTemp(CopyAddrInst *copyInst) {
557
557
558
558
// Also, destroys are allowed to be in a different block.
559
559
if (isa<DestroyAddrInst>(user)) {
560
- if (!isOSSA && needToInsertDestroy ) {
560
+ if (!isOSSA && needFinalDeinit ) {
561
561
// In non-OSSA mode, for the purpose of inserting the destroy of
562
562
// copySrc, we have to be conservative and assume that the lifetime of
563
563
// tempObj goes beyond it's last use - until the final destroy_addr.
@@ -588,7 +588,7 @@ void TempRValueOptPass::tryOptimizeCopyIntoTemp(CopyAddrInst *copyInst) {
588
588
// Example:
589
589
// copy_addr [take] %copySrc to [init] %tempObj // copyInst
590
590
// copy_addr [take] %tempObj to [init] %copySrc // lastLoadInst
591
- if (needToInsertDestroy && lastLoadInst != copyInst &&
591
+ if (needFinalDeinit && lastLoadInst != copyInst &&
592
592
!isa<DestroyAddrInst>(lastLoadInst) &&
593
593
aa->mayWriteToMemory (lastLoadInst, copySrc))
594
594
return ;
@@ -601,7 +601,7 @@ void TempRValueOptPass::tryOptimizeCopyIntoTemp(CopyAddrInst *copyInst) {
601
601
602
602
LLVM_DEBUG (llvm::dbgs () << " Success: replace temp" << *tempObj);
603
603
604
- if (needToInsertDestroy ) {
604
+ if (needFinalDeinit ) {
605
605
// Compensate the [take] of the original copyInst.
606
606
SILBuilderWithScope::insertAfter (lastLoadInst, [&] (SILBuilder &builder) {
607
607
builder.createDestroyAddr (builder.getInsertionPoint ()->getLoc (), copySrc);
0 commit comments