Skip to content

Commit 8413073

Browse files
committed
Correctly terminate inner coroutine for custom vjps
1 parent 3e52062 commit 8413073

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lib/SILGen/SILGenApply.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5395,6 +5395,7 @@ class EndCoroutineApply : public Cleanup {
53955395
if (forUnwind && CanUnwind) {
53965396
SGF.B.createAbortApply(l, ApplyToken);
53975397
} else {
5398+
// TODO: This is not correct when coroutine has a normal result
53985399
SGF.B.createEndApply(l, ApplyToken,
53995400
SILType::getEmptyTupleType(SGF.getASTContext()));
54005401
}

lib/SILGen/SILGenPoly.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6486,7 +6486,7 @@ ManagedValue SILGenFunction::getThunkedAutoDiffLinearMap(
64866486
SILType substFnType = linearMapArg->getType().substGenericArgs(
64876487
thunkSGF.getModule(), subs, thunk->getTypeExpansionContext());
64886488
auto tokenAndCleanups = thunkSGF.emitBeginApplyWithRethrow(
6489-
loc, linearMapArg, substFnType,
6489+
loc, linearMapArg, substFnType, true,
64906490
SubstitutionMap(), arguments, yields);
64916491
auto token = std::get<0>(tokenAndCleanups);
64926492
auto abortCleanup = std::get<1>(tokenAndCleanups);
@@ -6762,7 +6762,7 @@ SILFunction *SILGenModule::getOrCreateCustomDerivativeThunk(
67626762
SmallVector<SILValue, 1> yields;
67636763
// Start inner coroutine execution till the suspend point
67646764
auto tokenAndCleanups = thunkSGF.emitBeginApplyWithRethrow(
6765-
loc, fnRef, substFnType /*fnRef->getType()*/,
6765+
loc, fnRef, substFnType /*fnRef->getType()*/, true,
67666766
subs, arguments, yields);
67676767
auto token = std::get<0>(tokenAndCleanups);
67686768
auto abortCleanup = std::get<1>(tokenAndCleanups);

0 commit comments

Comments
 (0)