[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.
This commit is contained in:
Michael Gottesman
2020-07-17 23:58:06 -07:00
parent 2ea7cd2b87
commit 0ce7f29c72

View File

@@ -367,12 +367,17 @@ function (swift_benchmark_compile_archopts)
"-F" "${sdk}/../../../Developer/Library/Frameworks"
"-sdk" "${sdk}"
"-no-link-objc-runtime")
# If we are not compiling at -Onone and are performing WMO, always emit
# optimization-records.
if(NOT ${optflag} STREQUAL "Onone" AND "${bench_flags}" MATCHES "-whole-module.*")
list(APPEND common_options "-save-optimization-record=bitstream")
endif()
endif()
set(opt_view_main_dir)
if(SWIFT_BENCHMARK_GENERATE_OPT_VIEW AND LLVM_HAVE_OPT_VIEWER_MODULES)
if(NOT ${optflag} STREQUAL "Onone" AND "${bench_flags}" MATCHES "-whole-module.*")
list(APPEND common_options "-save-optimization-record")
set(opt_view_main_dir "${objdir}/opt-view")
endif()
endif()