PGO: Check that pgo-use file actually exists. LLVM seems to only emit an easy-to-overlook warning otherwise.

This commit is contained in:
Michael Woerister 2019-05-22 13:00:09 +02:00
parent e943426045
commit eeb7348dc3

View file

@ -1272,6 +1272,15 @@ fn validate_commandline_args_with_session_available(sess: &Session) {
sess.err("Linker plugin based LTO is not supported together with \ sess.err("Linker plugin based LTO is not supported together with \
`-C prefer-dynamic` when targeting MSVC"); `-C prefer-dynamic` when targeting MSVC");
} }
// Make sure that any given profiling data actually exists so LLVM can't
// decide to silently skip PGO.
if let Some(ref path) = sess.opts.debugging_opts.pgo_use {
if !path.exists() {
sess.err(&format!("File `{}` passed to `-Zpgo-use` does not exist.",
path.display()));
}
}
} }
/// Hash value constructed out of all the `-C metadata` arguments passed to the /// Hash value constructed out of all the `-C metadata` arguments passed to the