File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed
lib/SILOptimizer/UtilityPasses Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -405,6 +405,11 @@ class SerializeSILPass : public SILModuleTransform {
405
405
updateOpaqueArchetypes (F);
406
406
invalidateAnalysis (&F, SILAnalysis::InvalidationKind::Everything);
407
407
}
408
+
409
+ // After serialization we don't need to keep @alwaysEmitIntoClient
410
+ // functions alive, i.e. we don't need to treat them as public functions.
411
+ if (F.getLinkage () == SILLinkage::PublicNonABI && M.isWholeModule ())
412
+ F.setLinkage (SILLinkage::Shared);
408
413
}
409
414
410
415
for (auto &WT : M.getWitnessTables ()) {
Original file line number Diff line number Diff line change
1
+ // RUN: %empty-directory(%t)
2
+ // RUN: %target-swift-frontend -parse-as-library -emit-module -emit-module-path=%t/Module.swiftmodule -module-name=Module -DMODULE %s -O -emit-sil | %FileCheck %s
3
+
4
+ // Also link to make sure we don't eliminate any needed symbols.
5
+
6
+ // RUN: %target-swift-frontend -parse-as-library -emit-module -emit-module-path=%t/Module.swiftmodule -module-name=Module -DMODULE %s -O -c -o module.o
7
+ // RUN: %target-build-swift -DMAIN %s -I%t -O -o %t/a.out
8
+
9
+ #if MODULE
10
+
11
+ // Check if the optimizer eliminates testit() in Module.
12
+
13
+ // CHECK-NOT: {{sil .*testit.*}}
14
+
15
+ @_alwaysEmitIntoClient
16
+ @inline ( never)
17
+ public func testit( ) {
18
+ print ( " hello " )
19
+ }
20
+
21
+ #endif
22
+
23
+
24
+ #if MAIN
25
+
26
+ import Module
27
+
28
+ public func caller( ) {
29
+ testit ( )
30
+ }
31
+
32
+ #endif
33
+
You can’t perform that action at this time.
0 commit comments