From 8938269db63bf1f9c0f17f3c2c39d3449b4d652e Mon Sep 17 00:00:00 2001 From: Simonas Kazlauskas Date: Sat, 3 Jun 2017 15:07:57 +0300 Subject: [PATCH 1/2] Upgrade LLVM Includes /~https://github.com/rust-lang/llvm/pull/80 Includes /~https://github.com/rust-lang/llvm/pull/79 Also adds tests and thus fixes #24194 --- src/llvm | 2 +- src/rustllvm/llvm-rebuild-trigger | 2 +- src/test/codegen/alloc-optimisation.rs | 28 ++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 src/test/codegen/alloc-optimisation.rs diff --git a/src/llvm b/src/llvm index 1ef3b9128e1ba..84c52ce9b75d8 160000 --- a/src/llvm +++ b/src/llvm @@ -1 +1 @@ -Subproject commit 1ef3b9128e1baaed61b42d5b0de79dee100acf17 +Subproject commit 84c52ce9b75d841629e6f821b3794998fb0ddbd9 diff --git a/src/rustllvm/llvm-rebuild-trigger b/src/rustllvm/llvm-rebuild-trigger index 70663f30e8f9e..b2746bb6e68a6 100644 --- a/src/rustllvm/llvm-rebuild-trigger +++ b/src/rustllvm/llvm-rebuild-trigger @@ -1,4 +1,4 @@ # If this file is modified, then llvm will be (optionally) cleaned and then rebuilt. # The actual contents of this file do not matter, but to trigger a change on the # build bots then the contents should be changed so git updates the mtime. -2017-05-13 +2017-06-03 diff --git a/src/test/codegen/alloc-optimisation.rs b/src/test/codegen/alloc-optimisation.rs new file mode 100644 index 0000000000000..3953f637cf7a2 --- /dev/null +++ b/src/test/codegen/alloc-optimisation.rs @@ -0,0 +1,28 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +#![crate_type="lib"] + +#[no_mangle] +pub fn alloc_zeroed_test(size: u8) { + // CHECK-LABEL: @alloc_zeroed_test + // CHECK-NEXT: start: + // CHECK-NEXT: ret void + let x = vec![0u8; size as usize]; + drop(x); +} + +#[no_mangle] +pub fn alloc_test(data: u32) { + // CHECK-LABEL: @alloc_test + // CHECK-NEXT: start: + // CHECK-NEXT: ret void + let x = Box::new(data); + drop(x); +} From 406eddf5e1e14b9356b332c0df987a1bdf0d2c7f Mon Sep 17 00:00:00 2001 From: Simonas Kazlauskas Date: Thu, 8 Jun 2017 17:18:05 +0300 Subject: [PATCH 2/2] Add a no-system-llvm compilecheck header --- src/bootstrap/check.rs | 3 +++ src/llvm | 2 +- src/test/codegen/alloc-optimisation.rs | 12 +++--------- src/tools/compiletest/src/common.rs | 3 +++ src/tools/compiletest/src/header.rs | 3 +++ src/tools/compiletest/src/main.rs | 2 ++ 6 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs index 385376333c1d7..b45849972b075 100644 --- a/src/bootstrap/check.rs +++ b/src/bootstrap/check.rs @@ -245,6 +245,9 @@ pub fn compiletest(build: &Build, let llvm_config = build.llvm_config(target); let llvm_version = output(Command::new(&llvm_config).arg("--version")); cmd.arg("--llvm-version").arg(llvm_version); + if !build.is_rust_llvm(target) { + cmd.arg("--system-llvm"); + } cmd.args(&build.flags.cmd.test_args()); diff --git a/src/llvm b/src/llvm index 84c52ce9b75d8..ee545e1d13e6f 160000 --- a/src/llvm +++ b/src/llvm @@ -1 +1 @@ -Subproject commit 84c52ce9b75d841629e6f821b3794998fb0ddbd9 +Subproject commit ee545e1d13e6f2191572aebcadb7d1640ce45c65 diff --git a/src/test/codegen/alloc-optimisation.rs b/src/test/codegen/alloc-optimisation.rs index 3953f637cf7a2..07dc1350714b6 100644 --- a/src/test/codegen/alloc-optimisation.rs +++ b/src/test/codegen/alloc-optimisation.rs @@ -7,17 +7,11 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. +// +// no-system-llvm +// compile-flags: -O #![crate_type="lib"] -#[no_mangle] -pub fn alloc_zeroed_test(size: u8) { - // CHECK-LABEL: @alloc_zeroed_test - // CHECK-NEXT: start: - // CHECK-NEXT: ret void - let x = vec![0u8; size as usize]; - drop(x); -} - #[no_mangle] pub fn alloc_test(data: u32) { // CHECK-LABEL: @alloc_test diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index 92f6f36d69d99..cc95e1b893052 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -166,6 +166,9 @@ pub struct Config { // Version of LLVM pub llvm_version: Option, + // Is LLVM a system LLVM + pub system_llvm: bool, + // Path to the android tools pub android_cross_path: PathBuf, diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index c503ca7d8cd14..aa33580b337c8 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -166,6 +166,9 @@ impl EarlyProps { } fn ignore_llvm(config: &Config, line: &str) -> bool { + if config.system_llvm && line.starts_with("no-system-llvm") { + return true; + } if let Some(ref actual_version) = config.llvm_version { if line.starts_with("min-llvm-version") { let min_version = line.trim_right() diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs index 1bb0b765f9f1c..3dac580a5f4b4 100644 --- a/src/tools/compiletest/src/main.rs +++ b/src/tools/compiletest/src/main.rs @@ -97,6 +97,7 @@ pub fn parse_config(args: Vec ) -> Config { optopt("", "gdb", "path to GDB to use for GDB debuginfo tests", "PATH"), optopt("", "lldb-version", "the version of LLDB used", "VERSION STRING"), optopt("", "llvm-version", "the version of LLVM used", "VERSION STRING"), + optflag("", "system-llvm", "is LLVM the system LLVM"), optopt("", "android-cross-path", "Android NDK standalone path", "PATH"), optopt("", "adb-path", "path to the android debugger", "PATH"), optopt("", "adb-test-dir", "path to tests for the android debugger", "PATH"), @@ -183,6 +184,7 @@ pub fn parse_config(args: Vec ) -> Config { gdb_native_rust: gdb_native_rust, lldb_version: extract_lldb_version(matches.opt_str("lldb-version")), llvm_version: matches.opt_str("llvm-version"), + system_llvm: matches.opt_present("system-llvm"), android_cross_path: opt_path(matches, "android-cross-path"), adb_path: opt_str2(matches.opt_str("adb-path")), adb_test_dir: opt_str2(matches.opt_str("adb-test-dir")),