Skip to content

Commit e0cce4a

Browse files
committed
Serialization: Update -experimental-skip-non-inlinable-function-bodies SIL verification for @_backDeploy.
SIL verification was failing for modules containing functions with `@_backDeploy` because `SILSkippingChecker` expected the `SILFunction` corresponding to the resilient copy of back deployed function to be empty. Since the overall function declaration for a back deployed function is considered inlinable, the body will be typechecked and SILGen emits both the fallback copy of the function and the resilient copy of the function. The checker should therefore expect to see back deployed functions that are not marked as serialized.
1 parent dd015f4 commit e0cce4a

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

lib/SILOptimizer/UtilityPasses/SILSkippingChecker.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,15 @@ static bool shouldHaveSkippedFunction(const SILFunction &F) {
7272
return false;
7373
}
7474

75+
// Functions with @_backDeploy may be copied into the client, so they
76+
// shouldn't be skipped. The SILFunction that may be copied into the client
77+
// should be serialized and therefore is already handled above. However, a
78+
// second resilient SILFunction is also emitted for back deployed functions.
79+
// Since the body of the function as written was not skipped, it's expected
80+
// that we see the SILFunction for the resilient copy here.
81+
if (func->isBackDeployed())
82+
return false;
83+
7584
// If none of those conditions trip, then this is something that _should_
7685
// be serialized in the module even when we're skipping non-inlinable
7786
// function bodies.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// RUN: %target-swift-frontend -parse-as-library -enable-library-evolution -emit-module -module-name Test -experimental-skip-non-inlinable-function-bodies %s
2+
3+
@available(SwiftStdlib 5.6, *)
4+
@_backDeploy(before: SwiftStdlib 5.7)
5+
public func foo() {}

0 commit comments

Comments
 (0)