Skip to content

Commit 32b608a

Browse files
committed
Merge commit '6d35b4c9a04580366fd800692a5b5db79d766530' into sync_cg_clif-2024-09-22
1 parent 02b0f3b commit 32b608a

31 files changed

+487
-347
lines changed

.cirrus.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ task:
33
freebsd_instance:
44
image: freebsd-13-2-release-amd64
55
setup_rust_script:
6-
- pkg install -y git bash binutils
6+
- pkg install -y git-tiny binutils
77
- curl https://sh.rustup.rs -sSf --output rustup.sh
88
- sh rustup.sh --default-toolchain none -y --profile=minimal
99
target_cache:

.github/workflows/main.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,7 @@ jobs:
279279
runs-on: ubuntu-latest
280280
timeout-minutes: 10
281281
if: ${{ github.ref == 'refs/heads/master' }}
282-
# FIXME add the bench job back to the dependency list once rust-lang/rust#125493 gets merged
283-
needs: [rustfmt, test, dist]
282+
needs: [rustfmt, test, bench, dist]
284283

285284
permissions:
286285
contents: write # for creating the dev tag and release

Cargo.lock

Lines changed: 32 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ crate-type = ["dylib"]
88

99
[dependencies]
1010
# These have to be in sync with each other
11-
cranelift-codegen = { version = "0.110.1", default-features = false, features = ["std", "unwind", "all-arch"] }
12-
cranelift-frontend = { version = "0.110.1" }
13-
cranelift-module = { version = "0.110.1" }
14-
cranelift-native = { version = "0.110.1" }
15-
cranelift-jit = { version = "0.110.1", optional = true }
16-
cranelift-object = { version = "0.110.1" }
11+
cranelift-codegen = { version = "0.111.0", default-features = false, features = ["std", "unwind", "all-arch"] }
12+
cranelift-frontend = { version = "0.111.0" }
13+
cranelift-module = { version = "0.111.0" }
14+
cranelift-native = { version = "0.111.0" }
15+
cranelift-jit = { version = "0.111.0", optional = true }
16+
cranelift-object = { version = "0.111.0" }
1717
target-lexicon = "0.12.0"
18-
gimli = { version = "0.28", default-features = false, features = ["write"]}
18+
gimli = { version = "0.29", default-features = false, features = ["write"] }
1919
object = { version = "0.36", default-features = false, features = ["std", "read_core", "write", "archive", "coff", "elf", "macho", "pe"] }
2020

2121
indexmap = "2.0.0"

build_system/abi_cafe.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ static ABI_CAFE_REPO: GitRepo = GitRepo::github(
1414
static ABI_CAFE: CargoProject = CargoProject::new(&ABI_CAFE_REPO.source_dir(), "abi_cafe_target");
1515

1616
pub(crate) fn run(
17-
channel: &str,
1817
sysroot_kind: SysrootKind,
1918
dirs: &Dirs,
2019
cg_clif_dylib: &CodegenBackend,
@@ -28,7 +27,6 @@ pub(crate) fn run(
2827
eprintln!("Building sysroot for abi-cafe");
2928
build_sysroot::build_sysroot(
3029
dirs,
31-
channel,
3230
sysroot_kind,
3331
cg_clif_dylib,
3432
bootstrap_host_compiler,
@@ -38,12 +36,11 @@ pub(crate) fn run(
3836

3937
eprintln!("Running abi-cafe");
4038

41-
let pairs = ["rustc_calls_cgclif", "cgclif_calls_rustc", "cgclif_calls_cc", "cc_calls_cgclif"];
42-
let pairs =
39+
let pairs: &[_] =
4340
if cfg!(not(any(target_os = "macos", all(target_os = "windows", target_env = "msvc")))) {
44-
&pairs[..]
41+
&["rustc_calls_cgclif", "cgclif_calls_rustc", "cgclif_calls_cc", "cc_calls_cgclif"]
4542
} else {
46-
&pairs[..2]
43+
&["rustc_calls_cgclif", "cgclif_calls_rustc"]
4744
};
4845

4946
let mut cmd = ABI_CAFE.run(bootstrap_host_compiler, dirs);

build_system/bench.rs

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
use std::env;
22
use std::io::Write;
33
use std::path::Path;
4+
use std::process::Command;
45

56
use crate::path::{Dirs, RelPath};
67
use crate::prepare::GitRepo;
78
use crate::rustc_info::get_file_name;
8-
use crate::utils::{Compiler, hyperfine_command, spawn_and_wait};
9+
use crate::utils::{Compiler, spawn_and_wait};
910

1011
static SIMPLE_RAYTRACER_REPO: GitRepo = GitRepo::github(
1112
"ebobby",
@@ -128,3 +129,37 @@ fn benchmark_simple_raytracer(dirs: &Dirs, bootstrap_host_compiler: &Compiler) {
128129
gha_step_summary.write_all(b"\n").unwrap();
129130
}
130131
}
132+
133+
#[must_use]
134+
fn hyperfine_command(
135+
warmup: u64,
136+
runs: u64,
137+
prepare: Option<&str>,
138+
cmds: &[(&str, &str)],
139+
markdown_export: &Path,
140+
) -> Command {
141+
let mut bench = Command::new("hyperfine");
142+
143+
bench.arg("--export-markdown").arg(markdown_export);
144+
145+
if warmup != 0 {
146+
bench.arg("--warmup").arg(warmup.to_string());
147+
}
148+
149+
if runs != 0 {
150+
bench.arg("--runs").arg(runs.to_string());
151+
}
152+
153+
if let Some(prepare) = prepare {
154+
bench.arg("--prepare").arg(prepare);
155+
}
156+
157+
for &(name, cmd) in cmds {
158+
if name != "" {
159+
bench.arg("-n").arg(name);
160+
}
161+
bench.arg(cmd);
162+
}
163+
164+
bench
165+
}

build_system/build_backend.rs

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ use crate::rustc_info::get_file_name;
66
use crate::shared_utils::{rustflags_from_env, rustflags_to_cmd_env};
77
use crate::utils::{CargoProject, Compiler, LogGroup};
88

9-
pub(crate) static CG_CLIF: CargoProject = CargoProject::new(&RelPath::SOURCE, "cg_clif");
9+
static CG_CLIF: CargoProject = CargoProject::new(&RelPath::SOURCE, "cg_clif");
1010

1111
pub(crate) fn build_backend(
1212
dirs: &Dirs,
13-
channel: &str,
1413
bootstrap_host_compiler: &Compiler,
1514
use_unstable_features: bool,
1615
) -> PathBuf {
@@ -19,8 +18,8 @@ pub(crate) fn build_backend(
1918
let mut cmd = CG_CLIF.build(&bootstrap_host_compiler, dirs);
2019

2120
let mut rustflags = rustflags_from_env("RUSTFLAGS");
22-
2321
rustflags.push("-Zallow-features=rustc_private".to_owned());
22+
rustflags_to_cmd_env(&mut cmd, "RUSTFLAGS", &rustflags);
2423

2524
if env::var("CG_CLIF_EXPENSIVE_CHECKS").is_ok() {
2625
// Enabling debug assertions implicitly enables the clif ir verifier
@@ -32,22 +31,14 @@ pub(crate) fn build_backend(
3231
cmd.arg("--features").arg("unstable-features");
3332
}
3433

35-
match channel {
36-
"debug" => {}
37-
"release" => {
38-
cmd.arg("--release");
39-
}
40-
_ => unreachable!(),
41-
}
42-
43-
rustflags_to_cmd_env(&mut cmd, "RUSTFLAGS", &rustflags);
34+
cmd.arg("--release");
4435

4536
eprintln!("[BUILD] rustc_codegen_cranelift");
4637
crate::utils::spawn_and_wait(cmd);
4738

4839
CG_CLIF
4940
.target_dir(dirs)
5041
.join(&bootstrap_host_compiler.triple)
51-
.join(channel)
42+
.join("release")
5243
.join(get_file_name(&bootstrap_host_compiler.rustc, "rustc_codegen_cranelift", "dylib"))
5344
}

0 commit comments

Comments
 (0)