Skip to content

Commit 51628dd

Browse files
committed
SILCombine: workaround a problem with differential_function in OSSA
Disable this peephole optimization until the underlying problem is fixed. #78848 Part of rdar://140229560
1 parent 09f6f4f commit 51628dd

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/SILOptimizer/SILCombiner/SILCombinerCastVisitors.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -1020,6 +1020,11 @@ 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())
1026+
return nullptr;
1027+
10231028
auto createConvertFunctionOfComponent =
10241029
[&](NormalDifferentiableFunctionTypeComponent extractee) {
10251030
if (!DFI->hasExtractee(extractee))

0 commit comments

Comments
 (0)