Rollup merge of #60038 - michaelwoerister:pgo-updates-2, r=alexcrichton

Add codegen test for PGO instrumentation.

This PR adds a codegen test that makes sure that LLVM actually generates instrumentation code when we enable PGO instrumentation in `rustc`.

The second commit updates a test case to the new commandline option syntax introduced in #59874. Without the fix the test still works, but it confusingly creates a directory called `test.profraw`, which usually is the name of the _file_ where profiling data is collected.
This commit is contained in:
Mazdak Farrokhzad 2019-04-25 03:05:22 +02:00 committed by GitHub
commit bb892be98e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 71 additions and 43 deletions

View file

@ -88,6 +88,9 @@ impl EarlyProps {
}
}
let rustc_has_profiler_support = env::var_os("RUSTC_PROFILER_SUPPORT").is_some();
let rustc_has_sanitizer_support = env::var_os("RUSTC_SANITIZER_SUPPORT").is_some();
iter_header(testfile, None, &mut |ln| {
// we should check if any only-<platform> exists and if it exists
// and does not matches the current platform, skip the test
@ -116,6 +119,16 @@ impl EarlyProps {
config.parse_needs_matching_clang(ln) {
props.ignore = Ignore::Ignore;
}
if !rustc_has_profiler_support &&
config.parse_needs_profiler_support(ln) {
props.ignore = Ignore::Ignore;
}
if !rustc_has_sanitizer_support &&
config.parse_needs_sanitizer_support(ln) {
props.ignore = Ignore::Ignore;
}
}
if (config.mode == common::DebugInfoGdb || config.mode == common::DebugInfoBoth) &&
@ -748,6 +761,14 @@ impl Config {
self.parse_name_directive(line, "needs-matching-clang")
}
fn parse_needs_profiler_support(&self, line: &str) -> bool {
self.parse_name_directive(line, "needs-profiler-support")
}
fn parse_needs_sanitizer_support(&self, line: &str) -> bool {
self.parse_name_directive(line, "needs-sanitizer-support")
}
/// Parses a name-value directive which contains config-specific information, e.g., `ignore-x86`
/// or `normalize-stderr-32bit`.
fn parse_cfg_name_directive(&self, line: &str, prefix: &str) -> ParsedNameDirective {