diff options
| author | Emilio Cobos Álvarez <emilio@crisal.io> | 2018-02-19 01:46:39 +0100 |
|---|---|---|
| committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2018-03-25 03:30:04 +0200 |
| commit | 804f959507ec38f5b3e1f7593c8c3aef5a7a2c83 (patch) | |
| tree | 92e0dcbd48b24752b8b41bffa481b647ce6c8b6b | |
| parent | e8a1575cf6fe7105535db36e396a3a9a58765205 (diff) | |
session: Add two tracked, exclusive codegen options for PGO profile usage and generation.
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
| -rw-r--r-- | src/librustc/session/config.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index f41765b642d..e5d7a618b35 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -1027,6 +1027,11 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options, "`-C save-temps` might not produce all requested temporary products \ when incremental compilation is enabled.")], "save all temporary output files during compilation"), + pgo_gen: Option<String> = (None, parse_opt_string, [TRACKED], + "Generate PGO profile data, to a given file, or to the default \ + location if it's empty."), + pgo_use: String = (String::new(), parse_string, [TRACKED], + "Use PGO profile data from the given profile file."), rpath: bool = (false, parse_bool, [UNTRACKED], "set rpath values in libs/exes"), overflow_checks: Option<bool> = (None, parse_opt_bool, [TRACKED], @@ -1801,6 +1806,13 @@ pub fn build_session_options_and_crate_config( let mut codegen_units = cg.codegen_units; let mut disable_thinlto = false; + if cg.pgo_gen.is_some() && !cg.pgo_use.is_empty() { + early_error( + error_format, + "options `-C pgo-gen` and `-C pgo-use` are exclussive", + ); + } + // Issue #30063: if user requests llvm-related output to one // particular path, disable codegen-units. let incompatible: Vec<_> = output_types @@ -2825,6 +2837,14 @@ mod tests { assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash()); opts = reference.clone(); + opts.cg.pgo_gen = Some(String::from("abc")); + assert_ne!(reference.dep_tracking_hash(), opts.dep_tracking_hash()); + + opts = reference.clone(); + opts.cg.pgo_use = String::from("abc"); + assert_ne!(reference.dep_tracking_hash(), opts.dep_tracking_hash()); + + opts = reference.clone(); opts.cg.target_cpu = Some(String::from("abc")); assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash()); |
