Skip to content

Commit 85de7c9

Browse files
committed
[semantic-arc] Add a comment dexplaining that isSingleInitAllocStack does not necessarily contain operands of destroy_addr now that it handles checked_cast_addr_br, unchecked_checked_cast_addr.
1 parent 059421e commit 85de7c9

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/SILOptimizer/SemanticARC/LoadCopyToLoadBorrowOpt.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,10 @@ class StorageGuaranteesLoadVisitor
281281
/// See if we have an alloc_stack that is only written to once by an
282282
/// initializing instruction.
283283
void visitStackAccess(AllocStackInst *stack) {
284-
SmallVector<Operand *, 8> destroyAddrOperands;
285-
bool initialAnswer = isSingleInitAllocStack(stack, destroyAddrOperands);
284+
// These will contain all of the address destroying operands that form the
285+
// lifetime of the object. They may not be destroy_addr!
286+
SmallVector<Operand *, 8> addrDestroyingOperands;
287+
bool initialAnswer = isSingleInitAllocStack(stack, addrDestroyingOperands);
286288
if (!initialAnswer)
287289
return answer(true);
288290

@@ -291,7 +293,7 @@ class StorageGuaranteesLoadVisitor
291293
LinearLifetimeChecker checker(ctx.getDeadEndBlocks());
292294
// Returns true on success. So we invert.
293295
bool foundError = !checker.validateLifetime(
294-
stack, destroyAddrOperands /*consuming users*/,
296+
stack, addrDestroyingOperands /*consuming users*/,
295297
liveRange.getAllConsumingUses() /*non consuming users*/);
296298
return answer(foundError);
297299
}

0 commit comments

Comments
 (0)