Skip to content

Commit d9492d7

Browse files
committed
auto merge of #8450 : alexcrichton/rust/nopt-changes, r=graydon
Since the new runtime landed, the *-nopt builders have increased cycle time by roughly an hour. I have a feeling that this is because the entire runtime is in rust and it's not being optimized at all. In that past with an optimized C++ runtime it looks like things ran faster. This adds the ability to disable optimizations in tests only, not for the entire compiler. This means that the entire compiler and associated libraries will be built with optimizations, but the tests themselves would be built and run without optimizations. This isn't quite as good of a guarantee as disabling optimizations everywhere, but hopefully it'll improve cycle time for the *-nopt builds to move the queue along faster.
2 parents 59da4e0 + 88b89f8 commit d9492d7

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

configure

+1
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ opt docs 1 "build documentation"
371371
opt optimize 1 "build optimized rust code"
372372
opt optimize-cxx 1 "build optimized C++ code"
373373
opt optimize-llvm 1 "build optimized LLVM"
374+
opt optimize-tests 1 "build tests with optimizations"
374375
opt llvm-assertions 1 "build LLVM with assertions"
375376
opt debug 0 "build with extra debug fun"
376377
opt ratchet-bench 0 "ratchet benchmarks"

mk/tests.mk

+9-1
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,15 @@ TEST_SREQ$(1)_T_$(2)_H_$(3) = \
552552

553553
# The tests select when to use debug configuration on their own;
554554
# remove directive, if present, from CFG_RUSTC_FLAGS (issue #7898).
555-
CTEST_RUSTC_FLAGS = $$(subst --cfg debug,,$$(CFG_RUSTC_FLAGS))
555+
CTEST_RUSTC_FLAGS := $$(subst --cfg debug,,$$(CFG_RUSTC_FLAGS))
556+
557+
# The tests can not be optimized while the rest of the compiler is optimized, so
558+
# filter out the optimization (if any) from rustc and then figure out if we need
559+
# to be optimized
560+
CTEST_RUSTC_FLAGS := $$(subst -O,,$$(CTEST_RUSTC_FLAGS))
561+
ifndef CFG_DISABLE_OPTIMIZE_TESTS
562+
CTEST_RUSTC_FLAGS += -O
563+
endif
556564

557565
CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
558566
--compile-lib-path $$(HLIB$(1)_H_$(3)) \

0 commit comments

Comments
 (0)