File tree Expand file tree Collapse file tree 7 files changed +55
-9
lines changed Expand file tree Collapse file tree 7 files changed +55
-9
lines changed Original file line number Diff line number Diff line change @@ -254,6 +254,11 @@ static void addMandatoryDiagnosticOptPipeline(SILPassPipelinePlan &P) {
254254 P.addMandatoryPerformanceOptimizations ();
255255 P.addOnoneSimplification ();
256256 P.addInitializeStaticGlobals ();
257+
258+ if (P.getOptions ().EmbeddedSwift ) {
259+ P.addDeadFunctionAndGlobalElimination ();
260+ }
261+
257262 P.addPerformanceDiagnostics ();
258263}
259264
Original file line number Diff line number Diff line change 1717
1818using namespace swift ;
1919
20+ static llvm::cl::opt<bool > LinkEmbeddedRuntime (" link-embedded-runtime" ,
21+ llvm::cl::init (true ));
22+
2023// ===----------------------------------------------------------------------===//
2124// Top Level Driver
2225// ===----------------------------------------------------------------------===//
@@ -39,7 +42,7 @@ class SILLinker : public SILModuleTransform {
3942
4043 // In embedded Swift, the stdlib contains all the runtime functions needed
4144 // (swift_retain, etc.). Link them in so they can be referenced in IRGen.
42- if (M.getOptions ().EmbeddedSwift ) {
45+ if (M.getOptions ().EmbeddedSwift && LinkEmbeddedRuntime ) {
4346 linkEmbeddedRuntimeFromStdlib ();
4447 }
4548 }
Original file line number Diff line number Diff line change @@ -77,8 +77,7 @@ add_swift_target_library(swiftDarwin ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES}
7777 INSTALL_IN_COMPONENT sdk-overlay
7878 MACCATALYST_BUILD_FLAVOR "zippered" )
7979
80- # TODO(mracek): Disable building Darwin module as embedded pending investigations into a build failure
81- if (FALSE )
80+ if (SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB)
8281 set (SWIFT_ENABLE_REFLECTION OFF )
8382
8483 add_custom_target (embedded-darwin ALL )
Original file line number Diff line number Diff line change 1111// REQUIRES: VENDOR=apple
1212// REQUIRES: OS=macosx
1313
14- // Temporarily disabled:
15- // REQUIRES: rdar119283700
16-
1714// BEGIN BridgingHeader.h
1815
1916#include < unistd. h>
Original file line number Diff line number Diff line change 99// REQUIRES: VENDOR=apple
1010// REQUIRES: OS=macosx
1111
12- // Temporarily disabled:
13- // REQUIRES: rdar119283700
14-
1512import Darwin
1613
1714@main
Original file line number Diff line number Diff line change 1+ // RUN: %target-swift-emit-ir %s -enable-experimental-feature Embedded -wmo
2+ // RUN: %target-swift-emit-ir -O %s -enable-experimental-feature Embedded -wmo
3+ // RUN: %target-swift-emit-ir -Osize %s -enable-experimental-feature Embedded -wmo
4+
5+ // REQUIRES: swift_in_compiler
6+
7+ @available ( SwiftStdlib 5 . 7 , * )
8+ extension Duration {
9+ @available ( SwiftStdlib 5 . 7 , * )
10+ public init ( ) {
11+ self = . seconds( 10 ) + . nanoseconds( 20 )
12+ }
13+ }
Original file line number Diff line number Diff line change 1+ // RUN: %target-swift-frontend -parse-stdlib -emit-ir %s -enable-experimental-feature Embedded -Xllvm -link-embedded-runtime=0
2+
3+ // REQUIRES: swift_in_compiler
4+ // REQUIRES: VENDOR=apple
5+ // REQUIRES: OS=macosx
6+
7+ public struct UInt23 {
8+ }
9+
10+ public protocol MyBinaryInteger {
11+ }
12+
13+ extension UInt23 : MyBinaryInteger {
14+ }
15+
16+ protocol MyProto {
17+ static var my_static_var : UInt23 { get }
18+ static func foo( )
19+ }
20+
21+ struct MyStruct : MyProto {
22+ static let my_static_var = UInt23 ( )
23+ }
24+
25+ extension MyProto {
26+ public static func foo( ) {
27+ bar ( Self . my_static_var)
28+ }
29+ }
30+
31+ public func bar< T: MyBinaryInteger > ( _ value: @autoclosure ( ) -> T ) {
32+ }
You can’t perform that action at this time.
0 commit comments