summary refs log tree commit diff
path: root/src/librustc_codegen_ssa/back
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-04-14 00:39:46 +0200
committerGitHub <noreply@github.com>2019-04-14 00:39:46 +0200
commit021a8eca475af9dc0b4adc234c2c581e8e1b2f92 (patch)
treef169fa16ad1a78ebe1699dd1a070daae21e5b00d /src/librustc_codegen_ssa/back
parent7ff376b3b27d2e5c5c01b336924bcc3e507e5c4d (diff)
parent7b1df42accbfdf54148072c7a3d1e80177c388b0 (diff)
downloadrust-021a8eca475af9dc0b4adc234c2c581e8e1b2f92.tar.gz
rust-021a8eca475af9dc0b4adc234c2c581e8e1b2f92.zip
Rollup merge of #59874 - michaelwoerister:pgo-updates-1, r=cramertj
Clean up handling of `-Z pgo-gen` commandline option.

This PR adapts the `-Z pgo-gen` flag to how Clang and GCC handle the corresponding `-fprofile-generate` flag. In particular, the flag now optionally takes a directory to place the profiling data in and allows to omit the argument (instead of having to pass an empty string).
Diffstat (limited to 'src/librustc_codegen_ssa/back')
-rw-r--r--src/librustc_codegen_ssa/back/symbol_export.rs2
-rw-r--r--src/librustc_codegen_ssa/back/write.rs7
2 files changed, 5 insertions, 4 deletions
diff --git a/src/librustc_codegen_ssa/back/symbol_export.rs b/src/librustc_codegen_ssa/back/symbol_export.rs
index 336f41b784a..a55f783df43 100644
--- a/src/librustc_codegen_ssa/back/symbol_export.rs
+++ b/src/librustc_codegen_ssa/back/symbol_export.rs
@@ -209,7 +209,7 @@ fn exported_symbols_provider_local<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
         }
     }
 
-    if tcx.sess.opts.debugging_opts.pgo_gen.is_some() {
+    if tcx.sess.opts.debugging_opts.pgo_gen.enabled() {
         // These are weak symbols that point to the profile version and the
         // profile name, which need to be treated as exported so LTO doesn't nix
         // them.
diff --git a/src/librustc_codegen_ssa/back/write.rs b/src/librustc_codegen_ssa/back/write.rs
index f5affad4cce..4b02425d40d 100644
--- a/src/librustc_codegen_ssa/back/write.rs
+++ b/src/librustc_codegen_ssa/back/write.rs
@@ -12,7 +12,8 @@ use rustc_incremental::{copy_cgu_workproducts_to_incr_comp_cache_dir,
 use rustc::dep_graph::{WorkProduct, WorkProductId, WorkProductFileKind};
 use rustc::dep_graph::cgu_reuse_tracker::CguReuseTracker;
 use rustc::middle::cstore::EncodedMetadata;
-use rustc::session::config::{self, OutputFilenames, OutputType, Passes, Sanitizer, Lto};
+use rustc::session::config::{self, OutputFilenames, OutputType, Passes, Lto,
+                             Sanitizer, PgoGenerate};
 use rustc::session::Session;
 use rustc::util::nodemap::FxHashMap;
 use rustc::hir::def_id::{CrateNum, LOCAL_CRATE};
@@ -55,7 +56,7 @@ pub struct ModuleConfig {
     /// Some(level) to optimize binary size, or None to not affect program size.
     pub opt_size: Option<config::OptLevel>,
 
-    pub pgo_gen: Option<String>,
+    pub pgo_gen: PgoGenerate,
     pub pgo_use: String,
 
     // Flags indicating which outputs to produce.
@@ -93,7 +94,7 @@ impl ModuleConfig {
             opt_level: None,
             opt_size: None,
 
-            pgo_gen: None,
+            pgo_gen: PgoGenerate::Disabled,
             pgo_use: String::new(),
 
             emit_no_opt_bc: false,