-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LLVM does not support PGO on Windows with -Cpanic=unwind #61002
Comments
PGO does not yet work on |
I have working x86_64 windows-gnu (64 bit builds use SEH) build with PGO I'll open PR once #60981 is merged. FWIW simple hello world example works fine after going through PGO. |
@mati865 if you test, be sure to compile your LLVM with assertions: https://github.com/rust-lang/rust/pull/61005/files#diff-1c226b200b9385d77428f0b4418366e4R1277 Thanks for looking into it! |
I'll recompile it with assertions today later. Should the test case be using any specific code like |
The following test case runs into the problem with MSVC: See https://github.com/rust-lang/rust/blob/master/src/test/run-make-fulldeps/pgo-use/Makefile for how the file is compiled. |
…unwind, r=zackmdavis Emit error when trying to use PGO in conjunction with unwinding on Windows. This PR makes `rustc` emit an error when trying use PGO in conjunction with `-Cpanic=unwind` on Windows, isn't supported by LLVM yet. The error messages points to rust-lang#61002, which documents this known limitation.
It does not reproduce with gnu toolchain with Rust and LLVM assertions enabled, I'll try to remember about fixing #61005 along with gnu profiler. |
Cool! |
I just confirmed that (for me locally) PGO seems to work on Windows GNU. That is, I built |
…ackmdavis Emit error when trying to use PGO in conjunction with unwinding on Windows. This PR makes `rustc` emit an error when trying use PGO in conjunction with `-Cpanic=unwind` on Windows, isn't supported by LLVM yet. The error messages points to #61002, which documents this known limitation.
It looks like #61005 is a bit too aggressive with its error reporting. For example when invoking rustc, but not compiling in our Firefox build we can the following build error:
I'm not sure the best solution while mw is away; perhaps we should revert #61005 for now. |
Maybe we can just convert the error to a warning? |
Not the best long-term solution but seems ok |
Emit warning when trying to use PGO in conjunction with unwinding on … …Windows. This reduces the error introduced for rust-lang#61002 to just a warning.
Only error about MSVC + PGO + unwind if we're generating code In rust-lang#61853, we changed the error when using PGO & MSVC toolchain & panic=unwind into a warning. However, in the compiler team meeting on 2019-07-11, we found that not everybody was in favor of that change because of the possibility of broken binaries. This PR reverts that change so this is again an error. However, to work around an [issue the Firefox team is having](rust-lang#61002 (comment)), we will only emit the error if we're actually supposed to generate a binary. If the `rustc` is invoked with `--print` arguments (which means that no binary will actually be emitted), then we won't emit the error because there is not a possibility of the issue occurring. cc @EricRahm @nikomatsakis @pnkfelix @Centril
It looks like the upstream bug was marked fixed a year ago. What's the status of this issue in rustc? |
See https://bugzilla.mozilla.org/show_bug.cgi?id=1660551#c3 This appears related to rust-lang/rust#61002 though, I'm not sure what changed between versions of num-traits to make this an issue, pinning to the version we were already using seems to function as a workaround for now.
MSVC. The LLVM limitation that previously prevented this has been fixed in LLVM 9 which is older than the oldest LLVM version we currently support. See rust-lang#61002.
…=nagisa Allow combining -Cprofile-generate and -Cpanic=unwind when targeting MSVC. The LLVM limitation that previously prevented this has been fixed in LLVM 9 which is older than the oldest LLVM version we currently support. Fixes rust-lang#61002. r? `@nagisa` (or anyone else from `@rust-lang/wg-llvm)`
The bug it worked around (rust-lang/rust#61002) was fixed in rustc 1.55, and we currently require 1.66. Differential Revision: https://phabricator.services.mozilla.com/D181843
The bug it worked around (rust-lang/rust#61002) was fixed in rustc 1.55, and we currently require 1.66. Differential Revision: https://phabricator.services.mozilla.com/D181843
The bug it worked around (rust-lang/rust#61002) was fixed in rustc 1.55, and we currently require 1.66. Differential Revision: https://phabricator.services.mozilla.com/D181843 UltraBlame original commit: 70bf3adb2de59cdd39165ebe10cbd76dcc70c6da
The bug it worked around (rust-lang/rust#61002) was fixed in rustc 1.55, and we currently require 1.66. Differential Revision: https://phabricator.services.mozilla.com/D181843 UltraBlame original commit: 70bf3adb2de59cdd39165ebe10cbd76dcc70c6da
The bug it worked around (rust-lang/rust#61002) was fixed in rustc 1.55, and we currently require 1.66. Differential Revision: https://phabricator.services.mozilla.com/D181843 UltraBlame original commit: 70bf3adb2de59cdd39165ebe10cbd76dcc70c6da
LLVM's "IR-level" instrumentation, which is used by
rustc
to generate PGO instrumented binaries, does not yet work with exception handling on Windows MSVC. The problem has been reported to LLVM for C++ here: https://bugs.llvm.org/show_bug.cgi?id=41279This also affects Rust programs built with
-Cpanic=unwind
for Windows MSVC. As long as LLVM does not support exception handling there, it is a known limitation that PGO can only be used with-Cpanic=abort
on this platform.The text was updated successfully, but these errors were encountered: