Skip to content
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

subtree update cg_gcc 2023/10/25 #117253

Merged
merged 48 commits into from
Oct 28, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
242a482
Merge commit '11a0cceab966e5ff1058ddbcab5977e8a1d6d290' into subtree-…
antoyo Oct 9, 2023
22e6f6c
Fix checks
antoyo Oct 9, 2023
ba103e3
Use IntoDynSyncSend
antoyo Oct 9, 2023
cf8c391
Add comment
antoyo Oct 10, 2023
9030b70
Update libgccjit
antoyo Oct 11, 2023
100dfce
Fix #[inline(always)] attribute
antoyo Oct 12, 2023
e3998b2
Handle unsigned comparison for signed integers
antoyo Oct 12, 2023
e1cb818
docs: add Rust logo to more compiler crates
notriddle Oct 16, 2023
e2f32c7
Ignore failing test
antoyo Oct 17, 2023
4dce75f
Merge pull request #352 from rust-lang/update-libgccjit
antoyo Oct 17, 2023
096f14d
Add support for NonNull function attribute
GuillaumeGomez Sep 4, 2023
0348a5f
Improve code readability
GuillaumeGomez Oct 17, 2023
64abf58
optimize popcount implementation
sadlerap Oct 6, 2023
c80fb4a
Merge pull request #326 from GuillaumeGomez/non-null
antoyo Oct 17, 2023
fabdc1a
Merge pull request #348 from sadlerap/optimize-popcount
antoyo Oct 18, 2023
e5fa9f8
Use the correct alignment for integer types
antoyo Oct 7, 2023
9d5e0ba
Fixes including fixing compilation for --no-default-features
antoyo Oct 17, 2023
d64662f
Merge pull request #353 from rust-lang/fix/int-types-alignment
antoyo Oct 18, 2023
99bc37e
Refactor CI scripts to have a different file for libgccjit 12
antoyo May 22, 2023
c7679c4
Revome llvm-14-tools from failures CI
antoyo Oct 18, 2023
a9f31ab
Merge pull request #355 from rust-lang/refactor-ci
antoyo Oct 19, 2023
81c1f39
optimize u128/i128 popcounts further
sadlerap Oct 18, 2023
2096606
Merge pull request #354 from sadlerap/popcount-128-bits
antoyo Oct 19, 2023
67b28ac
s/Generator/Coroutine/
oli-obk Oct 19, 2023
a690467
s/generator/coroutine/
oli-obk Oct 19, 2023
7425c56
Add comment
antoyo Sep 6, 2023
16b3da8
Merge pull request #346 from rust-lang/fix/endianness
antoyo Oct 22, 2023
fcd336b
Add basics for `test` command in build system
GuillaumeGomez Oct 24, 2023
0b6e133
Fix to be able to use a target specification JSON file and document t…
antoyo Oct 24, 2023
46887f2
Merge pull request #364 from rust-lang/doc/target-spec
antoyo Oct 24, 2023
a93d1b7
Fix volatile_load
antoyo Oct 24, 2023
3d9c8af
Merge pull request #365 from rust-lang/fix/volatile-load
antoyo Oct 25, 2023
c15ad9e
Regenerate intrinsics mapping
GuillaumeGomez Oct 25, 2023
783789f
Build the sysroot and run more tests
antoyo Oct 19, 2023
47bac1f
Merge pull request #357 from rust-lang/fix/gcc-12
antoyo Oct 25, 2023
d4a74fb
Merge pull request #363 from GuillaumeGomez/test-command
antoyo Oct 25, 2023
8329a35
Merge pull request #369 from GuillaumeGomez/regen-intrinsics
antoyo Oct 25, 2023
4d66cd8
Merge branch 'master' into sync_from_rust_2023_10_25
antoyo Oct 26, 2023
42e3705
Fix rebase
antoyo Oct 26, 2023
9efb4ce
Update to nightly-2023-10-25
antoyo Oct 26, 2023
c12ac7e
Fix warning
antoyo Oct 26, 2023
2a2b3ea
Remove duplication in CI
antoyo Oct 26, 2023
a6984f5
Fix tests
antoyo Oct 26, 2023
e4fe941
Merge pull request #371 from rust-lang/sync_from_rust_2023_10_25
antoyo Oct 26, 2023
c797ccc
Merge commit 'e4fe941b11a55c5005630696e9b6d81c65f7bd04' into subtree-…
antoyo Oct 26, 2023
eb10fa3
Fix build scripts
GuillaumeGomez Oct 27, 2023
09ce29d
Merge pull request #375 from GuillaumeGomez/fix-build-scripts
antoyo Oct 27, 2023
f0aaf2f
Merge commit '09ce29d0591a21e1abae22eac4d41ffd32993af8' into subtree-…
antoyo Oct 27, 2023
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
44 changes: 31 additions & 13 deletions .github/workflows/failures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,33 @@ jobs:
fail-fast: false
matrix:
libgccjit_version:
- { gcc: "libgccjit.so", artifacts_branch: "master" }
- { gcc: "libgccjit_without_int128.so", artifacts_branch: "master-without-128bit-integers" }
- gcc: "libgccjit.so"
artifacts_branch: "master"
- gcc: "libgccjit_without_int128.so"
artifacts_branch: "master-without-128bit-integers"
- gcc: "libgccjit12.so"
artifacts_branch: "gcc12"
extra: "--no-default-features"
# FIXME(antoyo): we need to set GCC_EXEC_PREFIX so that the linker can find the linker plugin.
# Not sure why it's not found otherwise.
env_extra: "TEST_FLAGS='-Cpanic=abort -Zpanic-abort-tests' GCC_EXEC_PREFIX=/usr/lib/gcc/"

steps:
- uses: actions/checkout@v3

- name: Install packages
run: sudo apt-get install ninja-build ripgrep

- name: Install libgccjit12
if: matrix.libgccjit_version.gcc == 'libgccjit12.so'
run: sudo apt-get install libgccjit-12-dev

- name: Setup path to libgccjit
if: matrix.libgccjit_version.gcc == 'libgccjit12.so'
run: echo /usr/lib/gcc/x86_64-linux-gnu/12 > gcc_path

- name: Download artifact
if: matrix.libgccjit_version.gcc != 'libgccjit12.so'
uses: dawidd6/action-download-artifact@v2
with:
workflow: main.yml
Expand All @@ -40,6 +57,7 @@ jobs:
search_artifacts: true # Because, instead, the action only check the last job ran and that won't work since we want multiple artifacts.

- name: Setup path to libgccjit
if: matrix.libgccjit_version.gcc != 'libgccjit12.so'
run: |
sudo dpkg --force-overwrite -i gcc-13/gcc-13.deb
echo /usr/lib/ > gcc_path
Expand Down Expand Up @@ -81,18 +99,18 @@ jobs:
#path: rust
#key: ${{ runner.os }}-packages-${{ hashFiles('rust/.git/HEAD') }}

- name: Build
run: |
./y.sh prepare --only-libcore
./y.sh build
cargo test
./clean_all.sh

- name: Prepare dependencies
- name: Git config
run: |
git config --global user.email "user@example.com"
git config --global user.name "User"
./y.sh prepare

- name: Prepare dependencies
if: matrix.libgccjit_version.gcc == 'libgccjit12.so'
run: ./y.sh prepare --libgccjit12-patches

- name: Prepare dependencies
if: matrix.libgccjit_version.gcc != 'libgccjit12.so'
run: ./y.sh prepare

# Compile is a separate step, as the actions-rs/cargo action supports error annotations
- name: Compile
Expand All @@ -107,5 +125,5 @@ jobs:
- name: Run tests
id: tests
run: |
./test.sh --release --clean --build-sysroot --test-failing-rustc | tee output_log
rg "test result" output_log >> $GITHUB_STEP_SUMMARY
${{ matrix.libgccjit_version.env_extra }} ./test.sh --release --clean --build-sysroot --test-failing-rustc ${{ matrix.libgccjit_version.extra }} | tee output_log
rg --text "test result" output_log >> $GITHUB_STEP_SUMMARY
37 changes: 18 additions & 19 deletions .github/workflows/gcc12.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ env:
# Enable backtraces for easier debugging
RUST_BACKTRACE: 1
TEST_FLAGS: "-Cpanic=abort -Zpanic-abort-tests"
# FIXME(antoyo): we need to set GCC_EXEC_PREFIX so that the linker can find the linker plugin.
# Not sure why it's not found otherwise.
GCC_EXEC_PREFIX: /usr/lib/gcc/

jobs:
build:
Expand All @@ -21,17 +24,15 @@ jobs:
matrix:
commands: [
"--mini-tests",
# TODO(antoyo): re-enable those commands when the build with libgccjit 12 is fixed.
#"--std-tests",
"--std-tests",
# FIXME: re-enable asm tests when GCC can emit in the right syntax.
# "--asm-tests",
#"--test-libcore",
#"--extended-rand-tests",
#"--extended-regex-example-tests",
#"--extended-regex-tests",
#"--test-successful-rustc --nb-parts 2 --current-part 0",
#"--test-successful-rustc --nb-parts 2 --current-part 1",
#"--test-failing-rustc",
"--test-libcore",
"--extended-rand-tests",
"--extended-regex-example-tests",
"--extended-regex-tests",
"--test-successful-rustc --nb-parts 2 --current-part 0",
"--test-successful-rustc --nb-parts 2 --current-part 1",
]

steps:
Expand Down Expand Up @@ -85,18 +86,16 @@ jobs:

- name: Build
run: |
./y.sh prepare --only-libcore
# TODO(antoyo): build the sysroot when the build with libgccjit 12 is fixed.
#./y.sh build --no-default-features
# TODO(antoyo): run the tests when we can build the sysroot with libgccjit 12.
#cargo test --no-default-features
./y.sh prepare --only-libcore --libgccjit12-patches
./y.sh build --no-default-features --sysroot-panic-abort
cargo test --no-default-features
./clean_all.sh

- name: Prepare dependencies
run: |
git config --global user.email "user@example.com"
git config --global user.name "User"
./y.sh prepare
./y.sh prepare --libgccjit12-patches

# Compile is a separate step, as the actions-rs/cargo action supports error annotations
- name: Compile
Expand All @@ -108,9 +107,9 @@ jobs:
- name: Add more failing tests for GCC 12
run: cat failing-ui-tests12.txt >> failing-ui-tests.txt

- name: Add more failing tests because the sysroot is not compiled with LTO
run: cat failing-non-lto-tests.txt >> failing-ui-tests.txt

- name: Run tests
run: |
# TODO(antoyo): add --build-sysroot when the build with libgccjit 12 is fixed.
# FIXME(antoyo): we need to set GCC_EXEC_PREFIX so that the linker can find the linker plugin.
# Not sure why it's not found otherwise.
GCC_EXEC_PREFIX=/usr/lib/gcc/ ./test.sh --release --clean ${{ matrix.commands }} --no-default-features
./test.sh --release --clean --build-sysroot ${{ matrix.commands }} --no-default-features
30 changes: 19 additions & 11 deletions build_system/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use std::path::Path;
struct BuildArg {
codegen_release_channel: bool,
sysroot_release_channel: bool,
sysroot_panic_abort: bool,
flags: Vec<String>,
gcc_path: String,
}
Expand All @@ -32,6 +33,9 @@ impl BuildArg {
"--no-default-features" => {
build_arg.flags.push("--no-default-features".to_string());
}
"--sysroot-panic-abort" => {
build_arg.sysroot_panic_abort = true;
},
"--features" => {
if let Some(arg) = args.next() {
build_arg.flags.push("--features".to_string());
Expand Down Expand Up @@ -77,6 +81,7 @@ impl BuildArg {

--release : Build codegen in release mode
--release-sysroot : Build sysroot in release mode
--sysroot-panic-abort : Build the sysroot without unwinding support.
--no-default-features : Add `--no-default-features` flag
--features [arg] : Add a new feature [arg]
--target-triple [arg] : Set the target triple to [arg]
Expand All @@ -88,7 +93,7 @@ impl BuildArg {

fn build_sysroot(
env: &mut HashMap<String, String>,
release_mode: bool,
args: &BuildArg,
config: &ConfigInfo,
) -> Result<(), String> {
std::env::set_current_dir("build_sysroot")
Expand Down Expand Up @@ -138,15 +143,18 @@ fn build_sysroot(
let _ = fs::remove_dir_all("sysroot");

// Builds libs
let channel = if release_mode {
let rustflags = env
.get("RUSTFLAGS")
.cloned()
.unwrap_or_default();
env.insert(
"RUSTFLAGS".to_string(),
format!("{} -Zmir-opt-level=3", rustflags),
);
let mut rustflags = env
.get("RUSTFLAGS")
.cloned()
.unwrap_or_default();
if args.sysroot_panic_abort {
rustflags.push_str(" -Cpanic=abort -Zpanic-abort-tests");
}
env.insert(
"RUSTFLAGS".to_string(),
format!("{} -Zmir-opt-level=3", rustflags),
);
let channel = if args.sysroot_release_channel {
run_command_with_output_and_env(
&[
&"cargo",
Expand Down Expand Up @@ -224,7 +232,7 @@ fn build_codegen(args: &BuildArg) -> Result<(), String> {
println!("[BUILD] sysroot");
build_sysroot(
&mut env,
args.sysroot_release_channel,
args,
&config,
)?;
Ok(())
Expand Down
25 changes: 20 additions & 5 deletions build_system/src/prepare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::utils::{cargo_install, git_clone, run_command, run_command_with_outpu
use std::fs;
use std::path::Path;

fn prepare_libcore(sysroot_path: &Path, cross_compile: bool) -> Result<(), String> {
fn prepare_libcore(sysroot_path: &Path, libgccjit12_patches: bool, cross_compile: bool) -> Result<(), String> {
let rustc_path = match get_rustc_path() {
Some(path) => path,
None => return Err("`rustc` path not found".to_string()),
Expand Down Expand Up @@ -93,6 +93,16 @@ fn prepare_libcore(sysroot_path: &Path, cross_compile: bool) -> Result<(), Strin
Ok(())
})?;
}
if libgccjit12_patches {
walk_dir(
"patches/libgccjit12",
|_| Ok(()),
|file_path: &Path| {
patches.push(file_path.to_path_buf());
Ok(())
},
)?;
}
patches.sort();
for file_path in patches {
println!("[GIT] apply `{}`", file_path.display());
Expand Down Expand Up @@ -164,17 +174,20 @@ where
struct PrepareArg {
cross_compile: bool,
only_libcore: bool,
libgccjit12_patches: bool,
}

impl PrepareArg {
fn new() -> Result<Option<Self>, String> {
let mut only_libcore = false;
let mut cross_compile = false;
let mut libgccjit12_patches = false;

for arg in std::env::args().skip(2) {
match arg.as_str() {
"--only-libcore" => only_libcore = true,
"--cross" => cross_compile = true,
"--libgccjit12-patches" => libgccjit12_patches = true,
"--help" => {
Self::usage();
return Ok(None);
Expand All @@ -185,6 +198,7 @@ impl PrepareArg {
Ok(Some(Self {
cross_compile,
only_libcore,
libgccjit12_patches,
}))
}

Expand All @@ -193,9 +207,10 @@ impl PrepareArg {
r#"
`prepare` command help:

--only-libcore : Only setup libcore and don't clone other repositories
--cross : Apply the patches needed to do cross-compilation
--help : Show this help
--only-libcore : Only setup libcore and don't clone other repositories
--cross : Apply the patches needed to do cross-compilation
--libgccjit12-patches : Apply patches needed for libgccjit12
--help : Show this help
"#
)
}
Expand All @@ -207,7 +222,7 @@ pub fn run() -> Result<(), String> {
None => return Ok(()),
};
let sysroot_path = Path::new("build_sysroot");
prepare_libcore(sysroot_path, args.cross_compile)?;
prepare_libcore(sysroot_path, args.libgccjit12_patches, args.cross_compile)?;

if !args.only_libcore {
cargo_install("hyperfine")?;
Expand Down
8 changes: 4 additions & 4 deletions failing-ui-tests12.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,12 @@ tests/ui/simd/intrinsic/generic-reduction-pass.rs
tests/ui/simd/intrinsic/generic-select-pass.rs
tests/ui/simd/intrinsic/inlining-issue67557-ice.rs
tests/ui/simd/intrinsic/inlining-issue67557.rs
tests/ui/simd/monomorphize-shuffle-index.rs
tests/ui/simd/shuffle.rs
tests/ui/simd/simd-bitmask.rs
tests/ui/generator/resume-after-return.rs
tests/ui/iterators/iter-step-overflow-debug.rs
tests/ui/macros/rfc-2011-nicer-assert-messages/all-expr-kinds.rs
tests/ui/numbers-arithmetic/next-power-of-two-overflow-debug.rs
tests/ui/privacy/reachable-unnameable-items.rs
tests/ui/rfc-1937-termination-trait/termination-trait-in-test.rs
tests/ui/rfcs/rfc-1937-termination-trait/termination-trait-in-test.rs
tests/ui/async-await/async-fn-size-moved-locals.rs
tests/ui/async-await/async-fn-size-uninit-locals.rs
tests/ui/cfg/cfg-panic.rs
Expand All @@ -38,3 +35,6 @@ tests/ui/simd/issue-85915-simd-ptrs.rs
tests/ui/issues/issue-68010-large-zst-consts.rs
tests/ui/rust-2018/proc-macro-crate-in-paths.rs
tests/ui/target-feature/missing-plusminus.rs
tests/ui/sse2.rs
tests/ui/codegen/issue-79865-llvm-miscompile.rs
tests/ui/intrinsics/intrinsics-integer.rs
32 changes: 32 additions & 0 deletions patches/libgccjit12/0001-core-Disable-portable-simd-test.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
From 7bcd24ec6d4a96121874cb1ae5a23ea274aeff34 Mon Sep 17 00:00:00 2001
From: None <none@example.com>
Date: Thu, 19 Oct 2023 13:12:51 -0400
Subject: [PATCH] [core] Disable portable-simd test

---
library/core/tests/lib.rs | 2 --
1 file changed, 2 deletions(-)

diff --git a/library/core/tests/lib.rs b/library/core/tests/lib.rs
index 5814ed4..194ad4c 100644
--- a/library/core/tests/lib.rs
+++ b/library/core/tests/lib.rs
@@ -90,7 +90,6 @@
#![feature(unwrap_infallible)]
#![feature(pointer_byte_offsets)]
#![feature(pointer_is_aligned)]
-#![feature(portable_simd)]
#![feature(ptr_metadata)]
#![feature(lazy_cell)]
#![feature(unsized_tuple_coercion)]
@@ -157,7 +156,6 @@ mod pin;
mod pin_macro;
mod ptr;
mod result;
-mod simd;
mod slice;
mod str;
mod str_lossy;
--
2.42.0

24 changes: 15 additions & 9 deletions src/intrinsic/llvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -432,15 +432,21 @@ pub fn ignore_arg_cast(func_name: &str, index: usize, args_len: usize) -> bool {

#[cfg(not(feature="master"))]
pub fn intrinsic<'gcc, 'tcx>(name: &str, cx: &CodegenCx<'gcc, 'tcx>) -> Function<'gcc> {
match name {
"llvm.x86.xgetbv" | "llvm.x86.sse2.pause" => {
let gcc_name = "__builtin_trap";
let func = cx.context.get_builtin_function(gcc_name);
cx.functions.borrow_mut().insert(gcc_name.to_string(), func);
return func;
},
_ => unimplemented!("unsupported LLVM intrinsic {}", name),
}
let gcc_name =
match name {
"llvm.x86.sse2.pause" => {
// NOTE: pause is only a hint, so we use a dummy built-in because target built-ins
// are not supported in libgccjit 12.
"__builtin_inff"
},
"llvm.x86.xgetbv" => {
"__builtin_trap"
},
_ => unimplemented!("unsupported LLVM intrinsic {}", name),
};
let func = cx.context.get_builtin_function(gcc_name);
cx.functions.borrow_mut().insert(gcc_name.to_string(), func);
return func;
}

#[cfg(feature="master")]
Expand Down
Loading