Skip to content

Commit f6edc3d

Browse files
committed
CMake: Allow setting optimization remark type
Optimization remarks were always emitted on Darwin but not on the other platforms and were forced to use the bitstream format. Adding a flag to enable or disable them as desired and specify the desired output format. Fixes: #79279
1 parent 25186b2 commit f6edc3d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Runtimes/Core/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ defaulted_option(SwiftCore_ENABLE_PRESPECIALIZATION "Enable generic metadata pre
127127
option(SwiftCore_ENABLE_CLOBBER_FREED_OBJECTS "" OFF)
128128
option(SwiftCore_ENABLE_RUNTIME_LEAK_CHECKER "" OFF)
129129
option(SwiftCore_ENABLE_INTERNAL_CHECKS "" OFF)
130+
set(SwiftCore_OPTIMIZATION_REMARKS OFF CACHE STRING "Set opt-remark format")
130131

131132
defaulted_set(SwiftCore_OBJECT_FORMAT STRING "Object format: ELF COFF")
132133
defaulted_set(SwiftCore_THREADING_PACKAGE STRING "Threading Package: C11 Linux PThreads Win32")
@@ -179,9 +180,7 @@ add_compile_options(
179180
"$<$<COMPILE_LANGUAGE:Swift>:-disable-autolinking-runtime-compatibility-dynamic-replacements>"
180181
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -disable-autolinking-runtime-compatibility-concurrency>"
181182
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-strict-memory-safety>"
182-
# TODO: we should reevaluate if it still makes sense to restrict this
183-
# to Darwin, https://github.com/swiftlang/swift/issues/79279
184-
"$<$<AND:$<PLATFORM_ID:Darwin>,$<COMPILE_LANGUAGE:Swift>>:-save-optimization-record=bitstream>"
183+
"$<$<AND:$<BOOL:${SwiftCore_OPTIMIZATION_REMARKS}>,$<COMPILE_LANGUAGE:Swift>>:-save-optimization-record=${SwiftCore_OPTIMIZATION_REMARKS}>"
185184
"$<$<COMPILE_LANGUAGE:Swift>:-warn-implicit-overrides>"
186185
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -enable-lexical-lifetimes=false>"
187186
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -disable-implicit-concurrency-module-import>"

Runtimes/Core/cmake/caches/Vendors/Apple/apple-common.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ set(SwiftCore_ENABLE_VECTOR_TYPES ON CACHE BOOL "")
1212
set(SwiftCore_ENABLE_RUNTIME_FUNCTION_COUNTERS ON CACHE BOOL "")
1313
set(SwiftCore_ENABLE_BACKDEPLOYMENT_SUPPORT ON CACHE BOOL "")
1414
set(SwiftCore_ENABLE_FILESYSTEM_SUPPORT ON CACHE BOOL "")
15+
set(SwiftCore_OPTIMIZATION_REMARKS "bitstream" CACHE STRING "")
1516

1617
set(SwiftCore_INSTALL_NESTED_SUBDIR OFF CACHE BOOL "")
1718

0 commit comments

Comments
 (0)