Use a PathBuf instead of String for representing the pgo-use path internally.
This commit is contained in:
parent
ab7cf71d4c
commit
e943426045
@ -1381,7 +1381,7 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
|
||||
"insert profiling code"),
|
||||
pgo_gen: PgoGenerate = (PgoGenerate::Disabled, parse_pgo_generate, [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],
|
||||
pgo_use: Option<PathBuf> = (None, parse_opt_pathbuf, [TRACKED],
|
||||
"Use PGO profile data from the given profile file."),
|
||||
disable_instrumentation_preinliner: bool = (false, parse_bool, [TRACKED],
|
||||
"Disable the instrumentation pre-inliner, useful for profiling / PGO."),
|
||||
@ -2021,7 +2021,7 @@ pub fn build_session_options_and_crate_config(
|
||||
}
|
||||
}
|
||||
|
||||
if debugging_opts.pgo_gen.enabled() && !debugging_opts.pgo_use.is_empty() {
|
||||
if debugging_opts.pgo_gen.enabled() && debugging_opts.pgo_use.is_some() {
|
||||
early_error(
|
||||
error_format,
|
||||
"options `-Z pgo-gen` and `-Z pgo-use` are exclusive",
|
||||
|
@ -721,11 +721,9 @@ pub unsafe fn with_llvm_pmb(llmod: &llvm::Module,
|
||||
}
|
||||
};
|
||||
|
||||
let pgo_use_path = if config.pgo_use.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(CString::new(config.pgo_use.as_bytes()).unwrap())
|
||||
};
|
||||
let pgo_use_path = config.pgo_use.as_ref().map(|path_buf| {
|
||||
CString::new(path_buf.to_string_lossy().as_bytes()).unwrap()
|
||||
});
|
||||
|
||||
llvm::LLVMRustConfigurePassManagerBuilder(
|
||||
builder,
|
||||
|
@ -57,7 +57,7 @@ pub struct ModuleConfig {
|
||||
pub opt_size: Option<config::OptLevel>,
|
||||
|
||||
pub pgo_gen: PgoGenerate,
|
||||
pub pgo_use: String,
|
||||
pub pgo_use: Option<PathBuf>,
|
||||
|
||||
// Flags indicating which outputs to produce.
|
||||
pub emit_pre_lto_bc: bool,
|
||||
@ -95,7 +95,7 @@ impl ModuleConfig {
|
||||
opt_size: None,
|
||||
|
||||
pgo_gen: PgoGenerate::Disabled,
|
||||
pgo_use: String::new(),
|
||||
pgo_use: None,
|
||||
|
||||
emit_no_opt_bc: false,
|
||||
emit_pre_lto_bc: false,
|
||||
|
Loading…
Reference in New Issue
Block a user