Skip to content

Commit f46d791

Browse files
committed
ClosureLifetimeFixup review feedback
1 parent 0dd90a7 commit f46d791

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

include/swift/SILOptimizer/Utils/InstOptUtils.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,14 @@ void releasePartialApplyCapturedArg(
281281
SILParameterInfo paramInfo,
282282
InstModCallbacks callbacks = InstModCallbacks());
283283

284-
/// Insert destroys of captured arguments of partial_apply [stack].
284+
/// Insert destroys of captured arguments of partial_apply [stack]. \p builder
285+
/// indicates a position at which the closure's lifetime ends.
286+
///
287+
/// The \p getValueToDestroy callback allows the caller to handle some captured
288+
/// arguments specially. For example, ClosureLifetimeFixup generates borrow
289+
/// scopes for captured arguments; each getValueToDestroy callback then inserts
290+
/// the corresponding end_borrow and returns the owned operand of the borrow,
291+
/// which will then be destroyed as usual.
285292
void insertDestroyOfCapturedArguments(
286293
PartialApplyInst *pai, SILBuilder &builder,
287294
llvm::function_ref<SILValue(SILValue)> getValueToDestroy =

lib/SILOptimizer/Mandatory/ClosureLifetimeFixup.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,6 @@ static SILValue tryRewriteToPartialApplyStack(
619619
if (!argTy.isAddress() && !argTy.isTrivial(*cvt->getFunction())) {
620620
SILValue argValue = arg.get();
621621
bool foundNoImplicitCopy = false;
622-
//!!!
623622
if (auto *mmci = dyn_cast<MoveOnlyWrapperToCopyableValueInst>(argValue)) {
624623
if (mmci->hasOwnedInitialKind() && mmci->hasOneUse()) {
625624
foundNoImplicitCopy = true;

0 commit comments

Comments
 (0)