about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-07-11 12:12:13 +0000
committerbors <bors@rust-lang.org>2018-07-11 12:12:13 +0000
commit11432ba98043ee0ade961bdedb4b785bf06c086e (patch)
treefa90a01c30de78430012adcf37f54c2d55ea5462 /src/bootstrap
parent989fa053895a27fd40896335224b619843b7e58a (diff)
parent3f18a41333aabf515d6d343c07f3bbbd154f6018 (diff)
downloadrust-11432ba98043ee0ade961bdedb4b785bf06c086e.tar.gz
rust-11432ba98043ee0ade961bdedb4b785bf06c086e.zip
Auto merge of #51230 - nikic:no-verify-lto, r=pnkfelix
Disable LLVM verification by default

Currently -Z no-verify only controls IR verification prior to LLVM codegen, while verification is performed unconditionally both before and after linking with (Thin)LTO.

Also wondering what the sentiment is on disabling verification by default (and e.g. only enabling it on ALT builds with assertions). This does not seem terribly useful outside of rustc development and it does seem to show up in profiles (at something like 3%).

**EDIT:** A table showing the various configurations and what is enabled when.

| Configuration | Dynamic verification performed | LLVM static assertions compiled in |
| --- | --- | --- |
| alt builds | | yes |
| nightly builds | | no |
| stable builds | | no |
| CI builds | | |
| dev builds in a checkout | | |
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/bin/rustc.rs4
-rw-r--r--src/bootstrap/builder.rs4
-rw-r--r--src/bootstrap/config.rs3
3 files changed, 11 insertions, 0 deletions
diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs
index 4607ca5cf9f..e81595a8c62 100644
--- a/src/bootstrap/bin/rustc.rs
+++ b/src/bootstrap/bin/rustc.rs
@@ -283,6 +283,10 @@ fn main() {
         cmd.arg("--cfg").arg("parallel_queries");
     }
 
+    if env::var_os("RUSTC_VERIFY_LLVM_IR").is_some() {
+        cmd.arg("-Z").arg("verify-llvm-ir");
+    }
+
     let color = match env::var("RUSTC_COLOR") {
         Ok(s) => usize::from_str(&s).expect("RUSTC_COLOR should be an integer"),
         Err(_) => 0,
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index fad0a553802..6c3a476d084 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -922,6 +922,10 @@ impl<'a> Builder<'a> {
             cargo.env("RUSTC_BACKTRACE_ON_ICE", "1");
         }
 
+        if self.config.rust_verify_llvm_ir {
+            cargo.env("RUSTC_VERIFY_LLVM_IR", "1");
+        }
+
         cargo.env("RUSTC_VERBOSE", format!("{}", self.verbosity));
 
         // in std, we want to avoid denying warnings for stage 0 as that makes cfg's painful.
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index b3ed10257bd..420ae1f349c 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -105,6 +105,7 @@ pub struct Config {
     pub rust_dist_src: bool,
     pub rust_codegen_backends: Vec<Interned<String>>,
     pub rust_codegen_backends_dir: String,
+    pub rust_verify_llvm_ir: bool,
 
     pub build: Interned<String>,
     pub hosts: Vec<Interned<String>>,
@@ -312,6 +313,7 @@ struct Rust {
     llvm_tools: Option<bool>,
     deny_warnings: Option<bool>,
     backtrace_on_ice: Option<bool>,
+    verify_llvm_ir: Option<bool>,
 }
 
 /// TOML representation of how each build target is configured.
@@ -543,6 +545,7 @@ impl Config {
             config.save_toolstates = rust.save_toolstates.clone().map(PathBuf::from);
             set(&mut config.deny_warnings, rust.deny_warnings.or(flags.warnings));
             set(&mut config.backtrace_on_ice, rust.backtrace_on_ice);
+            set(&mut config.rust_verify_llvm_ir, rust.verify_llvm_ir);
 
             if let Some(ref backends) = rust.codegen_backends {
                 config.rust_codegen_backends = backends.iter()