Skip to content

Commit 54a6be9

Browse files
authored
benchmark: Add SWIFT_BENCHMARK_UNOPTIMIZED_DRIVER option (swiftlang#30794)
Add an option to allow compiling the benchmark test utilities and driver at -Onone. This is needed because lldb does not support stepping through optimized swift code.
1 parent afc963a commit 54a6be9

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

benchmark/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,9 @@ endif()
227227
set(SWIFT_BENCHMARK_EXTRA_FLAGS "" CACHE STRING
228228
"Extra options to pass to swiftc when building the benchmarks")
229229

230+
set(SWIFT_BENCHMARK_UNOPTIMIZED_DRIVER NO CACHE BOOL
231+
"Build the benchmark driver utilites without optimization (default: no)")
232+
230233
if (SWIFT_BENCHMARK_BUILT_STANDALONE)
231234
# This option's value must match the value of the same option used when
232235
# building the swift runtime.

benchmark/cmake/modules/AddSwiftBenchmarkSuite.cmake

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -379,10 +379,13 @@ function (swift_benchmark_compile_archopts)
379379

380380
set(common_swift4_options ${common_options} "-swift-version" "4")
381381

382-
# Always optimize the driver modules.
383-
# Note that we compile the driver for Osize also with -Osize
384-
# (and not with -O), because of <rdar://problem/19614516>.
385-
string(REPLACE "Onone" "O" driver_opt "${optflag}")
382+
# Always optimize the driver modules, unless we're building benchmarks for
383+
# debugger testing.
384+
if(NOT SWIFT_BENCHMARK_UNOPTIMIZED_DRIVER)
385+
# Note that we compile the driver for Osize also with -Osize
386+
# (and not with -O), because of <rdar://problem/19614516>.
387+
string(REPLACE "Onone" "O" driver_opt "${optflag}")
388+
endif()
386389

387390
set(common_options_driver
388391
"-c"

0 commit comments

Comments
 (0)