Skip to content

Commit 694ee2d

Browse files
authored
Merge pull request #78849 from eeckstein/autodiff-workarounds
Two workarounds for autodiff specific optimizations with OSSA
2 parents 95dca81 + 51628dd commit 694ee2d

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

SwiftCompilerSources/Sources/Optimizer/FunctionPasses/ClosureSpecialization.swift

+6
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,12 @@ private func handleApplies(for rootClosure: SingleValueInstruction, callSiteMap:
503503
continue
504504
}
505505

506+
// Workaround for a problem with OSSA: https://github.com/swiftlang/swift/issues/78847
507+
// TODO: remove this if-statement once the underlying problem is fixed.
508+
if callee.hasOwnership {
509+
continue
510+
}
511+
506512
if callee.isDefinedExternally {
507513
continue
508514
}

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)