File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -3272,6 +3272,8 @@ bool CompilerInvocation::parseArgs(
3272
3272
SILOpts.SkipFunctionBodies = FunctionBodySkipping::None;
3273
3273
SILOpts.CMOMode = CrossModuleOptimizationMode::Everything;
3274
3274
SILOpts.EmbeddedSwift = true ;
3275
+ // OSSA modules are required for deinit de-virtualization.
3276
+ SILOpts.EnableOSSAModules = true ;
3275
3277
} else {
3276
3278
if (SILOpts.NoAllocations ) {
3277
3279
Diags.diagnose (SourceLoc (), diag::no_allocations_without_embedded);
Original file line number Diff line number Diff line change
1
+ // RUN: %empty-directory(%t)
2
+ // RUN: %{python} %utils/split_file.py -o %t %s
3
+
4
+ // RUN: %target-swift-frontend -emit-module -o %t/MyModule.swiftmodule %t/MyModule.swift -enable-experimental-feature Embedded -Osize -wmo -parse-as-library
5
+ // RUN: %target-swift-frontend -emit-sil -I %t %t/Main.swift -enable-experimental-feature Embedded -parse-as-library | %FileCheck %s
6
+
7
+ // REQUIRES: swift_in_compiler
8
+ // REQUIRES: OS=macosx || OS=linux-gnu
9
+
10
+ // BEGIN MyModule.swift
11
+
12
+ public func createFoo( x: some FixedWidthInteger ) {
13
+ let _ = Foo < UInt > ( i: 0 )
14
+ }
15
+
16
+ public struct Foo < Element> : ~ Copyable {
17
+ public let i : Int
18
+
19
+ public init ( i: Int ) {
20
+ self . i = i
21
+ }
22
+
23
+ deinit { }
24
+ }
25
+
26
+ // BEGIN Main.swift
27
+
28
+ import MyModule
29
+
30
+ func test( ) {
31
+ createFoo ( x: 1 )
32
+ }
33
+
34
+ // CHECK-LABEL: sil @$s8MyModule9createFoo1xyx_ts17FixedWidthIntegerRzlFSi_Tg5 :
35
+ // CHECK-NOT: release
36
+ // CHECK: } // end sil function '$s8MyModule9createFoo1xyx_ts17FixedWidthIntegerRzlFSi_Tg5'
You can’t perform that action at this time.
0 commit comments