Skip to content

Commit

Permalink
Auto merge of #67759 - nikic:llvm-10, r=<try>
Browse files Browse the repository at this point in the history
Update to LLVM 10

LLVM 10 is going to be branched soon, so it's a good time to start finding all those tasty new miscompiles and performance regressions ;)

Status:

 * Preparation split off into #67900.
 * Optimization regressions:
   * [x] https://bugs.llvm.org/show_bug.cgi?id=44419 => https://reviews.llvm.org/D72048 has landed.
   * [x] https://bugs.llvm.org/show_bug.cgi?id=44423 => https://reviews.llvm.org/D72060 has landed.
   * [ ] https://reviews.llvm.org/D72169 submitted.
   * [ ] https://bugs.llvm.org/show_bug.cgi?id=44461 reported. https://reviews.llvm.org/D72420 submitted, but unlikely eligible for LLVM 10.
 * Compile-time regressions:
   * [x] GlobalOpt regression identified. ~~fhahn proposed https://reviews.llvm.org/D72214.~~ fhahn has [reverted](llvm/llvm-project@192cce1) the patch.
   * [ ] Even with the revert, there are [large regressions](https://perf.rust-lang.org/compare.html?start=760ce94c69ca510d44087291c311296f6d9ccdf5&end=4e84f97d76e694bb9f59039f5bdeb6d8bca46d14).
 * Assertion failures / infinite loops:
   * [x] https://bugs.llvm.org/show_bug.cgi?id=44600 => https://reviews.llvm.org/D73135, https://reviews.llvm.org/D73854 and https://reviews.llvm.org/D73908 have landed and been cherry-picked to the 10.x branch.
   * [x] https://bugs.llvm.org/show_bug.cgi?id=44835 => https://reviews.llvm.org/D74278 has landed and been cherry-picked.

r? @ghost
  • Loading branch information
bors committed Mar 3, 2020
2 parents 9381e81 + aed9cf3 commit c6d0415
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
[submodule "src/llvm-project"]
path = src/llvm-project
url = https://github.com/rust-lang/llvm-project.git
branch = rustc/9.0-2019-12-19
branch = rustc/10.0-2020-02-05
[submodule "src/doc/embedded-book"]
path = src/doc/embedded-book
url = https://github.com/rust-embedded/book.git
2 changes: 2 additions & 0 deletions src/bootstrap/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1142,6 +1142,8 @@ impl Step for Compiletest {
let llvm_config = builder.ensure(native::Llvm { target: builder.config.build });
if !builder.config.dry_run {
let llvm_version = output(Command::new(&llvm_config).arg("--version"));
// Remove trailing newline from llvm-config output.
let llvm_version = llvm_version.trim_end();
cmd.arg("--llvm-version").arg(llvm_version);
}
if !builder.is_rust_llvm(target) {
Expand Down
2 changes: 1 addition & 1 deletion src/llvm-project
Submodule llvm-project updated 27771 files
6 changes: 5 additions & 1 deletion src/rustllvm/PassWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ extern "C" void LLVMInitializePasses() {
}

extern "C" void LLVMTimeTraceProfilerInitialize() {
#if LLVM_VERSION_GE(9, 0)
#if LLVM_VERSION_GE(10, 0)
timeTraceProfilerInitialize(
/* TimeTraceGranularity */ 0,
/* ProcName */ "rustc");
#elif LLVM_VERSION_GE(9, 0)
timeTraceProfilerInitialize();
#endif
}
Expand Down
5 changes: 5 additions & 0 deletions src/rustllvm/RustWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1300,8 +1300,13 @@ extern "C" LLVMValueRef LLVMRustBuildMemSet(LLVMBuilderRef B,
LLVMValueRef Dst, unsigned DstAlign,
LLVMValueRef Val,
LLVMValueRef Size, bool IsVolatile) {
#if LLVM_VERSION_GE(10, 0)
return wrap(unwrap(B)->CreateMemSet(
unwrap(Dst), unwrap(Val), unwrap(Size), MaybeAlign(DstAlign), IsVolatile));
#else
return wrap(unwrap(B)->CreateMemSet(
unwrap(Dst), unwrap(Val), unwrap(Size), DstAlign, IsVolatile));
#endif
}

extern "C" LLVMValueRef
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"data-layout": "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128",
"data-layout": "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:32-n8:16:32-S128",
"linker-flavor": "gcc",
"llvm-target": "i686-unknown-linux-gnu",
"target-endian": "little",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"pre-link-args": {"gcc": ["-m64"]},
"data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128",
"data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128",
"linker-flavor": "gcc",
"llvm-target": "x86_64-unknown-linux-gnu",
"target-endian": "little",
Expand Down
27 changes: 21 additions & 6 deletions src/tools/compiletest/src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ impl EarlyProps {
return true;
}
if let Some(ref actual_version) = config.llvm_version {
let actual_version = version_to_int(actual_version);
if line.starts_with("min-llvm-version") {
let min_version = line
.trim_end()
Expand All @@ -199,7 +200,7 @@ impl EarlyProps {
.expect("Malformed llvm version directive");
// Ignore if actual version is smaller the minimum required
// version
&actual_version[..] < min_version
actual_version < version_to_int(min_version)
} else if line.starts_with("min-system-llvm-version") {
let min_version = line
.trim_end()
Expand All @@ -208,7 +209,7 @@ impl EarlyProps {
.expect("Malformed llvm version directive");
// Ignore if using system LLVM and actual version
// is smaller the minimum required version
config.system_llvm && &actual_version[..] < min_version
config.system_llvm && actual_version < version_to_int(min_version)
} else if line.starts_with("ignore-llvm-version") {
// Syntax is: "ignore-llvm-version <version1> [- <version2>]"
let range_components = line
Expand All @@ -219,15 +220,15 @@ impl EarlyProps {
.take(3) // 3 or more = invalid, so take at most 3.
.collect::<Vec<&str>>();
match range_components.len() {
1 => &actual_version[..] == range_components[0],
1 => actual_version == version_to_int(range_components[0]),
2 => {
let v_min = range_components[0];
let v_max = range_components[1];
let v_min = version_to_int(range_components[0]);
let v_max = version_to_int(range_components[1]);
if v_max < v_min {
panic!("Malformed LLVM version range: max < min")
}
// Ignore if version lies inside of range.
&actual_version[..] >= v_min && &actual_version[..] <= v_max
actual_version >= v_min && actual_version <= v_max
}
_ => panic!("Malformed LLVM version directive"),
}
Expand All @@ -238,6 +239,20 @@ impl EarlyProps {
false
}
}

fn version_to_int(version: &str) -> u32 {
let version_without_suffix = version.split('-').next().unwrap();
let components: Vec<u32> = version_without_suffix
.split('.')
.map(|s| s.parse().expect("Malformed version component"))
.collect();
match components.len() {
1 => components[0] * 10000,
2 => components[0] * 10000 + components[1] * 100,
3 => components[0] * 10000 + components[1] * 100 + components[2],
_ => panic!("Malformed version"),
}
}
}
}

Expand Down

0 comments on commit c6d0415

Please sign in to comment.