diff --git a/lib/SILOptimizer/UtilityPasses/SILSkippingChecker.cpp b/lib/SILOptimizer/UtilityPasses/SILSkippingChecker.cpp index 93e0cb2b952af..da5d8218cc404 100644 --- a/lib/SILOptimizer/UtilityPasses/SILSkippingChecker.cpp +++ b/lib/SILOptimizer/UtilityPasses/SILSkippingChecker.cpp @@ -72,6 +72,15 @@ static bool shouldHaveSkippedFunction(const SILFunction &F) { return false; } + // Functions with @_backDeploy may be copied into the client, so they + // shouldn't be skipped. The SILFunction that may be copied into the client + // should be serialized and therefore is already handled above. However, a + // second resilient SILFunction is also emitted for back deployed functions. + // Since the body of the function as written was not skipped, it's expected + // that we see the SILFunction for the resilient copy here. + if (func->isBackDeployed()) + return false; + // If none of those conditions trip, then this is something that _should_ // be serialized in the module even when we're skipping non-inlinable // function bodies. diff --git a/test/Serialization/back-deployed-attr-skip-noninlinable-function-bodies.swift b/test/Serialization/back-deployed-attr-skip-noninlinable-function-bodies.swift new file mode 100644 index 0000000000000..ae355a0980cb1 --- /dev/null +++ b/test/Serialization/back-deployed-attr-skip-noninlinable-function-bodies.swift @@ -0,0 +1,5 @@ +// RUN: %target-swift-frontend -parse-as-library -enable-library-evolution -emit-module -module-name Test -experimental-skip-non-inlinable-function-bodies %s + +@available(SwiftStdlib 5.6, *) +@_backDeploy(before: SwiftStdlib 5.7) +public func foo() {}