Skip to content

Commit c674f80

Browse files
committed
Address review comments
1 parent 2cadfa0 commit c674f80

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

lib/SILOptimizer/Mandatory/Differentiation.cpp

+7-6
Original file line numberDiff line numberDiff line change
@@ -478,10 +478,8 @@ static SILValue reapplyFunctionConversion(
478478

479479
SILFunction *DifferentiationTransformer::getUnwrappedCurryThunkFunction(
480480
SILFunction *originalFn) {
481-
auto *abstractCE = originalFn->getDeclRef().getAbstractClosureExpr();
482-
if (abstractCE == nullptr)
483-
return nullptr;
484-
auto *autoCE = dyn_cast<AutoClosureExpr>(abstractCE);
481+
auto *autoCE = dyn_cast_or_null<AutoClosureExpr>(
482+
originalFn->getDeclRef().getAbstractClosureExpr());
485483
if (autoCE == nullptr)
486484
return nullptr;
487485

@@ -517,8 +515,11 @@ SILFunction *DifferentiationTransformer::getUnwrappedCurryThunkFunction(
517515
// parameters are not handled since we can't now construct a test case
518516
// for that due to the crash
519517
// https://github.com/swiftlang/swift/issues/77613
520-
if (currentAFD->hasCurriedSelf())
521-
afdToSILFn.insert({currentAFD, &currentFunc});
518+
if (currentAFD->hasCurriedSelf()) {
519+
auto [_, wasEmplace] =
520+
afdToSILFn.try_emplace(currentAFD, &currentFunc);
521+
assert(wasEmplace);
522+
}
522523
}
523524
}
524525

0 commit comments

Comments
 (0)