@@ -790,7 +790,7 @@ SILInstruction *SILCombiner::visitConvertEscapeToNoEscapeInst(
790790 //
791791 // This unblocks the `thin_to_thick_function` peephole optimization below.
792792 if (auto *CFI = dyn_cast<ConvertFunctionInst>(Cvt->getOperand ())) {
793- if (CFI-> getSingleUse ( )) {
793+ if (hasOneNonDebugUse (CFI )) {
794794 if (auto *TTTFI = dyn_cast<ThinToThickFunctionInst>(CFI->getOperand ())) {
795795 if (TTTFI->getSingleUse ()) {
796796 auto convertedThickType = CFI->getType ().castTo <SILFunctionType>();
@@ -836,7 +836,7 @@ SILInstruction *SILCombiner::visitConvertEscapeToNoEscapeInst(
836836 // %vjp' = convert_escape_to_noescape %vjp
837837 // %y = differentiable_function(%orig', %jvp', %vjp')
838838 if (auto *DFI = dyn_cast<DifferentiableFunctionInst>(Cvt->getOperand ())) {
839- if (DFI-> hasOneUse ( )) {
839+ if (hasOneNonDebugUse (DFI )) {
840840 auto createConvertEscapeToNoEscape =
841841 [&](NormalDifferentiableFunctionTypeComponent extractee) {
842842 if (!DFI->hasExtractee (extractee))
@@ -1020,9 +1020,7 @@ SILCombiner::visitConvertFunctionInst(ConvertFunctionInst *cfi) {
10201020 // %vjp' = convert_function %vjp
10211021 // %y = differentiable_function(%orig', %jvp', %vjp')
10221022 if (auto *DFI = dyn_cast<DifferentiableFunctionInst>(cfi->getOperand ())) {
1023- // Workaround for a problem with OSSA: https://github.com/swiftlang/swift/issues/78848
1024- // TODO: remove this if-statement once the underlying problem is fixed.
1025- if (cfi->getFunction ()->hasOwnership ())
1023+ if (!hasOneNonDebugUse (DFI))
10261024 return nullptr ;
10271025
10281026 auto createConvertFunctionOfComponent =
0 commit comments