Skip to content

Commit 253888f

Browse files
committed
[NFC] Eliminated spurious variable state.
The type Optional<Ty *> implied that there was a meaningful distinction between None and Some(nullptr) but that was not the case here. Replaced it with a bare Ty *.
1 parent 220597e commit 253888f

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

lib/SILOptimizer/Transforms/SILMem2Reg.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ SILInstruction *StackAllocationPromoter::promoteAllocationInBlock(
645645
Optional<StorageStateTracking<LiveValues>> runningVals;
646646
// Keep track of the last StoreInst that we found and the BeginBorrowInst and
647647
// CopyValueInst that we created in response if the alloc_stack was lexical.
648-
Optional<SILInstruction *> lastStoreInst;
648+
SILInstruction *lastStoreInst = nullptr;
649649

650650
// For all instructions in the block.
651651
for (auto bbi = blockPromotingWithin->begin(),
@@ -724,14 +724,14 @@ SILInstruction *StackAllocationPromoter::promoteAllocationInBlock(
724724

725725
// If we met a store before this one, delete it.
726726
if (lastStoreInst) {
727-
assert(cast<StoreInst>(*lastStoreInst)->getOwnershipQualifier() !=
727+
assert(cast<StoreInst>(lastStoreInst)->getOwnershipQualifier() !=
728728
StoreOwnershipQualifier::Assign &&
729729
"store [assign] to the stack location should have been "
730730
"transformed to a store [init]");
731731
LLVM_DEBUG(llvm::dbgs()
732-
<< "*** Removing redundant store: " << *lastStoreInst);
732+
<< "*** Removing redundant store: " << lastStoreInst);
733733
++NumInstRemoved;
734-
prepareForDeletion(*lastStoreInst, instructionsToDelete);
734+
prepareForDeletion(lastStoreInst, instructionsToDelete);
735735
}
736736

737737
auto oldRunningVals = runningVals;
@@ -759,9 +759,9 @@ SILInstruction *StackAllocationPromoter::promoteAllocationInBlock(
759759
// If we met a store before this one, delete it.
760760
if (lastStoreInst) {
761761
LLVM_DEBUG(llvm::dbgs()
762-
<< "*** Removing redundant store: " << *lastStoreInst);
762+
<< "*** Removing redundant store: " << lastStoreInst);
763763
++NumInstRemoved;
764-
prepareForDeletion(*lastStoreInst, instructionsToDelete);
764+
prepareForDeletion(lastStoreInst, instructionsToDelete);
765765
}
766766

767767
// The stored value is the new running value.
@@ -844,14 +844,14 @@ SILInstruction *StackAllocationPromoter::promoteAllocationInBlock(
844844
}
845845

846846
if (lastStoreInst && runningVals->isStorageValid) {
847-
assert((isa<StoreBorrowInst>(*lastStoreInst) ||
848-
(cast<StoreInst>(*lastStoreInst)->getOwnershipQualifier() !=
847+
assert((isa<StoreBorrowInst>(lastStoreInst) ||
848+
(cast<StoreInst>(lastStoreInst)->getOwnershipQualifier() !=
849849
StoreOwnershipQualifier::Assign)) &&
850850
"store [assign] to the stack location should have been "
851851
"transformed to a store [init]");
852852
LLVM_DEBUG(llvm::dbgs()
853-
<< "*** Finished promotion. Last store: " << *lastStoreInst);
854-
return *lastStoreInst;
853+
<< "*** Finished promotion. Last store: " << lastStoreInst);
854+
return lastStoreInst;
855855
}
856856

857857
LLVM_DEBUG(llvm::dbgs() << "*** Finished promotion with no stores.\n");

0 commit comments

Comments
 (0)