Skip to content

Commit a63d3f5

Browse files
committed
Bug 1697215 - Disable value profiling in Rust PGO until we move to to rust 1.52. r=firefox-build-system-reviewers,glandium
Credit goes to dmajor. Rust gets LLVM 12 - rust-lang/rust#81451. The PGO format changed between 11 and 12, and builds will have poor optimization if we mix versions in xLTO. The above PR has landed on Rust nightly 1.52. Until we move to 1.52 nightly we should have this landed. In the meantime, for unblocking try builds, we can disable value-PGO in Rust. Differential Revision: https://phabricator.services.mozilla.com/D113327
1 parent 56f1c9a commit a63d3f5

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

build/moz.configure/rust.configure

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ set_config(
120120
)
121121

122122

123+
set_config(
124+
"RUSTC_LLVM_VERSION",
125+
depends(rustc_info)(lambda info: str(info.llvm_version) if info else None),
126+
)
127+
128+
123129
@depends_if(cargo)
124130
@checking("cargo version", lambda info: info.version)
125131
@imports("re")

config/makefiles/rust.mk

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,11 @@ ifdef MOZ_PROFILE_GENERATE
239239
# because -C panic=unwind (the compiler default) is not compatible with -C profile-generate
240240
# (https://github.com/rust-lang/rust/issues/61002).
241241
rust_pgo_flags := -C panic=abort -C profile-generate=$(topobjdir)
242+
ifeq (1,$(words $(filter 5.% 6.% 7.% 8.% 9.% 10.% 11.%,$(CC_VERSION) $(RUSTC_LLVM_VERSION))))
243+
# Disable value profiling when:
244+
# (RUSTC_LLVM_VERSION < 12 and CC_VERSION >= 12) or (RUSTC_LLVM_VERSION >= 12 and CC_VERSION < 12)
245+
rust_pgo_flags += -C llvm-args=--disable-vp=true
246+
endif
242247
# The C compiler may be passed extra llvm flags for PGO that we also want to pass to rust as well.
243248
# In PROFILE_GEN_CFLAGS, they look like "-mllvm foo", and we want "-C llvm-args=foo", so first turn
244249
# "-mllvm foo" into "-mllvm:foo" so that it becomes a unique argument, that we can then filter for,

0 commit comments

Comments
 (0)