File tree Expand file tree Collapse file tree 7 files changed +62
-9
lines changed Expand file tree Collapse file tree 7 files changed +62
-9
lines changed Original file line number Diff line number Diff line change @@ -255,6 +255,17 @@ static void addMandatoryDiagnosticOptPipeline(SILPassPipelinePlan &P) {
255255 P.addOnoneSimplification ();
256256 P.addAllocVectorLowering ();
257257 P.addInitializeStaticGlobals ();
258+
259+ // MandatoryPerformanceOptimizations might create specializations that are not
260+ // used, and by being unused they are might have unspecialized applies.
261+ // Eliminate them via the DeadFunctionAndGlobalElimination in embedded Swift
262+ // to avoid getting metadata/existential use errors in them. We don't want to
263+ // run this pass in regular Swift: Even unused functions are expected to be
264+ // available in debug (-Onone) builds for debugging and development purposes.
265+ if (P.getOptions ().EmbeddedSwift ) {
266+ P.addDeadFunctionAndGlobalElimination ();
267+ }
268+
258269 P.addPerformanceDiagnostics ();
259270}
260271
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+ // REQUIRES: OS=macosx || OS=linux-gnu
7+
8+ @available ( SwiftStdlib 5 . 7 , * )
9+ extension Duration {
10+ @available ( SwiftStdlib 5 . 7 , * )
11+ public init ( ) {
12+ self = . seconds( 10 ) + . nanoseconds( 20 )
13+ }
14+ }
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