Skip to content

Commit eeb7348

Browse files
PGO: Check that pgo-use file actually exists. LLVM seems to only emit an easy-to-overlook warning otherwise.
1 parent e943426 commit eeb7348

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/librustc/session/mod.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1272,6 +1272,15 @@ fn validate_commandline_args_with_session_available(sess: &Session) {
12721272
sess.err("Linker plugin based LTO is not supported together with \
12731273
`-C prefer-dynamic` when targeting MSVC");
12741274
}
1275+
1276+
// Make sure that any given profiling data actually exists so LLVM can't
1277+
// decide to silently skip PGO.
1278+
if let Some(ref path) = sess.opts.debugging_opts.pgo_use {
1279+
if !path.exists() {
1280+
sess.err(&format!("File `{}` passed to `-Zpgo-use` does not exist.",
1281+
path.display()));
1282+
}
1283+
}
12751284
}
12761285

12771286
/// Hash value constructed out of all the `-C metadata` arguments passed to the

0 commit comments

Comments
 (0)