@@ -790,7 +790,7 @@ SILInstruction *SILCombiner::visitConvertEscapeToNoEscapeInst(
790
790
//
791
791
// This unblocks the `thin_to_thick_function` peephole optimization below.
792
792
if (auto *CFI = dyn_cast<ConvertFunctionInst>(Cvt->getOperand ())) {
793
- if (CFI-> getSingleUse ( )) {
793
+ if (hasOneNonDebugUse (CFI )) {
794
794
if (auto *TTTFI = dyn_cast<ThinToThickFunctionInst>(CFI->getOperand ())) {
795
795
if (TTTFI->getSingleUse ()) {
796
796
auto convertedThickType = CFI->getType ().castTo <SILFunctionType>();
@@ -836,7 +836,7 @@ SILInstruction *SILCombiner::visitConvertEscapeToNoEscapeInst(
836
836
// %vjp' = convert_escape_to_noescape %vjp
837
837
// %y = differentiable_function(%orig', %jvp', %vjp')
838
838
if (auto *DFI = dyn_cast<DifferentiableFunctionInst>(Cvt->getOperand ())) {
839
- if (DFI-> hasOneUse ( )) {
839
+ if (hasOneNonDebugUse (DFI )) {
840
840
auto createConvertEscapeToNoEscape =
841
841
[&](NormalDifferentiableFunctionTypeComponent extractee) {
842
842
if (!DFI->hasExtractee (extractee))
@@ -1020,9 +1020,7 @@ SILCombiner::visitConvertFunctionInst(ConvertFunctionInst *cfi) {
1020
1020
// %vjp' = convert_function %vjp
1021
1021
// %y = differentiable_function(%orig', %jvp', %vjp')
1022
1022
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))
1026
1024
return nullptr ;
1027
1025
1028
1026
auto createConvertFunctionOfComponent =
0 commit comments