@@ -10,8 +10,8 @@ use crate::exec::{Bootstrap, cmd};
1010use crate :: tests:: run_tests;
1111use crate :: timer:: Timer ;
1212use crate :: training:: {
13- gather_bolt_profiles, gather_llvm_profiles , gather_rustc_profiles , gather_rustdoc_profiles ,
14- llvm_benchmarks, rustc_benchmarks,
13+ gather_bolt_profiles, gather_clippy_profiles , gather_llvm_profiles , gather_rustc_profiles ,
14+ gather_rustdoc_profiles , llvm_benchmarks, rustc_benchmarks,
1515} ;
1616use crate :: utils:: artifact_size:: print_binary_sizes;
1717use crate :: utils:: io:: { copy_directory, reset_directory} ;
@@ -239,7 +239,7 @@ fn execute_pipeline(
239239 // Stage 1: Build PGO instrumented rustc
240240 // We use a normal build of LLVM, because gathering PGO profiles for LLVM and `rustc` at the
241241 // same time can cause issues, because the host and in-tree LLVM versions can diverge.
242- let ( rustc_pgo_profile, rustdoc_pgo_profile) =
242+ let ( rustc_pgo_profile, rustdoc_pgo_profile, clippy_pgo_profile ) =
243243 timer. section ( "Stage 1 (Rustc + rustdoc PGO)" , |stage| {
244244 let rustc_profile_dir_root = env. artifact_dir ( ) . join ( "rustc-pgo" ) ;
245245
@@ -250,8 +250,10 @@ fn execute_pipeline(
250250 let mut builder = Bootstrap :: build ( env)
251251 . with_rustdoc ( )
252252 . with_cargo ( )
253+ . with_clippy ( )
253254 . rustc_pgo_instrument ( & rustc_profile_dir_root)
254255 . cargo_pgo_instrument ( & rustc_profile_dir_root)
256+ . clippy_pgo_instrument ( & rustc_profile_dir_root)
255257 . rustdoc_pgo_instrument ( & rustc_profile_dir_root) ;
256258
257259 if env. supports_shared_llvm ( ) {
@@ -271,23 +273,28 @@ fn execute_pipeline(
271273 let rustdoc_profile = stage. section ( "Gather rustdoc profiles" , |_| {
272274 gather_rustdoc_profiles ( env, & rustc_profile_dir_root)
273275 } ) ?;
276+ let clippy_profile = stage. section ( "Gather clippy profiles" , |_| {
277+ gather_clippy_profiles ( env, & rustc_profile_dir_root)
278+ } ) ?;
274279 print_free_disk_space ( ) ?;
275280
276281 stage. section ( "Build PGO optimized rustc" , |section| {
277282 let mut cmd = Bootstrap :: build ( env)
278283 . with_rustdoc ( )
279284 . with_cargo ( )
285+ . with_clippy ( )
280286 . rustc_pgo_optimize ( & rustc_profile)
281287 . cargo_pgo_optimize ( & rustc_profile)
282- . rustdoc_pgo_optimize ( & rustdoc_profile) ;
288+ . rustdoc_pgo_optimize ( & rustdoc_profile)
289+ . clippy_pgo_optimize ( & clippy_profile) ;
283290 if env. use_bolt ( ) {
284291 cmd = cmd. with_rustc_bolt_ldflags ( ) ;
285292 }
286293
287294 cmd. run ( section)
288295 } ) ?;
289296
290- Ok ( ( rustc_profile, rustdoc_profile) )
297+ Ok ( ( rustc_profile, rustdoc_profile, clippy_profile ) )
291298 } ) ?;
292299
293300 // Stage 2: Gather LLVM PGO profiles
@@ -422,7 +429,8 @@ fn execute_pipeline(
422429 . llvm_pgo_optimize ( llvm_pgo_profile. as_ref ( ) )
423430 . rustc_pgo_optimize ( & rustc_pgo_profile)
424431 . cargo_pgo_optimize ( & rustc_pgo_profile)
425- . rustdoc_pgo_optimize ( & rustdoc_pgo_profile) ;
432+ . rustdoc_pgo_optimize ( & rustdoc_pgo_profile)
433+ . clippy_pgo_optimize ( & clippy_pgo_profile) ;
426434
427435 // if LLVM is not built we'll have PGO optimized rustc
428436 dist = if env. supports_shared_llvm ( ) || !env. build_llvm ( ) {
0 commit comments