Skip to content

Commit 30b3f35

Browse files
committed
Auto merge of #93577 - nikic:llvm-14, r=nagisa
Upgrade to LLVM 14 LLVM patch state: * [x] llvm/llvm-project@a55727f Backported. * [x] rust-lang/llvm-project@c3c82dc Backported as llvm/llvm-project@917c47b. * [x] rust-lang/llvm-project@6e8f9ab No plan to upstream. * [x] llvm/llvm-project@319f4b2 Backported. * [x] rust-lang/llvm-project@8b2c25d No plan to upstream. * [x] rust-lang/llvm-project@75fef2e No plan to upstream. * [ ] rust-lang/llvm-project@adef757 Upstreamed as llvm/llvm-project@2d2ef38. Needs backport. * [x] rust-lang/llvm-project@4b7c1b4 No plan to upstream. * [x] rust-lang/llvm-project@3f5ab0c No plan to upstream. * [x] rust-lang/llvm-project@514d055 No plan to upstream. * [ ] rust-lang/llvm-project@54c5869 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`
2 parents 582b696 + 75636bb commit 30b3f35

13 files changed

+54
-30
lines changed

.gitmodules

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
[submodule "src/llvm-project"]
3535
path = src/llvm-project
3636
url = https://github.com/rust-lang/llvm-project.git
37-
branch = rustc/13.0-2021-09-30
37+
branch = rustc/14.0-2022-02-09
3838
[submodule "src/doc/embedded-book"]
3939
path = src/doc/embedded-book
4040
url = https://github.com/rust-embedded/book.git

Cargo.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -740,9 +740,9 @@ dependencies = [
740740

741741
[[package]]
742742
name = "compiler_builtins"
743-
version = "0.1.69"
743+
version = "0.1.70"
744744
source = "registry+https://github.com/rust-lang/crates.io-index"
745-
checksum = "ac0d1d6b2307c15fd27af2bb41234b4ebddeae69f33714bfbdb44b3b5a6e3efe"
745+
checksum = "80873f979f0a344a4ade87c2f70d9ccf5720b83b10c97ec7cd745895d021e85a"
746746
dependencies = [
747747
"cc",
748748
"rustc-std-workspace-core",

compiler/rustc_codegen_llvm/src/context.rs

+14-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ pub unsafe fn create_module<'ll>(
135135
let llmod = llvm::LLVMModuleCreateWithNameInContext(mod_name.as_ptr(), llcx);
136136

137137
let mut target_data_layout = sess.target.data_layout.clone();
138-
if llvm_util::get_version() < (13, 0, 0) {
138+
let llvm_version = llvm_util::get_version();
139+
if llvm_version < (13, 0, 0) {
139140
if sess.target.arch == "powerpc64" {
140141
target_data_layout = target_data_layout.replace("-S128", "");
141142
}
@@ -146,6 +147,18 @@ pub unsafe fn create_module<'ll>(
146147
target_data_layout = "e-m:e-p:64:64-i64:64-n32:64-S128".to_string();
147148
}
148149
}
150+
if llvm_version < (14, 0, 0) {
151+
if sess.target.llvm_target == "i686-pc-windows-msvc"
152+
|| sess.target.llvm_target == "i586-pc-windows-msvc"
153+
{
154+
target_data_layout =
155+
"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"
156+
.to_string();
157+
}
158+
if sess.target.arch == "wasm32" {
159+
target_data_layout = target_data_layout.replace("-p10:8:8-p20:8:8", "");
160+
}
161+
}
149162

150163
// Ensure the data-layout values hardcoded remain the defaults.
151164
if sess.target.is_builtin {

compiler/rustc_codegen_llvm/src/llvm_util.rs

+24-16
Original file line numberDiff line numberDiff line change
@@ -217,24 +217,32 @@ pub fn check_tied_features(
217217

218218
pub fn target_features(sess: &Session) -> Vec<Symbol> {
219219
let target_machine = create_informational_target_machine(sess);
220-
supported_target_features(sess)
221-
.iter()
222-
.filter_map(
223-
|&(feature, gate)| {
220+
let mut features: Vec<Symbol> =
221+
supported_target_features(sess)
222+
.iter()
223+
.filter_map(|&(feature, gate)| {
224224
if sess.is_nightly_build() || gate.is_none() { Some(feature) } else { None }
225-
},
226-
)
227-
.filter(|feature| {
228-
for llvm_feature in to_llvm_feature(sess, feature) {
229-
let cstr = CString::new(llvm_feature).unwrap();
230-
if unsafe { llvm::LLVMRustHasFeature(target_machine, cstr.as_ptr()) } {
231-
return true;
225+
})
226+
.filter(|feature| {
227+
for llvm_feature in to_llvm_feature(sess, feature) {
228+
let cstr = CString::new(llvm_feature).unwrap();
229+
if unsafe { llvm::LLVMRustHasFeature(target_machine, cstr.as_ptr()) } {
230+
return true;
231+
}
232232
}
233-
}
234-
false
235-
})
236-
.map(|feature| Symbol::intern(feature))
237-
.collect()
233+
false
234+
})
235+
.map(|feature| Symbol::intern(feature))
236+
.collect();
237+
238+
// LLVM 14 changed the ABI for i128 arguments to __float/__fix builtins on Win64
239+
// (see https://reviews.llvm.org/D110413). This unstable target feature is intended for use
240+
// by compiler-builtins, to export the builtins with the expected, LLVM-version-dependent ABI.
241+
// The target feature can be dropped once we no longer support older LLVM versions.
242+
if sess.is_nightly_build() && get_version() >= (14, 0, 0) {
243+
features.push(Symbol::intern("llvm14-builtins-abi"));
244+
}
245+
features
238246
}
239247

240248
pub fn print_version() {

compiler/rustc_target/src/spec/i686_pc_windows_msvc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub fn target() -> Target {
2424
llvm_target: "i686-pc-windows-msvc".to_string(),
2525
pointer_width: 32,
2626
data_layout: "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
27-
i64:64-f80:32-n8:16:32-a:0:32-S32"
27+
i64:64-f80:128-n8:16:32-a:0:32-S32"
2828
.to_string(),
2929
arch: "x86".to_string(),
3030
options: base,

compiler/rustc_target/src/spec/i686_uwp_windows_msvc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub fn target() -> Target {
99
llvm_target: "i686-pc-windows-msvc".to_string(),
1010
pointer_width: 32,
1111
data_layout: "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
12-
i64:64-f80:32-n8:16:32-a:0:32-S32"
12+
i64:64-f80:128-n8:16:32-a:0:32-S32"
1313
.to_string(),
1414
arch: "x86".to_string(),
1515
options: base,

compiler/rustc_target/src/spec/wasm32_unknown_emscripten.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ pub fn target() -> Target {
4343
Target {
4444
llvm_target: "wasm32-unknown-emscripten".to_string(),
4545
pointer_width: 32,
46-
data_layout: "e-m:e-p:32:32-i64:64-f128:64-n32:64-S128-ni:1:10:20".to_string(),
46+
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"
47+
.to_string(),
4748
arch: "wasm32".to_string(),
4849
options: opts,
4950
}

compiler/rustc_target/src/spec/wasm32_unknown_unknown.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ pub fn target() -> Target {
5454
Target {
5555
llvm_target: "wasm32-unknown-unknown".to_string(),
5656
pointer_width: 32,
57-
data_layout: "e-m:e-p:32:32-i64:64-n32:64-S128-ni:1:10:20".to_string(),
57+
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(),
5858
arch: "wasm32".to_string(),
5959
options,
6060
}

compiler/rustc_target/src/spec/wasm32_wasi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ pub fn target() -> Target {
109109
Target {
110110
llvm_target: "wasm32-wasi".to_string(),
111111
pointer_width: 32,
112-
data_layout: "e-m:e-p:32:32-i64:64-n32:64-S128-ni:1:10:20".to_string(),
112+
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(),
113113
arch: "wasm32".to_string(),
114114
options,
115115
}

src/bootstrap/dist.rs

+2
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,8 @@ fn copy_src_dirs(
734734
"llvm-project\\llvm",
735735
"llvm-project/compiler-rt",
736736
"llvm-project\\compiler-rt",
737+
"llvm-project/cmake",
738+
"llvm-project\\cmake",
737739
];
738740
if spath.contains("llvm-project")
739741
&& !spath.ends_with("llvm-project")

src/llvm-project

src/test/run-make-fulldeps/coverage-llvmir/filecheck.testprog.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ CHECK: @__profc__R{{[a-zA-Z0-9_]+}}testprog14will_be_called = {{private|i
1515
CHECK-SAME: section "[[INSTR_PROF_CNTS]]"{{.*}}, align 8
1616

1717
CHECK: @__profd__R{{[a-zA-Z0-9_]+}}testprog14will_be_called = {{private|internal}} global
18-
CHECK-SAME: @__profc__R{{[a-zA-Z0-9_]+}}testprog14will_be_called,
18+
CHECK-SAME: @__profc__R{{[a-zA-Z0-9_]+}}testprog14will_be_called
1919
CHECK-SAME: section "[[INSTR_PROF_DATA]]"{{.*}}, align 8
2020

2121
CHECK: @__profc__R{{[a-zA-Z0-9_]+}}testprog4main = {{private|internal}} global
2222
CHECK-SAME: section "[[INSTR_PROF_CNTS]]"{{.*}}, align 8
2323

2424
CHECK: @__profd__R{{[a-zA-Z0-9_]+}}testprog4main = {{private|internal}} global
25-
CHECK-SAME: @__profc__R{{[a-zA-Z0-9_]+}}testprog4main,
25+
CHECK-SAME: @__profc__R{{[a-zA-Z0-9_]+}}testprog4main
2626
CHECK-SAME: section "[[INSTR_PROF_DATA]]"{{.*}}, align 8
2727

2828
CHECK: @__llvm_prf_nm = private constant

src/test/ui/optimization-remark.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// build-pass
22
// ignore-pass
3-
// no-system-llvm
3+
// min-llvm-version: 14.0.0
44
// revisions: all inline merge1 merge2
55
// compile-flags: --crate-type=lib -Cdebuginfo=1 -Copt-level=2
66
//
@@ -14,7 +14,7 @@
1414
// [merge1] compile-flags: -Cremark=all -Cremark=giraffe
1515
// [merge2] compile-flags: -Cremark=inline -Cremark=giraffe
1616
//
17-
// error-pattern: inline: f not inlined into g
17+
// error-pattern: inline: 'f' not inlined into 'g'
1818
// dont-check-compiler-stderr
1919

2020
#[no_mangle]

0 commit comments

Comments
 (0)