Skip to content

Commit 34cc511

Browse files
committed
Fix store_borrow pattern in DefiniteInitialization
1 parent a3d054c commit 34cc511

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/SILOptimizer/Mandatory/DefiniteInitialization.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1838,9 +1838,11 @@ findMethodForStoreInitializationOfTemporary(const DIMemoryObjectInfo &TheMemory,
18381838

18391839
ApplyInst *TheApply = nullptr;
18401840

1841+
auto addr =
1842+
isa<StoreBorrowInst>(SI) ? cast<StoreBorrowInst>(SI) : SI->getDest();
18411843
// Check to see if the address of the alloc_stack is only passed to one
18421844
// apply_inst and gather the apply while we are at it.
1843-
for (auto UI : SI->getDest()->getUses()) {
1845+
for (auto UI : addr->getUses()) {
18441846
if (auto *ApplyUser = dyn_cast<ApplyInst>(UI->getUser())) {
18451847
if (TheApply || UI->getOperandNumber() != 1) {
18461848
return nullptr;

0 commit comments

Comments
 (0)