mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Fix mem2reg for load_borrows with reborrows
StackAllocationPromoter::pruneAllocStackUsage substitutes loads/stores of alloc_stack with values. For some reason isLoadFromStack was bailing out for load_borrows with reborrows leaving them to be fixed up by fixBranchesAndUses which uses live in value from predecessors for substitution which is obviosly incorrect the block containing the load_borrow has a store before it. Fixes rdar://145834542
This commit is contained in:
@@ -377,11 +377,6 @@ static bool isLoadFromStack(SILInstruction *i, AllocStackInst *asi) {
|
||||
if (!isa<LoadInst>(i) && !isa<LoadBorrowInst>(i))
|
||||
return false;
|
||||
|
||||
if (auto *lbi = dyn_cast<LoadBorrowInst>(i)) {
|
||||
if (BorrowedValue(lbi).hasReborrow())
|
||||
return false;
|
||||
}
|
||||
|
||||
// Skip struct and tuple address projections.
|
||||
ValueBase *op = i->getOperand(0);
|
||||
while (op != asi) {
|
||||
|
||||
Reference in New Issue
Block a user