Skip to content

Commit a1641e2

Browse files
authored
Merge pull request #15894 from slavapestov/sil-link-fewer-functions
Deserialize fewer SIL functions in -Onone
2 parents 5bfd8e1 + bb244b2 commit a1641e2

16 files changed

+118
-64
lines changed

lib/SIL/Linker.cpp

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,45 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13+
/// \file The SIL linker walks the call graph beginning at a starting function,
14+
/// deserializing functions, vtables and witness tables.
15+
///
16+
/// The behavior of the linker is controlled by a LinkMode value. The LinkMode
17+
/// has three possible values:
18+
///
19+
/// - LinkNone: The linker does not deserialize anything. This is only used for
20+
/// debugging and testing purposes, and never during normal operation.
21+
///
22+
/// - LinkNormal: The linker deserializes bodies for declarations that must be
23+
/// emitted into the client because they do not have definitions available
24+
/// externally. This includes:
25+
///
26+
/// - witness tables for imported conformances
27+
///
28+
/// - functions with shared linkage
29+
///
30+
/// - LinkAll: All reachable functions (including public functions) are
31+
/// deserialized, including public functions.
32+
///
33+
/// The primary entry point into the linker is the SILModule::linkFunction()
34+
/// function, which recursively walks the call graph starting from the given
35+
/// function.
36+
///
37+
/// In the mandatory pipeline (-Onone), the linker is invoked from the mandatory
38+
/// SIL linker pass, which pulls in just enough to allow us to emit code, using
39+
/// LinkNormal mode.
40+
///
41+
/// In the performance pipeline, after guaranteed optimizations but before
42+
/// performance optimizations, the 'performance SILLinker' pass links
43+
/// transitively all reachable functions, to uncover optimization opportunities
44+
/// that might be missed from deserializing late. The performance pipeline uses
45+
/// LinkAll mode.
46+
///
47+
/// *NOTE*: In LinkAll mode, we deserialize all vtables and witness tables,
48+
/// even those with public linkage. This is not strictly necessary, since the
49+
/// devirtualizer deserializes vtables and witness tables as needed. However,
50+
/// doing so early creates more opportunities for optimization.
51+
1352
#define DEBUG_TYPE "sil-linker"
1453
#include "Linker.h"
1554
#include "llvm/ADT/Statistic.h"
@@ -80,7 +119,7 @@ bool SILLinkerVisitor::processFunction(SILFunction *F) {
80119

81120
// If F is a declaration, first deserialize it.
82121
if (F->isExternalDeclaration()) {
83-
addFunctionToWorklist(F);
122+
maybeAddFunctionToWorklist(F);
84123
} else {
85124
Worklist.push_back(F);
86125
}

lib/SIL/SILPrinter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2681,7 +2681,7 @@ void SILModule::print(SILPrintContext &PrintCtx, ModuleDecl *M,
26812681
if (!WholeModuleMode && !(D->getDeclContext() == AssociatedDeclContext))
26822682
continue;
26832683
if ((isa<ValueDecl>(D) || isa<OperatorDecl>(D) ||
2684-
isa<ExtensionDecl>(D)) &&
2684+
isa<ExtensionDecl>(D) || isa<ImportDecl>(D)) &&
26852685
!D->isImplicit()) {
26862686
if (isa<AccessorDecl>(D))
26872687
continue;

lib/SILOptimizer/Transforms/Devirtualizer.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,9 @@ bool Devirtualizer::devirtualizeAppliesInFunction(SILFunction &F,
9393
assert(CalleeFn && "Expected devirtualized callee!");
9494

9595
// We need to ensure that we link after devirtualizing in order to pull in
96-
// everything we reference from another module. This is especially important
97-
// for transparent functions, because if transparent functions are not
98-
// inlined for some reason, we need to generate code for them.
99-
// Note that functions, which are only referenced from witness/vtables, are
100-
// not linked upfront by the SILLinker.
96+
// everything we reference from another module, which may expose optimization
97+
// opportunities and is also needed for correctness if we reference functions
98+
// with non-public linkage. See lib/SIL/Linker.cpp for details.
10199
if (!CalleeFn->isDefinition())
102100
F.getModule().linkFunction(CalleeFn, SILModule::LinkingMode::LinkAll);
103101

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1+
sil non_abi [serialized] @other_public_non_abi_function : $@convention(thin) () -> () {
2+
%0 = tuple ()
3+
return %0 : $()
4+
}
5+
16
sil non_abi [serialized] @public_non_abi_function : $@convention(thin) () -> () {
7+
%fn = function_ref @other_public_non_abi_function : $@convention(thin) () -> ()
28
%0 = tuple ()
39
return %0 : $()
410
}

test/SIL/Serialization/public_non_abi.sil

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-swift-frontend -emit-module -o %t %S/Inputs/def_public_non_abi.sil
3-
// RUN: %target-sil-opt -performance-linker -I %t %s | %FileCheck %s
3+
// RUN: %target-swift-frontend -emit-sil -I %t %s | %FileCheck %s
44

55
sil_stage raw
66

@@ -20,6 +20,11 @@ bb0:
2020
}
2121

2222
// Make sure the function body is deserialized.
23-
// CHECK-LABEL: sil shared_external [serialized] [canonical] @public_non_abi_function : $@convention(thin) () -> ()
23+
// CHECK-LABEL: sil shared_external [serialized] @public_non_abi_function : $@convention(thin) () -> ()
24+
// CHECK: function_ref @other_public_non_abi_function
2425
// CHECK: return
2526
sil hidden_external [serialized] @public_non_abi_function : $@convention(thin) () -> ()
27+
28+
// Make sure the function body is deserialized.
29+
// CHECK-LABEL: sil shared_external [serialized] @other_public_non_abi_function : $@convention(thin) () -> ()
30+
// CHECK: return

test/SIL/Serialization/vtable_deserialization.swift

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,15 @@ import vtable_deserialization_input
1111
Class.firstMethod()
1212

1313

14-
// For now, we also deserialize the body of firstMethod(), even though it
15-
// is not transparent.
16-
// CHECK-LABEL: sil public_external [serialized] @$S28vtable_deserialization_input5ClassC11firstMethodyyFZ : $@convention(method) (@thick Class.Type) -> () {
17-
// OPT-LABEL: sil public_external @$S28vtable_deserialization_input5ClassC11firstMethodyyFZ : $@convention(method) (@thick Class.Type) -> () {
14+
// The methods should not be deserialized in the mandatory pipeline.
1815

19-
// The other two methods should not be deserialized in the mandatory
20-
// pipeline.
16+
// CHECK-LABEL: sil [serialized] @$S28vtable_deserialization_input5ClassC11firstMethodyyFZ : $@convention(method) (@thick Class.Type) -> (){{$}}
17+
// OPT-LABEL: sil public_external @$S28vtable_deserialization_input5ClassC11firstMethodyyFZ : $@convention(method) (@thick Class.Type) -> () {
2118

22-
// FIXME: Temporary regression
23-
// CHECK-LABEL: sil public_external [serialized] @$S28vtable_deserialization_input5ClassC12secondMethodyyFZ : $@convention(method) (@thick Class.Type) -> () {
19+
// CHECK-LABEL: sil [serialized] @$S28vtable_deserialization_input5ClassC12secondMethodyyFZ : $@convention(method) (@thick Class.Type) -> (){{$}}
2420
// OPT-LABEL: sil public_external @$S28vtable_deserialization_input5ClassC12secondMethodyyFZ : $@convention(method) (@thick Class.Type) -> () {
2521

26-
// CHECK-LABEL: sil public_external [serialized] @$S28vtable_deserialization_input5ClassC11thirdMethodyyFZ : $@convention(method) (@thick Class.Type) -> () {
22+
// CHECK-LABEL: sil [serialized] @$S28vtable_deserialization_input5ClassC11thirdMethodyyFZ : $@convention(method) (@thick Class.Type) -> (){{$}}
2723
// OPT-LABEL: sil public_external @$S28vtable_deserialization_input5ClassC11thirdMethodyyFZ : $@convention(method) (@thick Class.Type) -> () {
2824

2925
// Make sure we deserialized the vtable.

test/SILOptimizer/Inputs/linker_pass_input.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
@_silgen_name("unknown")
33
public func unknown() -> ()
44

5+
@inline(never)
56
@inlinable
67
public func doSomething() {
78
unknown()

test/SILOptimizer/hello-world.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// RUN: rm -rf %t && mkdir -p %t/stats
2+
// RUN: %target-swift-frontend -emit-sil -stats-output-dir %t/stats %s -o /dev/null
3+
// RUN: %utils/process-stats-dir.py --evaluate 'NumSILGenFunctions < 10' %t/stats
4+
// RUN: %utils/process-stats-dir.py --evaluate 'NumSILOptFunctions < 10' %t/stats
5+
6+
print("Hello world")

test/SILOptimizer/linker.swift

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-swift-frontend -emit-module %S/Inputs/linker_pass_input.swift -o %t/Swift.swiftmodule -parse-stdlib -parse-as-library -module-name Swift -module-link-name swiftCore
3-
// RUN: %target-swift-frontend %s -O -I %t -sil-debug-serialization -o - -emit-sil | %FileCheck %s
3+
// RUN: %target-swift-frontend %s -I %t -emit-sil | %FileCheck %s
4+
// RUN: %target-swift-frontend %s -I %t -O -emit-sil | %FileCheck %s --check-prefix=OPT
45

5-
// CHECK: sil public_external [serialized] [canonical] @$Ss11doSomethingyyF : $@convention(thin) () -> () {
6+
// CHECK: sil [serialized] [noinline] @$Ss11doSomethingyyF : $@convention(thin) () -> (){{$}}
7+
// OPT: sil public_external [noinline] @$Ss11doSomethingyyF : $@convention(thin) () -> () {
68
doSomething()
79

810
// CHECK: sil @$Ss12doSomething2yyF : $@convention(thin) () -> ()
911
// CHECK-NOT: return
1012
doSomething2()
1113

12-
// CHECK: sil public_external [serialized] [noinline] [canonical] @$Ss16callDoSomething3yyF
14+
// CHECK: sil [serialized] [noinline] @$Ss16callDoSomething3yyF : $@convention(thin) () -> (){{$}}
15+
// OPT: sil public_external [noinline] @$Ss16callDoSomething3yyF : $@convention(thin) () -> () {
1316

14-
// CHECK: sil [canonical] @unknown
17+
// OPT: sil @unknown
1518

16-
// CHECK: sil [canonical] @$Ss1AVABycfC
19+
// OPT: sil @$Ss1AVABycfC
1720

18-
// CHECK: sil [noinline] [canonical] @$Ss12doSomething3yyxlF
19-
// CHECK-NOT: return
21+
// OPT: sil [noinline] @$Ss12doSomething3yyxlF : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> (){{$}}
2022

2123
callDoSomething3()

test/Serialization/Inputs/def_basic.sil

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,37 +1132,23 @@ entry(%f : $@convention(thin) (Int) -> @out Int, %x : $Int):
11321132
return %y : $Int
11331133
}
11341134

1135-
// Make sure we serialize the body of closure even without -sil-serialize-all.
1136-
// CHECK_DECL-LABEL: @partial_apply_with_closure
1137-
sil [transparent] [serialized] [transparent] @partial_apply_with_closure : $@convention(thin) (@owned @callee_owned () -> Bool, @owned String, UnsafePointer<Int8>, Int64) -> () {
1135+
// CHECK-LABEL: @partial_apply_with_closure
1136+
sil [transparent] [serialized] @partial_apply_with_closure : $@convention(thin) (@owned @callee_owned () -> Bool, @owned String, UnsafePointer<Int8>, Int64) -> () {
11381137
bb0(%0 : $@callee_owned () -> Bool, %1 : $String, %2 : $UnsafePointer<Int8>, %3 : $Int64):
11391138
%17 = function_ref @closure_body : $@convention(thin) (UnsafePointer<Int8>, UnsafePointer<Int8>, Int64) -> ()
1140-
// CHECK_DECL: function_ref @closure_body
1139+
// CHECK: function_ref @closure_body
11411140
%18 = partial_apply %17(%2, %3) : $@convention(thin) (UnsafePointer<Int8>, UnsafePointer<Int8>, Int64) -> ()
1142-
// CHECK_DECL: partial_apply
1141+
// CHECK: partial_apply
11431142
%30 = tuple ()
11441143
return %30 : $()
11451144
}
11461145

1147-
sil shared [serialized] @closure_body : $@convention(thin) (UnsafePointer<Int8>, UnsafePointer<Int8>, Int64) -> () {
1148-
bb0(%0 : $UnsafePointer<Int8>, %1 : $UnsafePointer<Int8>, %2 : $Int64):
1149-
%3 = function_ref @assert_fail : $@convention(thin) (UnsafePointer<Int8>, UnsafePointer<Int8>, Int64) -> ()
1150-
%4 = apply %3(%0, %1, %2) : $@convention(thin) (UnsafePointer<Int8>, UnsafePointer<Int8>, Int64) -> ()
1151-
%5 = tuple ()
1152-
return %5 : $()
1153-
}
1154-
1155-
// CHECK_DECL-LABEL: @closure_body : $@convention(thin) (UnsafePointer<Int8>, UnsafePointer<Int8>, Int64) -> () {
1156-
// CHECK_DECL: function_ref @assert_fail
1157-
1158-
sil [transparent] [serialized] @assert_fail : $@convention(thin) (UnsafePointer<Int8>, UnsafePointer<Int8>, Int64) -> ()
1159-
11601146
// rdar: 15893086
11611147
struct GenericStruct<T> {
11621148
var x : T
11631149
}
11641150

1165-
// CHECK-LABEL: @extract_generic_struct
1151+
// CHECK-LABEL: sil public_external [transparent] [serialized] @extract_generic_struct
11661152
sil [transparent] [serialized] @extract_generic_struct : $@convention(thin) GenericStruct<Int64> -> Int64 {
11671153
entry(%0 : $GenericStruct<Int64>):
11681154
// CHECK: %1 = struct_extract %0 : $GenericStruct<Int64>, #GenericStruct.x
@@ -1347,6 +1333,19 @@ bb0(%0 : $Int32, %1 : $Int, %2 : $Int, %3 : $Foo):
13471333
}
13481334

13491335

1336+
sil [transparent] [serialized] @assert_fail : $@convention(thin) (UnsafePointer<Int8>, UnsafePointer<Int8>, Int64) -> ()
1337+
1338+
sil shared [serialized] @closure_body : $@convention(thin) (UnsafePointer<Int8>, UnsafePointer<Int8>, Int64) -> () {
1339+
bb0(%0 : $UnsafePointer<Int8>, %1 : $UnsafePointer<Int8>, %2 : $Int64):
1340+
%3 = function_ref @assert_fail : $@convention(thin) (UnsafePointer<Int8>, UnsafePointer<Int8>, Int64) -> ()
1341+
%4 = apply %3(%0, %1, %2) : $@convention(thin) (UnsafePointer<Int8>, UnsafePointer<Int8>, Int64) -> ()
1342+
%5 = tuple ()
1343+
return %5 : $()
1344+
}
1345+
1346+
// CHECK-LABEL: @closure_body : $@convention(thin) (UnsafePointer<Int8>, UnsafePointer<Int8>, Int64) -> () {
1347+
// CHECK: function_ref @assert_fail
1348+
13501349
sil_vtable [serialized] Foo {
13511350
#Foo.subscript!getter.1: @$S3tmp3FooC9subscriptSiSi1x_Si1ytcfg
13521351
#Foo.subscript!setter.1: @$S3tmp3FooC9subscriptSiSi1x_Si1ytcfs

test/Serialization/Inputs/def_transparent.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ public enum MaybePair {
4444
case Right(String)
4545
case Both(Int32, String)
4646
}
47-
@inlinable
47+
48+
@_transparent
4849
public func do_switch(u u: MaybePair) {
4950
switch u {
5051
case .Neither:
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-swift-frontend -emit-module -o %t %S/Inputs/def_always_inline.swift
33
// RUN: llvm-bcanalyzer %t/def_always_inline.swiftmodule | %FileCheck %s
4-
// RUN: %target-swift-frontend -emit-sil -I %t %s | %FileCheck %s -check-prefix=SIL
4+
// RUN: %target-swift-frontend -emit-sib -I %t %s -o %t/always_inline.sib
5+
// RUN: %target-sil-opt -performance-linker %t/always_inline.sib -I %t | %FileCheck %s -check-prefix=SIL
56

67
// CHECK-NOT: UnknownCode
78

89
import def_always_inline
910

11+
// SIL-LABEL: sil public_external [serialized] [always_inline] [canonical] @$S17def_always_inline22AlwaysInlineInitStructV1xACSb_tcfC : $@convention(method) (Bool, @thin AlwaysInlineInitStruct.Type) -> AlwaysInlineInitStruct {
12+
13+
// SIL-LABEL: sil public_external [serialized] [always_inline] [canonical] @$S17def_always_inline16testAlwaysInline1xS2b_tF : $@convention(thin) (Bool) -> Bool {
14+
1015
// SIL-LABEL: sil @main
1116
// SIL: [[RAW:%.+]] = global_addr @$S13always_inline3rawSbvp : $*Bool
1217
// SIL: [[FUNC:%.+]] = function_ref @$S17def_always_inline16testAlwaysInline1xS2b_tF : $@convention(thin) (Bool) -> Bool
@@ -16,10 +21,5 @@ var raw = testAlwaysInline(x: false)
1621

1722
// SIL: [[FUNC2:%.+]] = function_ref @$S17def_always_inline22AlwaysInlineInitStructV1xACSb_tcfC : $@convention(method) (Bool, @thin AlwaysInlineInitStruct.Type) -> AlwaysInlineInitStruct
1823
// SIL: apply [[FUNC2]]({{%.+}}, {{%.+}}) : $@convention(method) (Bool, @thin AlwaysInlineInitStruct.Type) -> AlwaysInlineInitStruct
19-
2024
var a = AlwaysInlineInitStruct(x: false)
2125

22-
// SIL-LABEL: [always_inline] @$S17def_always_inline16testAlwaysInline1xS2b_tF : $@convention(thin) (Bool) -> Bool
23-
24-
// SIL-LABEL: sil public_external [serialized] [always_inline] @$S17def_always_inline22AlwaysInlineInitStructV1xACSb_tcfC : $@convention(method) (Bool, @thin AlwaysInlineInitStruct.Type) -> AlwaysInlineInitStruct {
25-

test/Serialization/basic_sil.swift

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-build-swift -Xfrontend -assume-parsing-unqualified-ownership-sil -emit-module -Xfrontend -disable-diagnostic-passes -force-single-frontend-invocation -o %t/def_basic.swiftmodule %S/Inputs/def_basic.sil
33
// RUN: llvm-bcanalyzer %t/def_basic.swiftmodule | %FileCheck %s
4-
// RUN: %target-build-swift -emit-sil -I %t %s | %FileCheck %S/Inputs/def_basic.sil
5-
6-
// RUN: %empty-directory(%t)
7-
// RUN: %target-build-swift -Xfrontend -assume-parsing-unqualified-ownership-sil -emit-module -Xfrontend -disable-diagnostic-passes -force-single-frontend-invocation -o %t/def_basic.swiftmodule %S/Inputs/def_basic.sil
8-
// RUN: %target-build-swift -emit-sil -I %t %s | %FileCheck -check-prefix=CHECK_DECL %S/Inputs/def_basic.sil
4+
// RUN: %target-build-swift -emit-sil -I %t %s -o %t/basic_sil.sil
5+
// RUN: %target-sil-opt -I %t %t/basic_sil.sil -performance-linker | %FileCheck %S/Inputs/def_basic.sil
96

107
// This test currently is written such that no optimizations are assumed.
118
// REQUIRES: swift_test_mode_optimize_none

test/Serialization/basic_sil_objc.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-build-swift -Xfrontend %clang-importer-sdk -I %S/../Inputs/clang-importer-sdk/swift-modules -emit-module -Xfrontend -disable-diagnostic-passes -force-single-frontend-invocation -o %t/def_basic_objc.swiftmodule %S/Inputs/def_basic_objc.sil
33
// RUN: llvm-bcanalyzer %t/def_basic_objc.swiftmodule | %FileCheck %s
4-
// RUN: %target-build-swift -Xfrontend %clang-importer-sdk -emit-sil -I %t %s | %FileCheck %S/Inputs/def_basic_objc.sil
4+
5+
// RUN: %target-build-swift -Xfrontend %clang-importer-sdk -emit-sil -I %t %s -o %t/basic_sil_objc.sil
6+
// RUN: %target-sil-opt %t/basic_sil_objc.sil -performance-linker -I %t | %FileCheck %S/Inputs/def_basic_objc.sil
57

68
// This test currently is written such that no optimizations are assumed.
79
// REQUIRES: swift_test_mode_optimize_none
@@ -10,6 +12,7 @@
1012
// CHECK-NOT: UnknownCode
1113

1214
import def_basic_objc
15+
import Foundation
1316

1417
func test_all() {
1518
serialize_all()

test/Serialization/noinline.swift

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-swift-frontend -emit-module -o %t %S/Inputs/def_noinline.swift
33
// RUN: llvm-bcanalyzer %t/def_noinline.swiftmodule | %FileCheck %s
4-
// RUN: %target-swift-frontend -emit-sil -I %t %s | %FileCheck %s -check-prefix=SIL
4+
// RUN: %target-swift-frontend -emit-sib -I %t %s -o %t/noinline.sib
5+
// RUN: %target-sil-opt -performance-linker %t/noinline.sib -I %t | %FileCheck %s -check-prefix=SIL
56

67
// CHECK-NOT: UnknownCode
78

89
import def_noinline
910

11+
// SIL-LABEL: sil public_external [serialized] [noinline] [canonical] @$S12def_noinline18NoInlineInitStructV1xACSb_tcfC : $@convention(method) (Bool, @thin NoInlineInitStruct.Type) -> NoInlineInitStruct {
12+
13+
// SIL-LABEL: sil public_external [serialized] [noinline] [canonical] @$S12def_noinline12testNoinline1xS2b_tF : $@convention(thin) (Bool) -> Bool {
14+
1015
// SIL-LABEL: sil @main
1116
// SIL: [[RAW:%.+]] = global_addr @$S8noinline3rawSbvp : $*Bool
1217
// SIL: [[FUNC:%.+]] = function_ref @$S12def_noinline12testNoinline1xS2b_tF : $@convention(thin) (Bool) -> Bool
@@ -18,7 +23,3 @@ var raw = testNoinline(x: false)
1823
// SIL: apply [[FUNC2]]({{%.+}}, {{%.+}}) : $@convention(method) (Bool, @thin NoInlineInitStruct.Type) -> NoInlineInitStruct
1924

2025
var a = NoInlineInitStruct(x: false)
21-
22-
// SIL-LABEL: [serialized] [noinline] @$S12def_noinline12testNoinline1xS2b_tF : $@convention(thin) (Bool) -> Bool
23-
24-
// SIL-LABEL: sil public_external [serialized] [noinline] @$S12def_noinline18NoInlineInitStructV1xACSb_tcfC : $@convention(method) (Bool, @thin NoInlineInitStruct.Type) -> NoInlineInitStruct {

test/Serialization/transparent.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// RUN: %empty-directory(%t)
33
// RUN: %target-swift-frontend -emit-module -o %t %S/Inputs/def_transparent.swift
44
// RUN: llvm-bcanalyzer %t/def_transparent.swiftmodule | %FileCheck %s
5-
// RUN: %target-swift-frontend -module-name transparent -emit-sil -I %t %s | tee /tmp/xxx | %FileCheck %s -check-prefix=SIL
5+
// RUN: %target-swift-frontend -module-name transparent -emit-sil -I %t %s | %FileCheck %s -check-prefix=SIL
66

77
// CHECK-NOT: UnknownCode
88

@@ -40,7 +40,7 @@ func wrap_br() {
4040
test_br()
4141
}
4242

43-
// SIL-LABEL: sil public_external [serialized] @$S15def_transparent9do_switch1uyAA9MaybePairO_tF : $@convention(thin) (@guaranteed MaybePair) -> () {
43+
// SIL-LABEL: sil public_external [transparent] [serialized] @$S15def_transparent9do_switch1uyAA9MaybePairO_tF : $@convention(thin) (@guaranteed MaybePair) -> () {
4444
// SIL: bb0(%0 : $MaybePair):
4545
// SIL: retain_value %0 : $MaybePair
4646
// SIL: switch_enum %0 : $MaybePair, case #MaybePair.Neither!enumelt: bb[[CASE1:[0-9]+]], case #MaybePair.Left!enumelt.1: bb[[CASE2:[0-9]+]], case #MaybePair.Right!enumelt.1: bb[[CASE3:[0-9]+]], case #MaybePair.Both!enumelt.1: bb[[CASE4:[0-9]+]]

0 commit comments

Comments
 (0)