7 python2.7 ../x.py build --target=$PGO_HOST --host=$PGO_HOST \
8 --stage 2 library/std --rust-profile-generate=/tmp/rustc-pgo
10 ./build/$PGO_HOST/stage2/bin/rustc --edition=2018 \
11 --crate-type=lib ../library/core/src/lib.rs
13 # Download and build a single-file stress test benchmark on perf.rust-lang.org.
14 function pgo_perf_benchmark {
15 local PERF=e095f5021bf01cf3800f50b3a9f14a9683eb3e4e
16 local github_prefix=https://raw.githubusercontent.com/rust-lang/rustc-perf/$PERF
18 curl -o /tmp/$name.rs $github_prefix/collector/benchmarks/$name/src/lib.rs
19 ./build/$PGO_HOST/stage2/bin/rustc --edition=2018 --crate-type=lib /tmp/$name.rs
22 pgo_perf_benchmark externs
23 pgo_perf_benchmark ctfe-stress-4
25 cp -pri ../src/tools/cargo /tmp/cargo
27 # Build cargo (with some flags)
29 RUSTC=./build/$PGO_HOST/stage2/bin/rustc \
30 ./build/$PGO_HOST/stage0/bin/cargo $@ \
31 --manifest-path /tmp/cargo/Cargo.toml
34 # Build a couple different variants of Cargo
35 CARGO_INCREMENTAL=1 pgo_cargo check
36 echo 'pub fn barbarbar() {}' >> /tmp/cargo/src/cargo/lib.rs
37 CARGO_INCREMENTAL=1 pgo_cargo check
38 touch /tmp/cargo/src/cargo/lib.rs
39 CARGO_INCREMENTAL=1 pgo_cargo check
40 pgo_cargo build --release
42 # Merge the profile data we gathered
43 ./build/$PGO_HOST/llvm/bin/llvm-profdata \
44 merge -o /tmp/rustc-pgo.profdata /tmp/rustc-pgo
46 # This produces the actual final set of artifacts.
47 $@ --rust-profile-use=/tmp/rustc-pgo.profdata