33set -euxo pipefail
44
55# Compile several crates to gather execution PGO profiles.
6- # Arg0 => builds (Debug, Opt)
7- # Arg1 => runs (Full, IncrFull, All)
6+ # Arg0 => profiles (Debug, Opt)
7+ # Arg1 => scenarios (Full, IncrFull, All)
88# Arg2 => crates (syn, cargo, ...)
99gather_profiles () {
1010 cd /checkout/obj
@@ -27,10 +27,10 @@ gather_profiles () {
2727 profile_local \
2828 eprintln \
2929 /checkout/obj/build/$PGO_HOST /stage2/bin/rustc \
30- Test \
31- --builds $1 \
30+ --id Test \
31+ --profiles $1 \
3232 --cargo /checkout/obj/build/$PGO_HOST /stage0/bin/cargo \
33- --runs $2 \
33+ --scenarios $2 \
3434 --include $3
3535
3636 cd /checkout/obj
@@ -64,7 +64,10 @@ RUSTC=/checkout/obj/build/$PGO_HOST/stage0/bin/rustc \
6464RUSTC_BOOTSTRAP=1 \
6565/checkout/obj/build/$PGO_HOST /stage0/bin/cargo build -p collector
6666
67- gather_profiles " Debug,Opt" " Full" " syn,cargo,serde,ripgrep,regex,clap-rs,hyper-2"
67+ # Here we're profiling LLVM, so we only care about `Debug` and `Opt`, because we want to stress
68+ # codegen. We also profile some of the most prolific crates.
69+ gather_profiles " Debug,Opt" " Full" \
70+ " syn-1.0.89,cargo-0.60.0,serde-1.0.136,ripgrep-13.0.0,regex-1.5.5,clap-3.1.6,hyper-0.14.18"
6871
6972# Merge the profile data we gathered for LLVM
7073# Note that this uses the profdata from the clang we used to build LLVM,
@@ -83,8 +86,10 @@ python3 ../x.py build --target=$PGO_HOST --host=$PGO_HOST \
8386 --stage 2 library/std \
8487 --rust-profile-generate=/tmp/rustc-pgo
8588
89+ # Here we're profiling the `rustc` frontend, so we also include `Check`.
90+ # The benchmark set includes various stress tests that put the frontend under pressure.
8691gather_profiles " Check,Debug,Opt" " All" \
87- " externs,ctfe-stress-4,inflate, cargo,token-stream-stress,match-stress-enum "
92+ " externs,ctfe-stress-4,cargo-0.60.0 ,token-stream-stress,match-stress,tuple-stress "
8893
8994# Merge the profile data we gathered
9095./build/$PGO_HOST /llvm/bin/llvm-profdata \
0 commit comments