Auto merge of #93577 - nikic:llvm-14, r=nagisa

Upgrade to LLVM 14

LLVM patch state:
 * [x] a55727f334 Backported.
 * [x] c3c82dc124 Backported as 917c47b3bf.
 * [x] 6e8f9ab632 No plan to upstream.
 * [x] 319f4b2d52 Backported.
 * [x] 8b2c25d321 No plan to upstream.
 * [x] 75fef2efd4 No plan to upstream.
 * [ ] adef757547 Upstreamed as 2d2ef384b2. Needs backport.
 * [x] 4b7c1b4910 No plan to upstream.
 * [x] 3f5ab0c061 No plan to upstream.
 * [x] 514d05500e No plan to upstream.
 * [ ] 54c5869585 Under review at https://reviews.llvm.org/D119695 and https://reviews.llvm.org/D119856.

Release timeline:
 * LLVM 14.0.0 final planned for Mar 15.
 * Rust 1.60.0 planned for Apr 7.

Compile-time:
  * https://perf.rust-lang.org/compare.html?start=250384edc5d78533e993f38c60d64e42b21684b2&end=b87df8d2c7c5d9ac448c585de10927ab2ee1b864
  * A slight improvement on average, though no big changes either way.
  * There are some larger max-rss improvements.

r? `@ghost`
This commit is contained in:
bors 2022-02-17 13:08:46 +00:00
commit 30b3f35c42
13 changed files with 54 additions and 30 deletions

2
.gitmodules vendored
View File

@ -34,7 +34,7 @@
[submodule "src/llvm-project"]
path = src/llvm-project
url = https://github.com/rust-lang/llvm-project.git
branch = rustc/13.0-2021-09-30
branch = rustc/14.0-2022-02-09
[submodule "src/doc/embedded-book"]
path = src/doc/embedded-book
url = https://github.com/rust-embedded/book.git

View File

@ -740,9 +740,9 @@ dependencies = [
[[package]]
name = "compiler_builtins"
version = "0.1.69"
version = "0.1.70"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac0d1d6b2307c15fd27af2bb41234b4ebddeae69f33714bfbdb44b3b5a6e3efe"
checksum = "80873f979f0a344a4ade87c2f70d9ccf5720b83b10c97ec7cd745895d021e85a"
dependencies = [
"cc",
"rustc-std-workspace-core",

View File

@ -135,7 +135,8 @@ pub unsafe fn create_module<'ll>(
let llmod = llvm::LLVMModuleCreateWithNameInContext(mod_name.as_ptr(), llcx);
let mut target_data_layout = sess.target.data_layout.clone();
if llvm_util::get_version() < (13, 0, 0) {
let llvm_version = llvm_util::get_version();
if llvm_version < (13, 0, 0) {
if sess.target.arch == "powerpc64" {
target_data_layout = target_data_layout.replace("-S128", "");
}
@ -146,6 +147,18 @@ pub unsafe fn create_module<'ll>(
target_data_layout = "e-m:e-p:64:64-i64:64-n32:64-S128".to_string();
}
}
if llvm_version < (14, 0, 0) {
if sess.target.llvm_target == "i686-pc-windows-msvc"
|| sess.target.llvm_target == "i586-pc-windows-msvc"
{
target_data_layout =
"e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:32-n8:16:32-a:0:32-S32"
.to_string();
}
if sess.target.arch == "wasm32" {
target_data_layout = target_data_layout.replace("-p10:8:8-p20:8:8", "");
}
}
// Ensure the data-layout values hardcoded remain the defaults.
if sess.target.is_builtin {

View File

@ -217,24 +217,32 @@ pub fn check_tied_features(
pub fn target_features(sess: &Session) -> Vec<Symbol> {
let target_machine = create_informational_target_machine(sess);
supported_target_features(sess)
.iter()
.filter_map(
|&(feature, gate)| {
let mut features: Vec<Symbol> =
supported_target_features(sess)
.iter()
.filter_map(|&(feature, gate)| {
if sess.is_nightly_build() || gate.is_none() { Some(feature) } else { None }
},
)
.filter(|feature| {
for llvm_feature in to_llvm_feature(sess, feature) {
let cstr = CString::new(llvm_feature).unwrap();
if unsafe { llvm::LLVMRustHasFeature(target_machine, cstr.as_ptr()) } {
return true;
})
.filter(|feature| {
for llvm_feature in to_llvm_feature(sess, feature) {
let cstr = CString::new(llvm_feature).unwrap();
if unsafe { llvm::LLVMRustHasFeature(target_machine, cstr.as_ptr()) } {
return true;
}
}
}
false
})
.map(|feature| Symbol::intern(feature))
.collect()
false
})
.map(|feature| Symbol::intern(feature))
.collect();
// LLVM 14 changed the ABI for i128 arguments to __float/__fix builtins on Win64
// (see https://reviews.llvm.org/D110413). This unstable target feature is intended for use
// by compiler-builtins, to export the builtins with the expected, LLVM-version-dependent ABI.
// The target feature can be dropped once we no longer support older LLVM versions.
if sess.is_nightly_build() && get_version() >= (14, 0, 0) {
features.push(Symbol::intern("llvm14-builtins-abi"));
}
features
}
pub fn print_version() {

View File

@ -24,7 +24,7 @@ pub fn target() -> Target {
llvm_target: "i686-pc-windows-msvc".to_string(),
pointer_width: 32,
data_layout: "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
i64:64-f80:32-n8:16:32-a:0:32-S32"
i64:64-f80:128-n8:16:32-a:0:32-S32"
.to_string(),
arch: "x86".to_string(),
options: base,

View File

@ -9,7 +9,7 @@ pub fn target() -> Target {
llvm_target: "i686-pc-windows-msvc".to_string(),
pointer_width: 32,
data_layout: "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
i64:64-f80:32-n8:16:32-a:0:32-S32"
i64:64-f80:128-n8:16:32-a:0:32-S32"
.to_string(),
arch: "x86".to_string(),
options: base,

View File

@ -43,7 +43,8 @@ pub fn target() -> Target {
Target {
llvm_target: "wasm32-unknown-emscripten".to_string(),
pointer_width: 32,
data_layout: "e-m:e-p:32:32-i64:64-f128:64-n32:64-S128-ni:1:10:20".to_string(),
data_layout: "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-f128:64-n32:64-S128-ni:1:10:20"
.to_string(),
arch: "wasm32".to_string(),
options: opts,
}

View File

@ -54,7 +54,7 @@ pub fn target() -> Target {
Target {
llvm_target: "wasm32-unknown-unknown".to_string(),
pointer_width: 32,
data_layout: "e-m:e-p:32:32-i64:64-n32:64-S128-ni:1:10:20".to_string(),
data_layout: "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-n32:64-S128-ni:1:10:20".to_string(),
arch: "wasm32".to_string(),
options,
}

View File

@ -109,7 +109,7 @@ pub fn target() -> Target {
Target {
llvm_target: "wasm32-wasi".to_string(),
pointer_width: 32,
data_layout: "e-m:e-p:32:32-i64:64-n32:64-S128-ni:1:10:20".to_string(),
data_layout: "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-n32:64-S128-ni:1:10:20".to_string(),
arch: "wasm32".to_string(),
options,
}

View File

@ -734,6 +734,8 @@ fn copy_src_dirs(
"llvm-project\\llvm",
"llvm-project/compiler-rt",
"llvm-project\\compiler-rt",
"llvm-project/cmake",
"llvm-project\\cmake",
];
if spath.contains("llvm-project")
&& !spath.ends_with("llvm-project")

@ -1 +1 @@
Subproject commit fdc8f411ec9253d4eeb7a572b058be4f2131fd1c
Subproject commit e29ac13bc97e26f886c3bfe72f9135e994c3cd0a

View File

@ -15,14 +15,14 @@ CHECK: @__profc__R{{[a-zA-Z0-9_]+}}testprog14will_be_called = {{private|i
CHECK-SAME: section "[[INSTR_PROF_CNTS]]"{{.*}}, align 8
CHECK: @__profd__R{{[a-zA-Z0-9_]+}}testprog14will_be_called = {{private|internal}} global
CHECK-SAME: @__profc__R{{[a-zA-Z0-9_]+}}testprog14will_be_called,
CHECK-SAME: @__profc__R{{[a-zA-Z0-9_]+}}testprog14will_be_called
CHECK-SAME: section "[[INSTR_PROF_DATA]]"{{.*}}, align 8
CHECK: @__profc__R{{[a-zA-Z0-9_]+}}testprog4main = {{private|internal}} global
CHECK-SAME: section "[[INSTR_PROF_CNTS]]"{{.*}}, align 8
CHECK: @__profd__R{{[a-zA-Z0-9_]+}}testprog4main = {{private|internal}} global
CHECK-SAME: @__profc__R{{[a-zA-Z0-9_]+}}testprog4main,
CHECK-SAME: @__profc__R{{[a-zA-Z0-9_]+}}testprog4main
CHECK-SAME: section "[[INSTR_PROF_DATA]]"{{.*}}, align 8
CHECK: @__llvm_prf_nm = private constant

View File

@ -1,6 +1,6 @@
// build-pass
// ignore-pass
// no-system-llvm
// min-llvm-version: 14.0.0
// revisions: all inline merge1 merge2
// compile-flags: --crate-type=lib -Cdebuginfo=1 -Copt-level=2
//
@ -14,7 +14,7 @@
// [merge1] compile-flags: -Cremark=all -Cremark=giraffe
// [merge2] compile-flags: -Cremark=inline -Cremark=giraffe
//
// error-pattern: inline: f not inlined into g
// error-pattern: inline: 'f' not inlined into 'g'
// dont-check-compiler-stderr
#[no_mangle]