Skip to content

Commit 220597e

Browse files
committed
[NFC] Removed unneeded variable.
No need to bind to the StoreBorrowInst to get the source because it's already bound to the local variable `stored`. And no need to bind to a more specific type to find the next instruction.
1 parent a805179 commit 220597e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/SILOptimizer/Transforms/SILMem2Reg.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -407,11 +407,11 @@ beginLexicalLifetimeAfterStore(AllocStackInst *asi, SILInstruction *inst) {
407407
SILValue stored = inst->getOperand(CopyLikeInstruction::Src);
408408
SILLocation loc = RegularLocation::getAutoGeneratedLocation(inst->getLoc());
409409

410-
if (auto *sbi = dyn_cast<StoreBorrowInst>(inst)) {
411-
if (isGuaranteedLexicalValue(sbi->getSrc())) {
410+
if (isa<StoreBorrowInst>(inst)) {
411+
if (isGuaranteedLexicalValue(stored)) {
412412
return {{stored, SILValue(), SILValue()}, /*isStorageValid*/ true};
413413
}
414-
auto *borrow = SILBuilderWithScope(sbi->getNextInstruction())
414+
auto *borrow = SILBuilderWithScope(inst->getNextInstruction())
415415
.createBeginBorrow(loc, stored, /*isLexical*/ true);
416416
return {{stored, borrow, SILValue()}, /*isStorageValid*/ true};
417417
}
@@ -896,12 +896,12 @@ StackAllocationPromoter::getLiveOutValues(BlockSetVector &phiBlocks,
896896
LiveValues values = {stored, SILValue(), SILValue()};
897897
return values;
898898
}
899-
if (auto *sbi = dyn_cast<StoreBorrowInst>(inst)) {
900-
if (isGuaranteedLexicalValue(sbi->getSrc())) {
899+
if (isa<StoreBorrowInst>(inst)) {
900+
if (isGuaranteedLexicalValue(stored)) {
901901
LiveValues values = {stored, SILValue(), SILValue()};
902902
return values;
903903
}
904-
auto borrow = cast<BeginBorrowInst>(sbi->getNextInstruction());
904+
auto borrow = cast<BeginBorrowInst>(inst->getNextInstruction());
905905
LiveValues values = {stored, borrow, SILValue()};
906906
return values;
907907
}

0 commit comments

Comments
 (0)