File tree Expand file tree Collapse file tree 4 files changed +21
-2
lines changed Expand file tree Collapse file tree 4 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -1702,7 +1702,7 @@ bool IRGenModule::shouldPrespecializeGenericMetadata() {
1702
1702
(Triple.isOSDarwin () ||
1703
1703
(Triple.isOSLinux () && !(Triple.isARM () && Triple.isArch32Bit ())));
1704
1704
if (canPrespecializeTarget && isStandardLibrary ()) {
1705
- return true ;
1705
+ return IRGen. Opts . PrespecializeGenericMetadata ;
1706
1706
}
1707
1707
auto &context = getSwiftModule ()->getASTContext ();
1708
1708
auto deploymentAvailability =
Original file line number Diff line number Diff line change @@ -44,6 +44,14 @@ else()
44
44
set (SWIFT_BUILD_TEST_SUPPORT_MODULES_default FALSE )
45
45
endif ()
46
46
47
+ if ("${SWIFT_HOST_VARIANT_SDK} " MATCHES "(OSX|IOS*|TVOS*|WATCHOS*)" )
48
+ set (SWIFT_STDLIB_ENABLE_PRESPECIALIZATION_default TRUE )
49
+ elseif ("${SWIFT_HOST_VARIANT_SDK} " STREQUAL "LINUX" )
50
+ set (SWIFT_STDLIB_ENABLE_PRESPECIALIZATION_default TRUE )
51
+ else ()
52
+ set (SWIFT_STDLIB_ENABLE_PRESPECIALIZATION_default FALSE )
53
+ endif ()
54
+
47
55
#
48
56
# User-configurable options for the standard library.
49
57
#
@@ -82,6 +90,10 @@ option(SWIFT_BUILD_TEST_SUPPORT_MODULES
82
90
option (SWIFT_FREESTANDING_FLAVOR
83
91
"When building the FREESTANDING stdlib, which build style to use (options: apple, linux)" )
84
92
93
+ option (SWIFT_STDLIB_ENABLE_PRESPECIALIZATION
94
+ "Should stdlib be built with generic metadata prespecialization enabled. Defaults to On on Darwin and on "
95
+ "${SWIFT_STDLIB_ENABLE_PRESPECIALIZATION_default} " )
96
+
85
97
set (SWIFT_STDLIB_ENABLE_LTO OFF CACHE STRING "Build Swift stdlib with LTO. One
86
98
must specify the form of LTO by setting this to one of: 'full', 'thin'. This
87
99
option only affects the standard library and runtime, not tools." )
Original file line number Diff line number Diff line change @@ -1673,6 +1673,10 @@ function(add_swift_target_library name)
1673
1673
"-Xfrontend;-disable-implicit-distributed-module-import" )
1674
1674
endif ()
1675
1675
1676
+ if (SWIFTLIB_IS_STDLIB AND SWIFT_STDLIB_ENABLE_PRESPECIALIZATION )
1677
+ list (APPEND SWIFTLIB_SWIFT_COMPILE_FLAGS "-Xfrontend;-prespecialize-generic-metadata" )
1678
+ endif ()
1679
+
1676
1680
# If we are building this library for targets, loop through the various
1677
1681
# SDKs building the variants of this library.
1678
1682
list_intersect (
Original file line number Diff line number Diff line change @@ -2433,7 +2433,10 @@ swift-enable-compatibility-overrides=0
2433
2433
swift-runtime-macho-no-dyld =1
2434
2434
swift-stdlib-single-threaded-runtime =1
2435
2435
swift-stdlib-os-versioning =0
2436
- extra-cmake-options =-DSWIFT_ENABLE_DISPATCH:BOOL =FALSE -DSWIFT_IMPLICIT_CONCURRENCY_IMPORT:BOOL =FALSE
2436
+ extra-cmake-options =
2437
+ -DSWIFT_ENABLE_DISPATCH:BOOL =FALSE
2438
+ -DSWIFT_IMPLICIT_CONCURRENCY_IMPORT:BOOL =FALSE
2439
+ -DSWIFT_STDLIB_ENABLE_PRESPECIALIZATION:BOOL =FALSE
2437
2440
2438
2441
[preset: stdlib_S_standalone_minimal_macho_x86_64,build]
2439
2442
mixin-preset =
You can’t perform that action at this time.
0 commit comments