Skip to content

Subtree sync for rustc_codegen_cranelift #123166

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 52 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
4b61629
Merge commit '4cf4ffc6ba514f171b3f52d1c731063e4fc45be3' into sync_cg_…
bjorn3 Mar 16, 2024
db15302
Merge branch 'sync_from_rust'
bjorn3 Mar 16, 2024
e46114f
Handle calls to upstream monomorphizations in compiler_builtins
saethlin Mar 15, 2024
eeca87b
Avoid various uses of `Option<Span>` in favor of using `DUMMY_SP` in …
oli-obk Mar 14, 2024
1aac27e
Rustup to rustc 1.79.0-nightly (eb45c8444 2024-03-17)
bjorn3 Mar 18, 2024
b64079d
Re-enable rmake.rs tests as a compiletest bug has been fixed
bjorn3 Mar 18, 2024
c49f608
Several refactorings to constant.rs
bjorn3 Mar 18, 2024
06ef32c
Make ptr_guaranteed_cmp a rustc_intrinsic and favor its body over bac…
oli-obk Mar 5, 2024
eb752bc
Avoid ICE when global_asm const operand fails to evaluate
BeetleFunk Mar 21, 2024
9ddba16
Merge pull request #1467 from BeetleFunk/global-asm-ice
bjorn3 Mar 21, 2024
dfc1bd7
Eagerly convert some ctors to use their specialized ctors
compiler-errors Mar 21, 2024
155b46a
Programmatically convert some of the pat ctors
compiler-errors Mar 21, 2024
9057355
Auto merge of #122580 - saethlin:compiler-builtins-can-panic, r=pnkfelix
bors Mar 22, 2024
ae0e6e2
Update to Cranelift 0.106
bjorn3 Mar 22, 2024
087385a
Sync from rust 0ad927c0c07b65fc0dae37105e09c877c87c296a
bjorn3 Mar 22, 2024
e2cc8eb
Rustup to rustc 1.79.0-nightly (0ad927c0c 2024-03-21)
bjorn3 Mar 22, 2024
5932283
Remove workaround for UB in cranelift-jit that has been fixed
bjorn3 Mar 22, 2024
7f0f9f6
Auto merge of #122852 - compiler-errors:raw-ptr, r=lcnr
bors Mar 22, 2024
a517adc
move assert_unsafe_preconditions to its own file
RalfJung Mar 17, 2024
4609a48
Add async-closures/once.rs back to cranelift tests
compiler-errors Mar 25, 2024
28d480b
Sync from rust 0824b300eb0dae5d9ed59719d3f2732016683d66
bjorn3 Mar 25, 2024
0231d65
Rustup to rustc 1.79.0-nightly (0824b300e 2024-03-24)
bjorn3 Mar 25, 2024
c53025b
Add needs-unwind annotations to a couple of tests
bjorn3 Mar 25, 2024
187deca
Fix rustc test suite
bjorn3 Mar 25, 2024
654ce59
Remove ignore for fixed rustc test
bjorn3 Mar 25, 2024
49777c3
Add needs-unwind for proc macro tests
bjorn3 Mar 25, 2024
22e4175
Rollup merge of #123034 - bjorn3:test_ignores, r=compiler-errors
matthiaskrgr Mar 25, 2024
d183a51
Sync from rust 5f2c7d2bfd46cad00352ab7cd66242077e2e518c
bjorn3 Mar 26, 2024
6092160
Rustup to rustc 1.79.0-nightly (5f2c7d2bf 2024-03-25)
bjorn3 Mar 26, 2024
dc6595d
Implement nearbyintf32 and nearbyintf64 and remove two test ignores
bjorn3 Mar 26, 2024
ad1886a
Fix rustdoc help message when no args are passed
bjorn3 Mar 26, 2024
23868af
Correctly implement --emit
bjorn3 Mar 26, 2024
34d0f6a
Re-enable fixed rustc test
bjorn3 Mar 26, 2024
cfd7325
Merge pull request #1469 from rust-lang/fix_some_rustc_tests
bjorn3 Mar 26, 2024
09ec683
Emit DW_AT_frame_base debuginfo attribute
bjorn3 Mar 27, 2024
c76c269
Reduce debuginfo divergence between cg_llvm and cg_clif
bjorn3 Mar 27, 2024
e48d7d2
Emit namespace debuginfo
bjorn3 Mar 27, 2024
98eaaed
Match unit names with cg_llvm
bjorn3 Mar 27, 2024
a64387b
Emit DW_AT_external if applicable
bjorn3 Mar 27, 2024
41246b2
Remove fixed todos
bjorn3 Mar 27, 2024
68b5931
Merge pull request #1470 from rust-lang/debuginfo_improvements
bjorn3 Mar 27, 2024
1f75f0f
Move FileId caching to DebugContext::add_source_file
bjorn3 Mar 27, 2024
f086e7a
Allow debuginfo to reference global variables
bjorn3 Mar 27, 2024
4b80941
Add debuginfo for statics
bjorn3 Mar 27, 2024
69363cf
Merge pull request #1472 from rust-lang/debuginfo_improvements2
bjorn3 Mar 27, 2024
fee1204
Stop taking FunctionCx's fn_abi field
bjorn3 Mar 27, 2024
55a2446
Don't panic when layout can't be computed and fix generation of array…
bjorn3 Mar 27, 2024
0634aed
Implement debug_type for tuples
bjorn3 Mar 27, 2024
4f0cde1
Define return type for functions in debuginfo
bjorn3 Mar 27, 2024
ef0b3d1
Rustup to rustc 1.79.0-nightly (c9f8f3438 2024-03-27)
bjorn3 Mar 28, 2024
09fae60
Fix rustc test suite
bjorn3 Mar 28, 2024
987ed34
Merge commit '09fae60a86b848a2fc0ad219ecc4e438dc1eef86' into sync_cg_…
bjorn3 Mar 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 28 additions & 28 deletions compiler/rustc_codegen_cranelift/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,18 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"

[[package]]
name = "cranelift-bforest"
version = "0.105.2"
version = "0.106.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9515fcc42b6cb5137f76b84c1a6f819782d0cf12473d145d3bc5cd67eedc8bc2"
checksum = "6a535eb1cf5a6003197dc569320c40c1cb2d2f97ef5d5348eebf067f20957381"
dependencies = [
"cranelift-entity",
]

[[package]]
name = "cranelift-codegen"
version = "0.105.2"
version = "0.106.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ad827c6071bfe6d22de1bc331296a29f9ddc506ff926d8415b435ec6a6efce0"
checksum = "11b5066db32cec1492573827183af2142d2d88fe85a83cfc9e73f0f63d3788d4"
dependencies = [
"bumpalo",
"cranelift-bforest",
Expand All @@ -76,39 +76,39 @@ dependencies = [

[[package]]
name = "cranelift-codegen-meta"
version = "0.105.2"
version = "0.106.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10e6b36237a9ca2ce2fb4cc7741d418a080afa1327402138412ef85d5367bef1"
checksum = "64942e5774308e835fbad4dd25f253105412c90324631910e1ec27963147bddb"
dependencies = [
"cranelift-codegen-shared",
]

[[package]]
name = "cranelift-codegen-shared"
version = "0.105.2"
version = "0.106.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c36bf4bfb86898a94ccfa773a1f86e8a5346b1983ff72059bdd2db4600325251"
checksum = "c39c33db9a86dd6d8d04166a10c53deb477aeea3500eaaefca682e4eda9bb986"

[[package]]
name = "cranelift-control"
version = "0.105.2"
version = "0.106.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7cbf36560e7a6bd1409ca91e7b43b2cc7ed8429f343d7605eadf9046e8fac0d0"
checksum = "4b7fc4937613aea3156a0538800a17bf56f345a5da2e79ae3df58488c93d867f"
dependencies = [
"arbitrary",
]

[[package]]
name = "cranelift-entity"
version = "0.105.2"
version = "0.106.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a71e11061a75b1184c09bea97c026a88f08b59ade96a7bb1f259d4ea0df2e942"
checksum = "f85575e79a153ce1ddbfb7fe1813519b4bfe1eb200cc9c8353b45ad123ae4d36"

[[package]]
name = "cranelift-frontend"
version = "0.105.2"
version = "0.106.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af5d4da63143ee3485c7bcedde0a818727d737d1083484a0ceedb8950c89e495"
checksum = "bbc31d6c0ab2249fe0c21e988256b42f5f401ab2673b4fc40076c82a698bdfb9"
dependencies = [
"cranelift-codegen",
"log",
Expand All @@ -118,15 +118,15 @@ dependencies = [

[[package]]
name = "cranelift-isle"
version = "0.105.2"
version = "0.106.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "457a9832b089e26f5eea70dcf49bed8ec6edafed630ce7c83161f24d46ab8085"
checksum = "dc14f37e3314c0e4c53779c2f46753bf242efff76ee9473757a1fff3b495ad37"

[[package]]
name = "cranelift-jit"
version = "0.105.2"
version = "0.106.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0af95fe68d5a10919012c8db82b1d59820405b8001c8c6d05f94b08031334fa9"
checksum = "cfdd1942f3233176a68c285380dbc84ff0440246a1bce308611c0a385b56ab18"
dependencies = [
"anyhow",
"cranelift-codegen",
Expand All @@ -144,9 +144,9 @@ dependencies = [

[[package]]
name = "cranelift-module"
version = "0.105.2"
version = "0.106.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11b0b201fa10a4014062d4c56c307c8d18fdf9a84cb5279efe6080241f42c7a7"
checksum = "121b2b5a16912554a1b9aace75b9b21eca49f28e33cbfbad4786dd9bc5361a5c"
dependencies = [
"anyhow",
"cranelift-codegen",
Expand All @@ -155,9 +155,9 @@ dependencies = [

[[package]]
name = "cranelift-native"
version = "0.105.2"
version = "0.106.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b490d579df1ce365e1ea359e24ed86d82289fa785153327c2f6a69a59a731e4"
checksum = "2ea5375f76ab31f9800a23fb2b440810286a6f669a3eb467cdd7ff255ea64268"
dependencies = [
"cranelift-codegen",
"libc",
Expand All @@ -166,9 +166,9 @@ dependencies = [

[[package]]
name = "cranelift-object"
version = "0.105.2"
version = "0.106.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb7e821ac6db471bcdbd004e5a4fa0d374f1046bd3a2ce278c332e0b0c01ca63"
checksum = "f34e04419ab41661e973d90a73aa7b12771455394dae7a69b101a9b7e7589db7"
dependencies = [
"anyhow",
"cranelift-codegen",
Expand Down Expand Up @@ -392,9 +392,9 @@ dependencies = [

[[package]]
name = "target-lexicon"
version = "0.12.12"
version = "0.12.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14c39fd04924ca3a864207c66fc2cd7d22d7c016007f9ce846cbb9326331930a"
checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f"

[[package]]
name = "unicode-ident"
Expand All @@ -410,9 +410,9 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"

[[package]]
name = "wasmtime-jit-icache-coherence"
version = "18.0.2"
version = "19.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33f4121cb29dda08139b2824a734dd095d83ce843f2d613a84eb580b9cfc17ac"
checksum = "2796e4b4989db62899d2117e1e0258b839d088c044591b14e3a0396e7b3ae53a"
dependencies = [
"cfg-if",
"libc",
Expand Down
12 changes: 6 additions & 6 deletions compiler/rustc_codegen_cranelift/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ crate-type = ["dylib"]

[dependencies]
# These have to be in sync with each other
cranelift-codegen = { version = "0.105.2", default-features = false, features = ["std", "unwind", "all-arch"] }
cranelift-frontend = { version = "0.105.2" }
cranelift-module = { version = "0.105.2" }
cranelift-native = { version = "0.105.2" }
cranelift-jit = { version = "0.105.2", optional = true }
cranelift-object = { version = "0.105.2" }
cranelift-codegen = { version = "0.106.0", default-features = false, features = ["std", "unwind", "all-arch"] }
cranelift-frontend = { version = "0.106.0" }
cranelift-module = { version = "0.106.0" }
cranelift-native = { version = "0.106.0" }
cranelift-jit = { version = "0.106.0", optional = true }
cranelift-object = { version = "0.106.0" }
target-lexicon = "0.12.0"
gimli = { version = "0.28", default-features = false, features = ["write"]}
object = { version = "0.32", default-features = false, features = ["std", "read_core", "write", "archive", "coff", "elf", "macho", "pe"] }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ index 42a26ae..5ac1042 100644
+#![cfg(test)]
#![feature(alloc_layout_extra)]
#![feature(array_chunks)]
#![feature(array_windows)]
#![feature(array_ptr_get)]
--
2.21.0 (Apple Git-122)
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_cranelift/rust-toolchain
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "nightly-2024-03-16"
channel = "nightly-2024-03-28"
components = ["rust-src", "rustc-dev", "llvm-tools"]
7 changes: 4 additions & 3 deletions compiler/rustc_codegen_cranelift/scripts/rustc-clif.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ fn main() {
codegen_backend_arg.push(cg_clif_dylib_path);
args.push(codegen_backend_arg);
}
if !passed_args.iter().any(|arg| {
arg == "--sysroot" || arg.to_str().is_some_and(|s| s.starts_with("--sysroot="))
}) {
if !passed_args
.iter()
.any(|arg| arg == "--sysroot" || arg.to_str().is_some_and(|s| s.starts_with("--sysroot=")))
{
args.push(OsString::from("--sysroot"));
args.push(OsString::from(sysroot.to_str().unwrap()));
}
Expand Down
12 changes: 9 additions & 3 deletions compiler/rustc_codegen_cranelift/scripts/rustdoc-clif.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,18 @@ fn main() {
codegen_backend_arg.push(cg_clif_dylib_path);
args.push(codegen_backend_arg);
}
if !passed_args.iter().any(|arg| {
arg == "--sysroot" || arg.to_str().is_some_and(|s| s.starts_with("--sysroot="))
}) {
if !passed_args
.iter()
.any(|arg| arg == "--sysroot" || arg.to_str().is_some_and(|s| s.starts_with("--sysroot=")))
{
args.push(OsString::from("--sysroot"));
args.push(OsString::from(sysroot.to_str().unwrap()));
}
if passed_args.is_empty() {
// Don't pass any arguments when the user didn't pass any arguments
// either to ensure the help message is shown.
args.clear();
}
args.extend(passed_args);

let rustdoc = if let Some(rustdoc) = option_env!("RUSTDOC") {
Expand Down
54 changes: 26 additions & 28 deletions compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@ pushd rust

command -v rg >/dev/null 2>&1 || cargo install ripgrep

# FIXME(rust-lang/rust#122196) fix stage0 rmake.rs run-make tests and remove
# this workaround
for test in $(ls tests/run-make); do
if [[ -e "tests/run-make/$test/rmake.rs" ]]; then
rm -r "tests/run-make/$test"
fi
done

# FIXME remove this workaround once ICE tests no longer emit an outdated nightly message
for test in $(rg -i --files-with-matches "//@(\[.*\])? failure-status: 101" tests/ui); do
echo "rm $test"
Expand All @@ -42,7 +34,6 @@ rm tests/ui/parser/unclosed-delimiter-in-dep.rs # submodule contains //~ERROR
# ================

# vendor intrinsics
rm tests/ui/simd/array-type.rs # "Index argument for `simd_insert` is not a constant"
rm tests/ui/asm/x86_64/evex512-implicit-feature.rs # unimplemented AVX512 x86 vendor intrinsic

# exotic linkages
Expand All @@ -59,12 +50,9 @@ rm -r tests/run-make/c-link-to-rust-va-list-fn # requires callee side vararg sup
rm -r tests/run-pass-valgrind/unsized-locals

# misc unimplemented things
rm tests/ui/intrinsics/intrinsic-nearby.rs # unimplemented nearbyintf32 and nearbyintf64 intrinsics
rm tests/ui/target-feature/missing-plusminus.rs # error not implemented
rm -r tests/run-make/emit-named-files # requires full --emit support
rm -r tests/run-make/repr128-dwarf # debuginfo test
rm -r tests/run-make/split-debuginfo # same
rm -r tests/run-make/symbols-include-type-name # --emit=asm not supported
rm -r tests/run-make/target-specs # i686 not supported by Cranelift
rm -r tests/run-make/mismatching-target-triples # same
rm tests/ui/asm/x86_64/issue-96797.rs # const and sym inline asm operands don't work entirely correctly
Expand Down Expand Up @@ -102,42 +90,39 @@ rm tests/ui/abi/stack-protector.rs # requires stack protector support
rm -r tests/run-make/emit-stack-sizes # requires support for -Z emit-stack-sizes
rm -r tests/run-make/optimization-remarks-dir # remarks are LLVM specific

# requires asm, llvm-ir and/or llvm-bc emit support
# =============================================
rm -r tests/run-make/emit-named-files
rm -r tests/run-make/issue-30063
rm -r tests/run-make/multiple-emits
rm -r tests/run-make/output-type-permutations
rm -r tests/run-make/emit-to-stdout
rm -r tests/run-make/compressed-debuginfo
rm -r tests/run-make/symbols-include-type-name


# giving different but possibly correct results
# =============================================
rm tests/ui/mir/mir_misc_casts.rs # depends on deduplication of constants
rm tests/ui/mir/mir_raw_fat_ptr.rs # same
rm tests/ui/consts/issue-33537.rs # same
rm tests/ui/consts/const-mut-refs-crate.rs # same

# rustdoc-clif passes extra args, suppressing the help message when no args are passed
rm -r tests/run-make/issue-88756-default-output

# doesn't work due to the way the rustc test suite is invoked.
# should work when using ./x.py test the way it is intended
# ============================================================
rm -r tests/run-make/remap-path-prefix-dwarf # requires llvm-dwarfdump
rm -r tests/run-make/compiler-builtins # Expects lib/rustlib/src/rust to contains the standard library source

# genuine bugs
# ============
rm tests/incremental/spike-neg1.rs # errors out for some reason
rm tests/incremental/spike-neg2.rs # same

rm -r tests/run-make/issue-51671 # wrong filename given in case of --emit=obj
rm -r tests/run-make/issue-30063 # same
rm -r tests/run-make/multiple-emits # same
rm -r tests/run-make/output-type-permutations # same
rm -r tests/run-make/used # same
rm -r tests/run-make/no-alloc-shim
rm -r tests/run-make/emit-to-stdout
rm -r tests/run-make/compressed-debuginfo

rm -r tests/run-make/extern-fn-explicit-align # argument alignment not yet supported

rm tests/ui/codegen/subtyping-enforces-type-equality.rs # assert_assignable bug with Coroutine's
rm -r tests/run-make/panic-abort-eh_frame # .eh_frame emitted with panic=abort

# bugs in the test suite
# ======================
rm tests/ui/backtrace.rs # TODO warning
rm tests/ui/process/nofile-limit.rs # TODO some AArch64 linking issue

rm tests/ui/stdio-is-blocking.rs # really slow with unoptimized libstd
Expand All @@ -160,6 +145,19 @@ index ea06b620c4c..b969d0009c6 100644
ifdef RUSTC_LINKER
RUSTC := \$(RUSTC) -Clinker='\$(RUSTC_LINKER)'
RUSTDOC := \$(RUSTDOC) -Clinker='\$(RUSTC_LINKER)'
diff --git a/src/tools/run-make-support/src/rustdoc.rs b/src/tools/run-make-support/src/rustdoc.rs
index 9607ff02f96..b7d97caf9a2 100644
--- a/src/tools/run-make-support/src/rustdoc.rs
+++ b/src/tools/run-make-support/src/rustdoc.rs
@@ -34,8 +34,6 @@ pub fn bare() -> Self {
/// Construct a \`rustdoc\` invocation with \`-L \$(TARGET_RPATH_DIR)\` set.
pub fn new() -> Self {
let mut cmd = setup_common();
- let target_rpath_dir = env::var_os("TARGET_RPATH_DIR").unwrap();
- cmd.arg(format!("-L{}", target_rpath_dir.to_string_lossy()));
Self { cmd }
}

EOF

echo "[TEST] rustc test suite"
Expand Down
7 changes: 2 additions & 5 deletions compiler/rustc_codegen_cranelift/src/abi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,17 +222,15 @@ pub(crate) fn codegen_fn_prelude<'tcx>(fx: &mut FunctionCx<'_, '_, 'tcx>, start_
Spread(Vec<Option<CValue<'tcx>>>),
}

let fn_abi = fx.fn_abi.take().unwrap();

// FIXME implement variadics in cranelift
if fn_abi.c_variadic {
if fx.fn_abi.c_variadic {
fx.tcx.dcx().span_fatal(
fx.mir.span,
"Defining variadic functions is not yet supported by Cranelift",
);
}

let mut arg_abis_iter = fn_abi.args.iter();
let mut arg_abis_iter = fx.fn_abi.args.iter();

let func_params = fx
.mir
Expand Down Expand Up @@ -279,7 +277,6 @@ pub(crate) fn codegen_fn_prelude<'tcx>(fx: &mut FunctionCx<'_, '_, 'tcx>, start_
}

assert!(arg_abis_iter.next().is_none(), "ArgAbi left behind");
fx.fn_abi = Some(fn_abi);
assert!(block_params_iter.next().is_none(), "arg_value left behind");

self::comments::add_locals_header_comment(fx);
Expand Down
Loading