about summary refs log tree commit diff
path: root/compiler/rustc_codegen_cranelift/build_system
diff options
context:
space:
mode:
authorbjorn3 <17426603+bjorn3@users.noreply.github.com>2024-04-05 16:20:23 +0000
committerbjorn3 <17426603+bjorn3@users.noreply.github.com>2024-04-05 16:20:23 +0000
commit6cf6fd38ec06decc2e5896ca3659cd74b0b03363 (patch)
tree7e5bd04721f85d7da3b02e5fdde8ac775bd0e8c5 /compiler/rustc_codegen_cranelift/build_system
parent5958f5e08fa88ee95ede8c00f1b89befe0372d54 (diff)
parentfbda869b4e230c788b6bce426038ba8419956f2d (diff)
downloadrust-6cf6fd38ec06decc2e5896ca3659cd74b0b03363.tar.gz
rust-6cf6fd38ec06decc2e5896ca3659cd74b0b03363.zip
Merge commit 'fbda869b4e230c788b6bce426038ba8419956f2d' into sync_cg_clif-2024-04-05
Diffstat (limited to 'compiler/rustc_codegen_cranelift/build_system')
-rw-r--r--compiler/rustc_codegen_cranelift/build_system/build_backend.rs16
-rw-r--r--compiler/rustc_codegen_cranelift/build_system/build_sysroot.rs4
-rw-r--r--compiler/rustc_codegen_cranelift/build_system/main.rs13
-rw-r--r--compiler/rustc_codegen_cranelift/build_system/prepare.rs1
-rw-r--r--compiler/rustc_codegen_cranelift/build_system/tests.rs17
-rw-r--r--compiler/rustc_codegen_cranelift/build_system/utils.rs18
6 files changed, 19 insertions, 50 deletions
diff --git a/compiler/rustc_codegen_cranelift/build_system/build_backend.rs b/compiler/rustc_codegen_cranelift/build_system/build_backend.rs
index d90111adf77..129713e574a 100644
--- a/compiler/rustc_codegen_cranelift/build_system/build_backend.rs
+++ b/compiler/rustc_codegen_cranelift/build_system/build_backend.rs
@@ -1,9 +1,10 @@
+use std::env;
 use std::path::PathBuf;
 
 use crate::path::{Dirs, RelPath};
 use crate::rustc_info::get_file_name;
 use crate::shared_utils::{rustflags_from_env, rustflags_to_cmd_env};
-use crate::utils::{is_ci, is_ci_opt, maybe_incremental, CargoProject, Compiler, LogGroup};
+use crate::utils::{CargoProject, Compiler, LogGroup};
 
 pub(crate) static CG_CLIF: CargoProject = CargoProject::new(&RelPath::SOURCE, "cg_clif");
 
@@ -16,20 +17,15 @@ pub(crate) fn build_backend(
     let _group = LogGroup::guard("Build backend");
 
     let mut cmd = CG_CLIF.build(&bootstrap_host_compiler, dirs);
-    maybe_incremental(&mut cmd);
 
     let mut rustflags = rustflags_from_env("RUSTFLAGS");
 
     rustflags.push("-Zallow-features=rustc_private".to_owned());
 
-    if is_ci() {
-        // Deny warnings on CI
-        rustflags.push("-Dwarnings".to_owned());
-
-        if !is_ci_opt() {
-            cmd.env("CARGO_PROFILE_RELEASE_DEBUG_ASSERTIONS", "true");
-            cmd.env("CARGO_PROFILE_RELEASE_OVERFLOW_CHECKS", "true");
-        }
+    if env::var("CG_CLIF_EXPENSIVE_CHECKS").is_ok() {
+        // Enabling debug assertions implicitly enables the clif ir verifier
+        cmd.env("CARGO_PROFILE_RELEASE_DEBUG_ASSERTIONS", "true");
+        cmd.env("CARGO_PROFILE_RELEASE_OVERFLOW_CHECKS", "true");
     }
 
     if use_unstable_features {
diff --git a/compiler/rustc_codegen_cranelift/build_system/build_sysroot.rs b/compiler/rustc_codegen_cranelift/build_system/build_sysroot.rs
index 1ed896c6bf0..10c3f9cfa2c 100644
--- a/compiler/rustc_codegen_cranelift/build_system/build_sysroot.rs
+++ b/compiler/rustc_codegen_cranelift/build_system/build_sysroot.rs
@@ -6,8 +6,7 @@ use std::process::Command;
 use crate::path::{Dirs, RelPath};
 use crate::rustc_info::get_file_name;
 use crate::utils::{
-    maybe_incremental, remove_dir_if_exists, spawn_and_wait, try_hard_link, CargoProject, Compiler,
-    LogGroup,
+    remove_dir_if_exists, spawn_and_wait, try_hard_link, CargoProject, Compiler, LogGroup,
 };
 use crate::{config, CodegenBackend, SysrootKind};
 
@@ -270,7 +269,6 @@ fn build_clif_sysroot_for_triple(
     }
     compiler.rustflags.extend(rustflags);
     let mut build_cmd = STANDARD_LIBRARY.build(&compiler, dirs);
-    maybe_incremental(&mut build_cmd);
     if channel == "release" {
         build_cmd.arg("--release");
     }
diff --git a/compiler/rustc_codegen_cranelift/build_system/main.rs b/compiler/rustc_codegen_cranelift/build_system/main.rs
index e8cf486e966..cdd2bae03f8 100644
--- a/compiler/rustc_codegen_cranelift/build_system/main.rs
+++ b/compiler/rustc_codegen_cranelift/build_system/main.rs
@@ -6,7 +6,7 @@ use std::env;
 use std::path::PathBuf;
 use std::process;
 
-use self::utils::{is_ci, is_ci_opt, Compiler};
+use self::utils::Compiler;
 
 mod abi_cafe;
 mod bench;
@@ -60,14 +60,9 @@ fn main() {
     }
     env::set_var("CG_CLIF_DISABLE_INCR_CACHE", "1");
 
-    if is_ci() {
-        // Disabling incr comp reduces cache size and incr comp doesn't save as much on CI anyway
-        env::set_var("CARGO_BUILD_INCREMENTAL", "false");
-
-        if !is_ci_opt() {
-            // Enable the Cranelift verifier
-            env::set_var("CG_CLIF_ENABLE_VERIFIER", "1");
-        }
+    // Force incr comp even in release mode unless in CI or incremental builds are explicitly disabled
+    if env::var_os("CARGO_BUILD_INCREMENTAL").is_none() {
+        env::set_var("CARGO_BUILD_INCREMENTAL", "true");
     }
 
     let mut args = env::args().skip(1);
diff --git a/compiler/rustc_codegen_cranelift/build_system/prepare.rs b/compiler/rustc_codegen_cranelift/build_system/prepare.rs
index 3677d0a7d36..5525a5f63e9 100644
--- a/compiler/rustc_codegen_cranelift/build_system/prepare.rs
+++ b/compiler/rustc_codegen_cranelift/build_system/prepare.rs
@@ -15,7 +15,6 @@ pub(crate) fn prepare(dirs: &Dirs) {
     RelPath::DOWNLOAD.ensure_exists(dirs);
     crate::tests::RAND_REPO.fetch(dirs);
     crate::tests::REGEX_REPO.fetch(dirs);
-    crate::tests::PORTABLE_SIMD_REPO.fetch(dirs);
 }
 
 pub(crate) fn prepare_stdlib(dirs: &Dirs, rustc: &Path) {
diff --git a/compiler/rustc_codegen_cranelift/build_system/tests.rs b/compiler/rustc_codegen_cranelift/build_system/tests.rs
index 1c3e615c7ab..9efb6ed715c 100644
--- a/compiler/rustc_codegen_cranelift/build_system/tests.rs
+++ b/compiler/rustc_codegen_cranelift/build_system/tests.rs
@@ -130,16 +130,10 @@ pub(crate) static REGEX_REPO: GitRepo = GitRepo::github(
 
 pub(crate) static REGEX: CargoProject = CargoProject::new(&REGEX_REPO.source_dir(), "regex_target");
 
-pub(crate) static PORTABLE_SIMD_REPO: GitRepo = GitRepo::github(
-    "rust-lang",
-    "portable-simd",
-    "5794c837bc605c4cd9dbb884285976dfdb293cce",
-    "a64d8fdd0ed0d9c4",
-    "portable-simd",
-);
+pub(crate) static PORTABLE_SIMD_SRC: RelPath = RelPath::BUILD.join("coretests");
 
 pub(crate) static PORTABLE_SIMD: CargoProject =
-    CargoProject::new(&PORTABLE_SIMD_REPO.source_dir(), "portable-simd_target");
+    CargoProject::new(&PORTABLE_SIMD_SRC, "portable-simd_target");
 
 static LIBCORE_TESTS_SRC: RelPath = RelPath::BUILD.join("coretests");
 
@@ -221,7 +215,12 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
         }
     }),
     TestCase::custom("test.portable-simd", &|runner| {
-        PORTABLE_SIMD_REPO.patch(&runner.dirs);
+        apply_patches(
+            &runner.dirs,
+            "portable-simd",
+            &runner.stdlib_source.join("library/portable-simd"),
+            &PORTABLE_SIMD_SRC.to_path(&runner.dirs),
+        );
 
         PORTABLE_SIMD.clean(&runner.dirs);
 
diff --git a/compiler/rustc_codegen_cranelift/build_system/utils.rs b/compiler/rustc_codegen_cranelift/build_system/utils.rs
index 149f1618f5c..9f95122b341 100644
--- a/compiler/rustc_codegen_cranelift/build_system/utils.rs
+++ b/compiler/rustc_codegen_cranelift/build_system/utils.rs
@@ -254,14 +254,6 @@ pub(crate) fn copy_dir_recursively(from: &Path, to: &Path) {
     }
 }
 
-pub(crate) fn is_ci() -> bool {
-    env::var("CI").is_ok()
-}
-
-pub(crate) fn is_ci_opt() -> bool {
-    env::var("CI_OPT").is_ok()
-}
-
 static IN_GROUP: AtomicBool = AtomicBool::new(false);
 pub(crate) struct LogGroup {
     is_gha: bool,
@@ -288,13 +280,3 @@ impl Drop for LogGroup {
         IN_GROUP.store(false, Ordering::SeqCst);
     }
 }
-
-pub(crate) fn maybe_incremental(cmd: &mut Command) {
-    if is_ci() || std::env::var("CARGO_BUILD_INCREMENTAL").map_or(false, |val| val == "false") {
-        // Disabling incr comp reduces cache size and incr comp doesn't save as much on CI anyway
-        cmd.env("CARGO_BUILD_INCREMENTAL", "false");
-    } else {
-        // Force incr comp even in release mode unless in CI or incremental builds are explicitly disabled
-        cmd.env("CARGO_BUILD_INCREMENTAL", "true");
-    }
-}