Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions lib/SIL/IR/SILFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -548,17 +548,6 @@ bool SILFunction::isNoReturnFunction(TypeExpansionContext context) const {
}

ResilienceExpansion SILFunction::getResilienceExpansion() const {
// If package serialization is enabled, we can safely
// assume that the defining .swiftmodule is built from
// source and is never used outside of its package;
// Even if the module is built resiliently, return
// maximal expansion here so aggregate types can be
// treated as loadable in the same resilient domain
// (across modules in the same package).
if (getModule().getSwiftModule()->serializePackageEnabled() &&
getModule().getSwiftModule()->isResilient())
return ResilienceExpansion::Maximal;

// If a function definition is in another module, and
// it was serialized due to package serialization opt,
// a new attribute [serialized_for_package] is added
Expand Down
21 changes: 20 additions & 1 deletion test/SILOptimizer/package-cmo-resilient-mode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ public func runPub(_ arg: PubStruct) -> Int {
public func runPubInlinable(_ arg: Int) -> PubStruct {
// CHECK-RES-DAG: sil [serialized] [serialized_for_package] [canonical] @$s3Lib15runPubInlinableyAA0C6StructVSiF : $@convention(thin) (Int) -> @out PubStruct {
// CHECK-NONRES-DAG: sil [serialized] [canonical] @$s3Lib15runPubInlinableyAA0C6StructVSiF : $@convention(thin) (Int) -> PubStruct {
// CHECK-RES-DAG: alloc_stack [var_decl] $PubStruct
// CHECK-RES-DAG: alloc_stack {{.*}} [var_decl] $PubStruct
// CHECK-RES-DAG: function_ref @$s3Lib9PubStructVyACSicfC : $@convention(method) (Int, @thin PubStruct.Type) -> @out PubStruct
// CHECK-NONRES-DAG: function_ref @$s3Lib9PubStructVyACSicfC : $@convention(method) (Int, @thin PubStruct.Type) -> PubStruct
var x = PubStruct(1)
Expand Down Expand Up @@ -485,3 +485,22 @@ final package class FinalPkgKlass {
// CHECK-COMMON-NEXT: method #PkgProto.data!setter: <Self where Self : PkgProto> (inout Self) -> (Int) -> () : @$s3Lib8PkgKlassCAA0B5ProtoA2aDP4dataSivsTW
// CHECK-COMMON-NEXT: method #PkgProto.data!modify: <Self where Self : PkgProto> (inout Self) -> () -> () : @$s3Lib8PkgKlassCAA0B5ProtoA2aDP4dataSivMTW
// CHECK-COMMON-NEXT: method #PkgProto.pkgfunc: <Self where Self : PkgProto> (Self) -> (Int) -> Int : @$s3Lib8PkgKlassCAA0B5ProtoA2aDP7pkgfuncyS2iFTW

public struct Something {
public init() {}

public func f() -> Int {
return 7
}
}

@usableFromInline
func use(_ c: () -> Int) { }

// Don't crash on this example
@inlinable
public func reproduce(_ e: Something) {
use {
return e.f()
}
}