Skip to content

Commit d7bd5ae

Browse files
authored
Merge pull request #32976 from gottesmm/pr-5545885200c7c4f352e37991d9a5a10065d828da
[opt-remark] Always emit opt-remarks for the stdlib and benchmarks
2 parents 0c1f9c4 + 0ce7f29 commit d7bd5ae

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

benchmark/cmake/modules/AddSwiftBenchmarkSuite.cmake

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,12 +367,17 @@ function (swift_benchmark_compile_archopts)
367367
"-F" "${sdk}/../../../Developer/Library/Frameworks"
368368
"-sdk" "${sdk}"
369369
"-no-link-objc-runtime")
370+
371+
# If we are not compiling at -Onone and are performing WMO, always emit
372+
# optimization-records.
373+
if(NOT ${optflag} STREQUAL "Onone" AND "${bench_flags}" MATCHES "-whole-module.*")
374+
list(APPEND common_options "-save-optimization-record=bitstream")
375+
endif()
370376
endif()
371377

372378
set(opt_view_main_dir)
373379
if(SWIFT_BENCHMARK_GENERATE_OPT_VIEW AND LLVM_HAVE_OPT_VIEWER_MODULES)
374380
if(NOT ${optflag} STREQUAL "Onone" AND "${bench_flags}" MATCHES "-whole-module.*")
375-
list(APPEND common_options "-save-optimization-record")
376381
set(opt_view_main_dir "${objdir}/opt-view")
377382
endif()
378383
endif()

stdlib/cmake/modules/SwiftSource.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ function(handle_swift_sources
9191
# FIXME: We shouldn't /have/ to build things in a single process.
9292
# <rdar://problem/15972329>
9393
list(APPEND swift_compile_flags "-whole-module-optimization")
94+
if(sdk IN_LIST SWIFT_APPLE_PLATFORMS OR sdk STREQUAL "MACCATALYST")
95+
list(APPEND swift_compile_flags "-save-optimization-record=bitstream")
96+
endif()
9497

9598
_compile_swift_files(
9699
dependency_target

0 commit comments

Comments
 (0)