Skip to content

Commit 5aebae0

Browse files
authored
Merge pull request #22164 from gottesmm/pr-2108bf854e721e730ce0d72318b224ff0fbc493d
2 parents 53967c5 + ec19f85 commit 5aebae0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/SILOptimizer/Mandatory/MandatoryInlining.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,6 @@ static void fixupReferenceCounts(
9090
auto errorBehavior =
9191
ownership::ErrorBehaviorKind::ReturnFalseOnLeakAssertOtherwise;
9292

93-
// Ok, at this point we know that we have a direct SSA relationship in between
94-
// our partial_apply and
95-
9693
// Add a copy of each non-address type capture argument to lifetime extend the
9794
// captured argument over at least the inlined function and till the end of a
9895
// box if we have an address. This deals with the possibility of the closure
@@ -183,8 +180,11 @@ static void fixupReferenceCounts(
183180
break;
184181
}
185182

186-
// If we have an owned value, we need to insert a copy here for lifetime
187-
// extension purposes.
183+
// If we have an owned value, we insert a copy here for two reasons:
184+
//
185+
// 1. To balance the consuming argument.
186+
// 2. To lifetime extend the value over the call site in case our partial
187+
// apply has another use that would destroy our value first.
188188
case ParameterConvention::Direct_Owned: {
189189
v = SILBuilderWithScope(pai).emitCopyValueOperation(loc, v);
190190

0 commit comments

Comments
 (0)