@@ -1027,11 +1027,6 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
10271027 "`-C save-temps` might not produce all requested temporary products \
10281028 when incremental compilation is enabled.") ] ,
10291029 "save all temporary output files during compilation" ) ,
1030- pgo_gen: Option <String > = ( None , parse_opt_string, [ TRACKED ] ,
1031- "Generate PGO profile data, to a given file, or to the default \
1032- location if it's empty.") ,
1033- pgo_use: String = ( String :: new( ) , parse_string, [ TRACKED ] ,
1034- "Use PGO profile data from the given profile file." ) ,
10351030 rpath: bool = ( false , parse_bool, [ UNTRACKED ] ,
10361031 "set rpath values in libs/exes" ) ,
10371032 overflow_checks: Option <bool > = ( None , parse_opt_bool, [ TRACKED ] ,
@@ -1254,6 +1249,11 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
12541249 "extra arguments to prepend to the linker invocation (space separated)" ) ,
12551250 profile: bool = ( false , parse_bool, [ TRACKED ] ,
12561251 "insert profiling code" ) ,
1252+ pgo_gen: Option <String > = ( None , parse_opt_string, [ TRACKED ] ,
1253+ "Generate PGO profile data, to a given file, or to the default \
1254+ location if it's empty.") ,
1255+ pgo_use: String = ( String :: new( ) , parse_string, [ TRACKED ] ,
1256+ "Use PGO profile data from the given profile file." ) ,
12571257 relro_level: Option <RelroLevel > = ( None , parse_relro_level, [ TRACKED ] ,
12581258 "choose which RELRO level to use" ) ,
12591259 nll: bool = ( false , parse_bool, [ UNTRACKED ] ,
@@ -1776,6 +1776,13 @@ pub fn build_session_options_and_crate_config(
17761776 ) ;
17771777 }
17781778
1779+ if debugging_opts. pgo_gen . is_some ( ) && !debugging_opts. pgo_use . is_empty ( ) {
1780+ early_error (
1781+ error_format,
1782+ "options `-Z pgo-gen` and `-Z pgo-use` are exclusive" ,
1783+ ) ;
1784+ }
1785+
17791786 let mut output_types = BTreeMap :: new ( ) ;
17801787 if !debugging_opts. parse_only {
17811788 for list in matches. opt_strs ( "emit" ) {
@@ -1806,13 +1813,6 @@ pub fn build_session_options_and_crate_config(
18061813 let mut codegen_units = cg. codegen_units ;
18071814 let mut disable_thinlto = false ;
18081815
1809- if cg. pgo_gen . is_some ( ) && !cg. pgo_use . is_empty ( ) {
1810- early_error (
1811- error_format,
1812- "options `-C pgo-gen` and `-C pgo-use` are exclussive" ,
1813- ) ;
1814- }
1815-
18161816 // Issue #30063: if user requests llvm-related output to one
18171817 // particular path, disable codegen-units.
18181818 let incompatible: Vec < _ > = output_types
@@ -2836,14 +2836,6 @@ mod tests {
28362836 opts. cg . lto = Lto :: Fat ;
28372837 assert ! ( reference. dep_tracking_hash( ) != opts. dep_tracking_hash( ) ) ;
28382838
2839- opts = reference. clone ( ) ;
2840- opts. cg . pgo_gen = Some ( String :: from ( "abc" ) ) ;
2841- assert_ne ! ( reference. dep_tracking_hash( ) , opts. dep_tracking_hash( ) ) ;
2842-
2843- opts = reference. clone ( ) ;
2844- opts. cg . pgo_use = String :: from ( "abc" ) ;
2845- assert_ne ! ( reference. dep_tracking_hash( ) , opts. dep_tracking_hash( ) ) ;
2846-
28472839 opts = reference. clone ( ) ;
28482840 opts. cg . target_cpu = Some ( String :: from ( "abc" ) ) ;
28492841 assert ! ( reference. dep_tracking_hash( ) != opts. dep_tracking_hash( ) ) ;
@@ -2904,6 +2896,14 @@ mod tests {
29042896 opts. debugging_opts . tls_model = Some ( String :: from ( "tls model" ) ) ;
29052897 assert ! ( reference. dep_tracking_hash( ) != opts. dep_tracking_hash( ) ) ;
29062898
2899+ opts = reference. clone ( ) ;
2900+ opts. debugging_opts . pgo_gen = Some ( String :: from ( "abc" ) ) ;
2901+ assert_ne ! ( reference. dep_tracking_hash( ) , opts. dep_tracking_hash( ) ) ;
2902+
2903+ opts = reference. clone ( ) ;
2904+ opts. debugging_opts . pgo_use = String :: from ( "abc" ) ;
2905+ assert_ne ! ( reference. dep_tracking_hash( ) , opts. dep_tracking_hash( ) ) ;
2906+
29072907 opts = reference. clone ( ) ;
29082908 opts. cg . metadata = vec ! [ String :: from( "A" ) , String :: from( "B" ) ] ;
29092909 assert ! ( reference. dep_tracking_hash( ) != opts. dep_tracking_hash( ) ) ;
0 commit comments