@@ -1027,11 +1027,6 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
1027
1027
"`-C save-temps` might not produce all requested temporary products \
1028
1028
when incremental compilation is enabled.") ] ,
1029
1029
"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." ) ,
1035
1030
rpath: bool = ( false , parse_bool, [ UNTRACKED ] ,
1036
1031
"set rpath values in libs/exes" ) ,
1037
1032
overflow_checks: Option <bool > = ( None , parse_opt_bool, [ TRACKED ] ,
@@ -1254,6 +1249,11 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
1254
1249
"extra arguments to prepend to the linker invocation (space separated)" ) ,
1255
1250
profile: bool = ( false , parse_bool, [ TRACKED ] ,
1256
1251
"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." ) ,
1257
1257
relro_level: Option <RelroLevel > = ( None , parse_relro_level, [ TRACKED ] ,
1258
1258
"choose which RELRO level to use" ) ,
1259
1259
nll: bool = ( false , parse_bool, [ UNTRACKED ] ,
@@ -1776,6 +1776,13 @@ pub fn build_session_options_and_crate_config(
1776
1776
) ;
1777
1777
}
1778
1778
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
+
1779
1786
let mut output_types = BTreeMap :: new ( ) ;
1780
1787
if !debugging_opts. parse_only {
1781
1788
for list in matches. opt_strs ( "emit" ) {
@@ -1806,13 +1813,6 @@ pub fn build_session_options_and_crate_config(
1806
1813
let mut codegen_units = cg. codegen_units ;
1807
1814
let mut disable_thinlto = false ;
1808
1815
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
-
1816
1816
// Issue #30063: if user requests llvm-related output to one
1817
1817
// particular path, disable codegen-units.
1818
1818
let incompatible: Vec < _ > = output_types
@@ -2836,14 +2836,6 @@ mod tests {
2836
2836
opts. cg . lto = Lto :: Fat ;
2837
2837
assert ! ( reference. dep_tracking_hash( ) != opts. dep_tracking_hash( ) ) ;
2838
2838
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
-
2847
2839
opts = reference. clone ( ) ;
2848
2840
opts. cg . target_cpu = Some ( String :: from ( "abc" ) ) ;
2849
2841
assert ! ( reference. dep_tracking_hash( ) != opts. dep_tracking_hash( ) ) ;
@@ -2904,6 +2896,14 @@ mod tests {
2904
2896
opts. debugging_opts . tls_model = Some ( String :: from ( "tls model" ) ) ;
2905
2897
assert ! ( reference. dep_tracking_hash( ) != opts. dep_tracking_hash( ) ) ;
2906
2898
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
+
2907
2907
opts = reference. clone ( ) ;
2908
2908
opts. cg . metadata = vec ! [ String :: from( "A" ) , String :: from( "B" ) ] ;
2909
2909
assert ! ( reference. dep_tracking_hash( ) != opts. dep_tracking_hash( ) ) ;
0 commit comments