@@ -645,7 +645,7 @@ SILInstruction *StackAllocationPromoter::promoteAllocationInBlock(
645
645
Optional<StorageStateTracking<LiveValues>> runningVals;
646
646
// Keep track of the last StoreInst that we found and the BeginBorrowInst and
647
647
// CopyValueInst that we created in response if the alloc_stack was lexical.
648
- Optional< SILInstruction *> lastStoreInst;
648
+ SILInstruction *lastStoreInst = nullptr ;
649
649
650
650
// For all instructions in the block.
651
651
for (auto bbi = blockPromotingWithin->begin (),
@@ -724,14 +724,14 @@ SILInstruction *StackAllocationPromoter::promoteAllocationInBlock(
724
724
725
725
// If we met a store before this one, delete it.
726
726
if (lastStoreInst) {
727
- assert (cast<StoreInst>(* lastStoreInst)->getOwnershipQualifier () !=
727
+ assert (cast<StoreInst>(lastStoreInst)->getOwnershipQualifier () !=
728
728
StoreOwnershipQualifier::Assign &&
729
729
" store [assign] to the stack location should have been "
730
730
" transformed to a store [init]" );
731
731
LLVM_DEBUG (llvm::dbgs ()
732
- << " *** Removing redundant store: " << * lastStoreInst);
732
+ << " *** Removing redundant store: " << lastStoreInst);
733
733
++NumInstRemoved;
734
- prepareForDeletion (* lastStoreInst, instructionsToDelete);
734
+ prepareForDeletion (lastStoreInst, instructionsToDelete);
735
735
}
736
736
737
737
auto oldRunningVals = runningVals;
@@ -759,9 +759,9 @@ SILInstruction *StackAllocationPromoter::promoteAllocationInBlock(
759
759
// If we met a store before this one, delete it.
760
760
if (lastStoreInst) {
761
761
LLVM_DEBUG (llvm::dbgs ()
762
- << " *** Removing redundant store: " << * lastStoreInst);
762
+ << " *** Removing redundant store: " << lastStoreInst);
763
763
++NumInstRemoved;
764
- prepareForDeletion (* lastStoreInst, instructionsToDelete);
764
+ prepareForDeletion (lastStoreInst, instructionsToDelete);
765
765
}
766
766
767
767
// The stored value is the new running value.
@@ -844,14 +844,14 @@ SILInstruction *StackAllocationPromoter::promoteAllocationInBlock(
844
844
}
845
845
846
846
if (lastStoreInst && runningVals->isStorageValid ) {
847
- assert ((isa<StoreBorrowInst>(* lastStoreInst) ||
848
- (cast<StoreInst>(* lastStoreInst)->getOwnershipQualifier () !=
847
+ assert ((isa<StoreBorrowInst>(lastStoreInst) ||
848
+ (cast<StoreInst>(lastStoreInst)->getOwnershipQualifier () !=
849
849
StoreOwnershipQualifier::Assign)) &&
850
850
" store [assign] to the stack location should have been "
851
851
" transformed to a store [init]" );
852
852
LLVM_DEBUG (llvm::dbgs ()
853
- << " *** Finished promotion. Last store: " << * lastStoreInst);
854
- return * lastStoreInst;
853
+ << " *** Finished promotion. Last store: " << lastStoreInst);
854
+ return lastStoreInst;
855
855
}
856
856
857
857
LLVM_DEBUG (llvm::dbgs () << " *** Finished promotion with no stores.\n " );
0 commit comments