Skip to content

Commit

Permalink
Bug 1697215 - Disable value profiling in Rust PGO until we move to to…
Browse files Browse the repository at this point in the history
… 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
  • Loading branch information
abpostelnicu committed Apr 28, 2021
1 parent 56f1c9a commit a63d3f5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions build/moz.configure/rust.configure
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ set_config(
)


set_config(
"RUSTC_LLVM_VERSION",
depends(rustc_info)(lambda info: str(info.llvm_version) if info else None),
)


@depends_if(cargo)
@checking("cargo version", lambda info: info.version)
@imports("re")
Expand Down
5 changes: 5 additions & 0 deletions config/makefiles/rust.mk
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,11 @@ ifdef MOZ_PROFILE_GENERATE
# because -C panic=unwind (the compiler default) is not compatible with -C profile-generate
# (https://github.com/rust-lang/rust/issues/61002).
rust_pgo_flags := -C panic=abort -C profile-generate=$(topobjdir)
ifeq (1,$(words $(filter 5.% 6.% 7.% 8.% 9.% 10.% 11.%,$(CC_VERSION) $(RUSTC_LLVM_VERSION))))
# Disable value profiling when:
# (RUSTC_LLVM_VERSION < 12 and CC_VERSION >= 12) or (RUSTC_LLVM_VERSION >= 12 and CC_VERSION < 12)
rust_pgo_flags += -C llvm-args=--disable-vp=true
endif
# The C compiler may be passed extra llvm flags for PGO that we also want to pass to rust as well.
# In PROFILE_GEN_CFLAGS, they look like "-mllvm foo", and we want "-C llvm-args=foo", so first turn
# "-mllvm foo" into "-mllvm:foo" so that it becomes a unique argument, that we can then filter for,
Expand Down

0 comments on commit a63d3f5

Please sign in to comment.