Skip to content

Commit c6d0415

Browse files
committed
Auto merge of #67759 - nikic:llvm-10, r=<try>
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
2 parents 9381e81 + aed9cf3 commit c6d0415

File tree

8 files changed

+37
-11
lines changed

8 files changed

+37
-11
lines changed

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
[submodule "src/llvm-project"]
4141
path = src/llvm-project
4242
url = https://github.com/rust-lang/llvm-project.git
43-
branch = rustc/9.0-2019-12-19
43+
branch = rustc/10.0-2020-02-05
4444
[submodule "src/doc/embedded-book"]
4545
path = src/doc/embedded-book
4646
url = https://github.com/rust-embedded/book.git

src/bootstrap/test.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,6 +1142,8 @@ impl Step for Compiletest {
11421142
let llvm_config = builder.ensure(native::Llvm { target: builder.config.build });
11431143
if !builder.config.dry_run {
11441144
let llvm_version = output(Command::new(&llvm_config).arg("--version"));
1145+
// Remove trailing newline from llvm-config output.
1146+
let llvm_version = llvm_version.trim_end();
11451147
cmd.arg("--llvm-version").arg(llvm_version);
11461148
}
11471149
if !builder.is_rust_llvm(target) {

src/llvm-project

Submodule llvm-project updated 27771 files

src/rustllvm/PassWrapper.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,11 @@ extern "C" void LLVMInitializePasses() {
6767
}
6868

6969
extern "C" void LLVMTimeTraceProfilerInitialize() {
70-
#if LLVM_VERSION_GE(9, 0)
70+
#if LLVM_VERSION_GE(10, 0)
71+
timeTraceProfilerInitialize(
72+
/* TimeTraceGranularity */ 0,
73+
/* ProcName */ "rustc");
74+
#elif LLVM_VERSION_GE(9, 0)
7175
timeTraceProfilerInitialize();
7276
#endif
7377
}

src/rustllvm/RustWrapper.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1300,8 +1300,13 @@ extern "C" LLVMValueRef LLVMRustBuildMemSet(LLVMBuilderRef B,
13001300
LLVMValueRef Dst, unsigned DstAlign,
13011301
LLVMValueRef Val,
13021302
LLVMValueRef Size, bool IsVolatile) {
1303+
#if LLVM_VERSION_GE(10, 0)
1304+
return wrap(unwrap(B)->CreateMemSet(
1305+
unwrap(Dst), unwrap(Val), unwrap(Size), MaybeAlign(DstAlign), IsVolatile));
1306+
#else
13031307
return wrap(unwrap(B)->CreateMemSet(
13041308
unwrap(Dst), unwrap(Val), unwrap(Size), DstAlign, IsVolatile));
1309+
#endif
13051310
}
13061311

13071312
extern "C" LLVMValueRef

src/test/run-make-fulldeps/target-specs/my-awesome-platform.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"data-layout": "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128",
2+
"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",
33
"linker-flavor": "gcc",
44
"llvm-target": "i686-unknown-linux-gnu",
55
"target-endian": "little",

src/test/run-make-fulldeps/target-specs/my-x86_64-unknown-linux-gnu-platform.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"pre-link-args": {"gcc": ["-m64"]},
3-
"data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128",
3+
"data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128",
44
"linker-flavor": "gcc",
55
"llvm-target": "x86_64-unknown-linux-gnu",
66
"target-endian": "little",

src/tools/compiletest/src/header.rs

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ impl EarlyProps {
191191
return true;
192192
}
193193
if let Some(ref actual_version) = config.llvm_version {
194+
let actual_version = version_to_int(actual_version);
194195
if line.starts_with("min-llvm-version") {
195196
let min_version = line
196197
.trim_end()
@@ -199,7 +200,7 @@ impl EarlyProps {
199200
.expect("Malformed llvm version directive");
200201
// Ignore if actual version is smaller the minimum required
201202
// version
202-
&actual_version[..] < min_version
203+
actual_version < version_to_int(min_version)
203204
} else if line.starts_with("min-system-llvm-version") {
204205
let min_version = line
205206
.trim_end()
@@ -208,7 +209,7 @@ impl EarlyProps {
208209
.expect("Malformed llvm version directive");
209210
// Ignore if using system LLVM and actual version
210211
// is smaller the minimum required version
211-
config.system_llvm && &actual_version[..] < min_version
212+
config.system_llvm && actual_version < version_to_int(min_version)
212213
} else if line.starts_with("ignore-llvm-version") {
213214
// Syntax is: "ignore-llvm-version <version1> [- <version2>]"
214215
let range_components = line
@@ -219,15 +220,15 @@ impl EarlyProps {
219220
.take(3) // 3 or more = invalid, so take at most 3.
220221
.collect::<Vec<&str>>();
221222
match range_components.len() {
222-
1 => &actual_version[..] == range_components[0],
223+
1 => actual_version == version_to_int(range_components[0]),
223224
2 => {
224-
let v_min = range_components[0];
225-
let v_max = range_components[1];
225+
let v_min = version_to_int(range_components[0]);
226+
let v_max = version_to_int(range_components[1]);
226227
if v_max < v_min {
227228
panic!("Malformed LLVM version range: max < min")
228229
}
229230
// Ignore if version lies inside of range.
230-
&actual_version[..] >= v_min && &actual_version[..] <= v_max
231+
actual_version >= v_min && actual_version <= v_max
231232
}
232233
_ => panic!("Malformed LLVM version directive"),
233234
}
@@ -238,6 +239,20 @@ impl EarlyProps {
238239
false
239240
}
240241
}
242+
243+
fn version_to_int(version: &str) -> u32 {
244+
let version_without_suffix = version.split('-').next().unwrap();
245+
let components: Vec<u32> = version_without_suffix
246+
.split('.')
247+
.map(|s| s.parse().expect("Malformed version component"))
248+
.collect();
249+
match components.len() {
250+
1 => components[0] * 10000,
251+
2 => components[0] * 10000 + components[1] * 100,
252+
3 => components[0] * 10000 + components[1] * 100 + components[2],
253+
_ => panic!("Malformed version"),
254+
}
255+
}
241256
}
242257
}
243258

0 commit comments

Comments
 (0)