Skip to content

Commit 0ce7f29

Browse files
committed
[opt-remark] Add support for emitting opt-remark bitstream artifacts when building benchmarks with cmake.
I didn't do this for swiftpm as well since when I tried passing this via unsafeFlags to swiftpm, swiftpm just created the opt-remarks in my source directory instead of next to the .o in the build directory. A problem for another time.
1 parent 2ea7cd2 commit 0ce7f29

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-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()

0 commit comments

Comments
 (0)