Skip to content

Commit ab65486

Browse files
committed
Auto merge of #109169 - bjorn3:sync_cg_clif-2023-03-15, r=bjorn3
Sync rustc_codegen_cranelift Bunch of bug fixes this time. Also an update to Cranelift 0.93 which adds a brand new optimization pass which cg_clif exposes when using `--release`. And various improvements to cg_clif's test suite, making it faster to run. And finally two small perf improvements. r? `@ghost` `@rustbot` label +A-codegen +A-cranelift +T-compiler
2 parents a167cbd + fce629d commit ab65486

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+873
-792
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Abi-cafe
2+
3+
on:
4+
- push
5+
6+
jobs:
7+
abi_cafe:
8+
runs-on: ${{ matrix.os }}
9+
timeout-minutes: 60
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}-${{ matrix.env.TARGET_TRIPLE }}
12+
cancel-in-progress: true
13+
14+
defaults:
15+
run:
16+
shell: bash
17+
18+
strategy:
19+
fail-fast: true
20+
matrix:
21+
include:
22+
- os: ubuntu-latest
23+
env:
24+
TARGET_TRIPLE: x86_64-unknown-linux-gnu
25+
- os: macos-latest
26+
env:
27+
TARGET_TRIPLE: x86_64-apple-darwin
28+
- os: windows-latest
29+
env:
30+
TARGET_TRIPLE: x86_64-pc-windows-msvc
31+
- os: windows-latest
32+
env:
33+
TARGET_TRIPLE: x86_64-pc-windows-gnu
34+
35+
steps:
36+
- uses: actions/checkout@v3
37+
38+
- name: Cache cargo target dir
39+
uses: actions/cache@v3
40+
with:
41+
path: build/cg_clif
42+
key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}
43+
44+
- name: Set MinGW as the default toolchain
45+
if: matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
46+
run: rustup set default-host x86_64-pc-windows-gnu
47+
48+
- name: Use sparse cargo registry
49+
run: |
50+
cat >> ~/.cargo/config.toml <<EOF
51+
[unstable]
52+
sparse-registry = true
53+
EOF
54+
55+
- name: Prepare dependencies
56+
run: ./y.rs prepare
57+
58+
- name: Build
59+
run: ./y.rs build --sysroot none
60+
61+
- name: Test abi-cafe
62+
env:
63+
TARGET_TRIPLE: ${{ matrix.env.TARGET_TRIPLE }}
64+
run: ./y.rs abi-cafe

compiler/rustc_codegen_cranelift/.github/workflows/main.yml

+1-58
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
rustfmt --check build_system/mod.rs
2323
2424
25-
build:
25+
test:
2626
runs-on: ${{ matrix.os }}
2727
timeout-minutes: 60
2828

@@ -114,63 +114,6 @@ jobs:
114114
run: ./y.rs test
115115

116116

117-
abi_cafe:
118-
runs-on: ${{ matrix.os }}
119-
timeout-minutes: 60
120-
121-
defaults:
122-
run:
123-
shell: bash
124-
125-
strategy:
126-
fail-fast: true
127-
matrix:
128-
include:
129-
- os: ubuntu-latest
130-
env:
131-
TARGET_TRIPLE: x86_64-unknown-linux-gnu
132-
- os: macos-latest
133-
env:
134-
TARGET_TRIPLE: x86_64-apple-darwin
135-
- os: windows-latest
136-
env:
137-
TARGET_TRIPLE: x86_64-pc-windows-msvc
138-
- os: windows-latest
139-
env:
140-
TARGET_TRIPLE: x86_64-pc-windows-gnu
141-
142-
steps:
143-
- uses: actions/checkout@v3
144-
145-
- name: Cache cargo target dir
146-
uses: actions/cache@v3
147-
with:
148-
path: build/cg_clif
149-
key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}
150-
151-
- name: Set MinGW as the default toolchain
152-
if: matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
153-
run: rustup set default-host x86_64-pc-windows-gnu
154-
155-
- name: Use sparse cargo registry
156-
run: |
157-
cat >> ~/.cargo/config.toml <<EOF
158-
[unstable]
159-
sparse-registry = true
160-
EOF
161-
162-
- name: Prepare dependencies
163-
run: ./y.rs prepare
164-
165-
- name: Build
166-
run: ./y.rs build --sysroot none
167-
168-
- name: Test abi-cafe
169-
env:
170-
TARGET_TRIPLE: ${{ matrix.env.TARGET_TRIPLE }}
171-
run: ./y.rs abi-cafe
172-
173-
174117
bench:
175118
runs-on: ubuntu-latest
176119
timeout-minutes: 60

compiler/rustc_codegen_cranelift/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ perf.data.old
1414
/dist
1515
/rust
1616
/download
17+
/git-fixed-subtree.sh

compiler/rustc_codegen_cranelift/Cargo.lock

+25-24
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,18 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
5757

5858
[[package]]
5959
name = "cranelift-bforest"
60-
version = "0.92.0"
60+
version = "0.93.1"
6161
source = "registry+https://github.com/rust-lang/crates.io-index"
62-
checksum = "2f3d54eab028f5805ae3b26fd60eca3f3a9cfb76b989d9bab173be3f61356cc3"
62+
checksum = "a7379abaacee0f14abf3204a7606118f0465785252169d186337bcb75030815a"
6363
dependencies = [
6464
"cranelift-entity",
6565
]
6666

6767
[[package]]
6868
name = "cranelift-codegen"
69-
version = "0.92.0"
69+
version = "0.93.1"
7070
source = "registry+https://github.com/rust-lang/crates.io-index"
71-
checksum = "2be1d5f2c3cca1efb691844bc1988b89c77291f13f778499a3f3c0cf49c0ed61"
71+
checksum = "9489fa336927df749631f1008007ced2871068544f40a202ce6d93fbf2366a7b"
7272
dependencies = [
7373
"arrayvec",
7474
"bumpalo",
@@ -87,30 +87,30 @@ dependencies = [
8787

8888
[[package]]
8989
name = "cranelift-codegen-meta"
90-
version = "0.92.0"
90+
version = "0.93.1"
9191
source = "registry+https://github.com/rust-lang/crates.io-index"
92-
checksum = "3f9b1b1089750ce4005893af7ee00bb08a2cf1c9779999c0f7164cbc8ad2e0d2"
92+
checksum = "05bbb67da91ec721ed57cef2f7c5ef7728e1cd9bde9ffd3ef8601022e73e3239"
9393
dependencies = [
9494
"cranelift-codegen-shared",
9595
]
9696

9797
[[package]]
9898
name = "cranelift-codegen-shared"
99-
version = "0.92.0"
99+
version = "0.93.1"
100100
source = "registry+https://github.com/rust-lang/crates.io-index"
101-
checksum = "cc5fbaec51de47297fd7304986fd53c8c0030abbe69728a60d72e1c63559318d"
101+
checksum = "418ecb2f36032f6665dc1a5e2060a143dbab41d83b784882e97710e890a7a16d"
102102

103103
[[package]]
104104
name = "cranelift-entity"
105-
version = "0.92.0"
105+
version = "0.93.1"
106106
source = "registry+https://github.com/rust-lang/crates.io-index"
107-
checksum = "dab984c94593f876090fae92e984bdcc74d9b1acf740ab5f79036001c65cba13"
107+
checksum = "7cf583f7b093f291005f9fb1323e2c37f6ee4c7909e39ce016b2e8360d461705"
108108

109109
[[package]]
110110
name = "cranelift-frontend"
111-
version = "0.92.0"
111+
version = "0.93.0"
112112
source = "registry+https://github.com/rust-lang/crates.io-index"
113-
checksum = "6e0cb3102d21a2fe5f3210af608748ddd0cd09825ac12d42dc56ed5ed8725fe0"
113+
checksum = "7d361ed0373cf5f086b49c499aa72227b646a64f899f32e34312f97c0fadff75"
114114
dependencies = [
115115
"cranelift-codegen",
116116
"log",
@@ -120,15 +120,15 @@ dependencies = [
120120

121121
[[package]]
122122
name = "cranelift-isle"
123-
version = "0.92.0"
123+
version = "0.93.1"
124124
source = "registry+https://github.com/rust-lang/crates.io-index"
125-
checksum = "72101dd1f441d629735143c41e00b3428f9267738176983ef588ff43382af0a0"
125+
checksum = "649782a39ce99798dd6b4029e2bb318a2fbeaade1b4fa25330763c10c65bc358"
126126

127127
[[package]]
128128
name = "cranelift-jit"
129-
version = "0.92.0"
129+
version = "0.93.0"
130130
source = "registry+https://github.com/rust-lang/crates.io-index"
131-
checksum = "6557f8ce44d498777f2495aa58d9692a4a37d6f84aa445750d666cef770b6a5c"
131+
checksum = "9c9909222db472fcc98d9e4e7192fa9d064dac63a3fa657df8c6daae86fb2604"
132132
dependencies = [
133133
"anyhow",
134134
"cranelift-codegen",
@@ -145,19 +145,19 @@ dependencies = [
145145

146146
[[package]]
147147
name = "cranelift-module"
148-
version = "0.92.0"
148+
version = "0.93.0"
149149
source = "registry+https://github.com/rust-lang/crates.io-index"
150-
checksum = "88807e1c0c47ec02fe433333ccbe56b480425418b1470e333205e11650697d72"
150+
checksum = "68689b83e52e605ba48652882d3fccc2e2e136abf139eb64ae667888ba0d52f8"
151151
dependencies = [
152152
"anyhow",
153153
"cranelift-codegen",
154154
]
155155

156156
[[package]]
157157
name = "cranelift-native"
158-
version = "0.92.0"
158+
version = "0.93.0"
159159
source = "registry+https://github.com/rust-lang/crates.io-index"
160-
checksum = "c22b0d9fcbe3fc5a1af9e7021b44ce42b930bcefac446ce22e02e8f9a0d67120"
160+
checksum = "f98e4e99a353703475d5acb402b9c13482d41d8a4008b352559bd560afb90363"
161161
dependencies = [
162162
"cranelift-codegen",
163163
"libc",
@@ -166,9 +166,9 @@ dependencies = [
166166

167167
[[package]]
168168
name = "cranelift-object"
169-
version = "0.92.0"
169+
version = "0.93.0"
170170
source = "registry+https://github.com/rust-lang/crates.io-index"
171-
checksum = "341375758d7c3fedc0b5315f552e6f0feac46baf87c450a15e9455ef47c2b261"
171+
checksum = "b7a006ce1d8dd11df67567d8673e5920f3a56441812aed52a007ffce8f1b20e9"
172172
dependencies = [
173173
"anyhow",
174174
"cranelift-codegen",
@@ -333,6 +333,7 @@ dependencies = [
333333
"cranelift-frontend",
334334
"cranelift-jit",
335335
"cranelift-module",
336+
"cranelift-native",
336337
"cranelift-object",
337338
"gimli",
338339
"indexmap",
@@ -381,9 +382,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
381382

382383
[[package]]
383384
name = "wasmtime-jit-icache-coherence"
384-
version = "5.0.0"
385+
version = "6.0.0"
385386
source = "registry+https://github.com/rust-lang/crates.io-index"
386-
checksum = "08fcba5ebd96da2a9f0747ab6337fe9788adfb3f63fa2c180520d665562d257e"
387+
checksum = "ec1fd0f0dd79e7cc0f55b102e320d7c77ab76cd272008a8fd98e25b5777e2636"
387388
dependencies = [
388389
"cfg-if",
389390
"libc",

compiler/rustc_codegen_cranelift/Cargo.toml

+6-8
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,12 @@ crate-type = ["dylib"]
1515

1616
[dependencies]
1717
# These have to be in sync with each other
18-
cranelift-codegen = { version = "0.92", features = ["unwind", "all-arch"] }
19-
cranelift-frontend = { version = "0.92" }
20-
cranelift-module = { version = "0.92" }
21-
# NOTE vendored as src/cranelift_native.rs
22-
# FIXME revert back to the external crate with Cranelift 0.93
23-
#cranelift-native = { version = "0.92" }
24-
cranelift-jit = { version = "0.92", optional = true }
25-
cranelift-object = { version = "0.92" }
18+
cranelift-codegen = { version = "0.93", features = ["unwind", "all-arch"] }
19+
cranelift-frontend = { version = "0.93" }
20+
cranelift-module = { version = "0.93" }
21+
cranelift-native = { version = "0.93" }
22+
cranelift-jit = { version = "0.93", optional = true }
23+
cranelift-object = { version = "0.93" }
2624
target-lexicon = "0.12.0"
2725
gimli = { version = "0.26.0", default-features = false, features = ["write"]}
2826
object = { version = "0.29.0", default-features = false, features = ["std", "read_core", "write", "archive", "coff", "elf", "macho", "pe"] }

compiler/rustc_codegen_cranelift/build_sysroot/Cargo.lock

+6-9
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ dependencies = [
5050

5151
[[package]]
5252
name = "compiler_builtins"
53-
version = "0.1.86"
53+
version = "0.1.89"
5454
source = "registry+https://github.com/rust-lang/crates.io-index"
55-
checksum = "5dae98c88e576098d7ab13ebcb40cc43e5114b2beafe61a87cda9200649ff205"
55+
checksum = "9fc9c2080d347a2c316518840ac9194644a9993dfa1e9778ef38979a339f5d8b"
5656
dependencies = [
5757
"rustc-std-workspace-core",
5858
]
@@ -117,21 +117,20 @@ dependencies = [
117117

118118
[[package]]
119119
name = "hermit-abi"
120-
version = "0.2.6"
120+
version = "0.3.1"
121121
source = "registry+https://github.com/rust-lang/crates.io-index"
122-
checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7"
122+
checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286"
123123
dependencies = [
124124
"compiler_builtins",
125-
"libc",
126125
"rustc-std-workspace-alloc",
127126
"rustc-std-workspace-core",
128127
]
129128

130129
[[package]]
131130
name = "libc"
132-
version = "0.2.139"
131+
version = "0.2.140"
133132
source = "registry+https://github.com/rust-lang/crates.io-index"
134-
checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
133+
checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c"
135134
dependencies = [
136135
"rustc-std-workspace-core",
137136
]
@@ -282,10 +281,8 @@ dependencies = [
282281
name = "test"
283282
version = "0.0.0"
284283
dependencies = [
285-
"cfg-if",
286284
"core",
287285
"getopts",
288-
"libc",
289286
"panic_abort",
290287
"panic_unwind",
291288
"proc_macro",

compiler/rustc_codegen_cranelift/build_sysroot/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ alloc = { path = "./sysroot_src/library/alloc" }
88
std = { path = "./sysroot_src/library/std", features = ["panic_unwind", "backtrace"] }
99
test = { path = "./sysroot_src/library/test" }
1010

11-
compiler_builtins = { version = "0.1.39", default-features = false, features = ["no-asm"] }
11+
compiler_builtins = { version = "0.1.87", default-features = false, features = ["no-asm"] }
1212

1313
[patch.crates-io]
1414
rustc-std-workspace-core = { path = "./sysroot_src/library/rustc-std-workspace-core" }

compiler/rustc_codegen_cranelift/build_system/build_sysroot.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,15 @@ pub(crate) fn build_sysroot(
4646
let wrapper_name = wrapper_base_name.replace("____", wrapper);
4747

4848
let mut build_cargo_wrapper_cmd = Command::new(&bootstrap_host_compiler.rustc);
49+
let wrapper_path = DIST_DIR.to_path(dirs).join(&wrapper_name);
4950
build_cargo_wrapper_cmd
5051
.env("TOOLCHAIN_NAME", toolchain_name.clone())
5152
.arg(RelPath::SCRIPTS.to_path(dirs).join(&format!("{wrapper}.rs")))
5253
.arg("-o")
53-
.arg(DIST_DIR.to_path(dirs).join(wrapper_name))
54+
.arg(&wrapper_path)
5455
.arg("-Cstrip=debuginfo");
5556
spawn_and_wait(build_cargo_wrapper_cmd);
57+
try_hard_link(wrapper_path, BIN_DIR.to_path(dirs).join(wrapper_name));
5658
}
5759

5860
let host = build_sysroot_for_triple(
@@ -247,6 +249,7 @@ fn build_clif_sysroot_for_triple(
247249
if channel == "release" {
248250
build_cmd.arg("--release");
249251
}
252+
build_cmd.arg("--locked");
250253
build_cmd.env("__CARGO_DEFAULT_LIB_METADATA", "cg_clif");
251254
if compiler.triple.contains("apple") {
252255
build_cmd.env("CARGO_PROFILE_RELEASE_SPLIT_DEBUGINFO", "packed");

0 commit comments

Comments
 (0)