Rollup merge of #107573 - cuviper:drop-llvm-13, r=nagisa

Update the minimum external LLVM to 14

With this change, we'll have stable support for LLVM 14 through 16 (pending release).
For reference, the previous increase to LLVM 13 was #100460.
This commit is contained in:
Matthias Krüger 2023-02-14 18:24:40 +01:00 committed by GitHub
commit a1ba861190
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
44 changed files with 58 additions and 218 deletions

View File

@ -54,7 +54,7 @@ jobs:
tidy: true tidy: true
os: ubuntu-20.04-xl os: ubuntu-20.04-xl
env: {} env: {}
- name: x86_64-gnu-llvm-13 - name: x86_64-gnu-llvm-14
tidy: false tidy: false
os: ubuntu-20.04-xl os: ubuntu-20.04-xl
env: {} env: {}
@ -300,11 +300,7 @@ jobs:
env: env:
RUST_BACKTRACE: 1 RUST_BACKTRACE: 1
os: ubuntu-20.04-xl os: ubuntu-20.04-xl
- name: x86_64-gnu-llvm-13 - name: x86_64-gnu-llvm-14-stage1
env:
RUST_BACKTRACE: 1
os: ubuntu-20.04-xl
- name: x86_64-gnu-llvm-13-stage1
env: env:
RUST_BACKTRACE: 1 RUST_BACKTRACE: 1
os: ubuntu-20.04-xl os: ubuntu-20.04-xl

View File

@ -874,9 +874,9 @@ dependencies = [
[[package]] [[package]]
name = "compiler_builtins" name = "compiler_builtins"
version = "0.1.85" version = "0.1.87"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13e81c6cd7ab79f51a0c927d22858d61ad12bd0b3865f0b13ece02a4486aeabb" checksum = "f867ce54c09855ccd135ad4a50c777182a0c7af5ff20a8f537617bd648b10d50"
dependencies = [ dependencies = [
"cc", "cc",
"rustc-std-workspace-core", "rustc-std-workspace-core",

View File

@ -3,7 +3,6 @@ use crate::common::{self, CodegenCx};
use crate::debuginfo; use crate::debuginfo;
use crate::errors::{InvalidMinimumAlignment, SymbolAlreadyDefined}; use crate::errors::{InvalidMinimumAlignment, SymbolAlreadyDefined};
use crate::llvm::{self, True}; use crate::llvm::{self, True};
use crate::llvm_util;
use crate::type_::Type; use crate::type_::Type;
use crate::type_of::LayoutLlvmExt; use crate::type_of::LayoutLlvmExt;
use crate::value::Value; use crate::value::Value;
@ -56,13 +55,7 @@ pub fn const_alloc_to_llvm<'ll>(cx: &CodegenCx<'ll, '_>, alloc: ConstAllocation<
// to avoid the cost of generating large complex const expressions. // to avoid the cost of generating large complex const expressions.
// For example, `[(u32, u8); 1024 * 1024]` contains uninit padding in each element, // For example, `[(u32, u8); 1024 * 1024]` contains uninit padding in each element,
// and would result in `{ [5 x i8] zeroinitializer, [3 x i8] undef, ...repeat 1M times... }`. // and would result in `{ [5 x i8] zeroinitializer, [3 x i8] undef, ...repeat 1M times... }`.
let max = if llvm_util::get_version() < (14, 0, 0) { let max = cx.sess().opts.unstable_opts.uninit_const_chunk_threshold;
// Generating partially-uninit consts inhibits optimizations in LLVM < 14.
// See https://github.com/rust-lang/rust/issues/84565.
1
} else {
cx.sess().opts.unstable_opts.uninit_const_chunk_threshold
};
let allow_uninit_chunks = chunks.clone().take(max.saturating_add(1)).count() <= max; let allow_uninit_chunks = chunks.clone().take(max.saturating_add(1)).count() <= max;
if allow_uninit_chunks { if allow_uninit_chunks {

View File

@ -143,17 +143,6 @@ pub unsafe fn create_module<'ll>(
let mut target_data_layout = sess.target.data_layout.to_string(); let mut target_data_layout = sess.target.data_layout.to_string();
let llvm_version = llvm_util::get_version(); let llvm_version = llvm_util::get_version();
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();
} else if sess.target.arch == "wasm32" {
target_data_layout = target_data_layout.replace("-p10:8:8-p20:8:8", "");
}
}
if llvm_version < (16, 0, 0) { if llvm_version < (16, 0, 0) {
if sess.target.arch == "s390x" { if sess.target.arch == "s390x" {
target_data_layout = target_data_layout.replace("-v128:64", ""); target_data_layout = target_data_layout.replace("-v128:64", "");

View File

@ -152,13 +152,7 @@ pub fn time_trace_profiler_finish(file_name: &Path) {
pub fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> SmallVec<[&'a str; 2]> { pub fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> SmallVec<[&'a str; 2]> {
let arch = if sess.target.arch == "x86_64" { "x86" } else { &*sess.target.arch }; let arch = if sess.target.arch == "x86_64" { "x86" } else { &*sess.target.arch };
match (arch, s) { match (arch, s) {
("x86", "sse4.2") => { ("x86", "sse4.2") => smallvec!["sse4.2", "crc32"],
if get_version() >= (14, 0, 0) {
smallvec!["sse4.2", "crc32"]
} else {
smallvec!["sse4.2"]
}
}
("x86", "pclmulqdq") => smallvec!["pclmul"], ("x86", "pclmulqdq") => smallvec!["pclmul"],
("x86", "rdrand") => smallvec!["rdrnd"], ("x86", "rdrand") => smallvec!["rdrnd"],
("x86", "bmi1") => smallvec!["bmi"], ("x86", "bmi1") => smallvec!["bmi"],
@ -217,7 +211,7 @@ pub fn check_tied_features(
/// Must express features in the way Rust understands them /// Must express features in the way Rust understands them
pub fn target_features(sess: &Session, allow_unstable: bool) -> Vec<Symbol> { pub fn target_features(sess: &Session, allow_unstable: bool) -> Vec<Symbol> {
let target_machine = create_informational_target_machine(sess); let target_machine = create_informational_target_machine(sess);
let mut features: Vec<Symbol> = supported_target_features(sess) supported_target_features(sess)
.iter() .iter()
.filter_map(|&(feature, gate)| { .filter_map(|&(feature, gate)| {
if sess.is_nightly_build() || allow_unstable || gate.is_none() { if sess.is_nightly_build() || allow_unstable || gate.is_none() {
@ -237,16 +231,7 @@ pub fn target_features(sess: &Session, allow_unstable: bool) -> Vec<Symbol> {
true true
}) })
.map(|feature| Symbol::intern(feature)) .map(|feature| Symbol::intern(feature))
.collect(); .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() { pub fn print_version() {
@ -494,11 +479,6 @@ pub(crate) fn global_llvm_features(sess: &Session, diagnostics: bool) -> Vec<Str
.flatten(); .flatten();
features.extend(feats); features.extend(feats);
// FIXME: Move v8a to target definition list when earliest supported LLVM is 14.
if get_version() >= (14, 0, 0) && sess.target.arch == "aarch64" {
features.push("+v8a".into());
}
if diagnostics && let Some(f) = check_tied_features(sess, &featsmap) { if diagnostics && let Some(f) = check_tied_features(sess, &featsmap) {
sess.emit_err(TargetFeatureDisableOrEnable { sess.emit_err(TargetFeatureDisableOrEnable {
features: f, features: f,

View File

@ -1,6 +1,5 @@
use crate::common::*; use crate::common::*;
use crate::context::TypeLowering; use crate::context::TypeLowering;
use crate::llvm_util::get_version;
use crate::type_::Type; use crate::type_::Type;
use rustc_codegen_ssa::traits::*; use rustc_codegen_ssa::traits::*;
use rustc_middle::bug; use rustc_middle::bug;
@ -43,10 +42,8 @@ fn uncached_llvm_type<'a, 'tcx>(
// in problematically distinct types due to HRTB and subtyping (see #47638). // in problematically distinct types due to HRTB and subtyping (see #47638).
// ty::Dynamic(..) | // ty::Dynamic(..) |
ty::Adt(..) | ty::Closure(..) | ty::Foreign(..) | ty::Generator(..) | ty::Str ty::Adt(..) | ty::Closure(..) | ty::Foreign(..) | ty::Generator(..) | ty::Str
// For performance reasons we use names only when emitting LLVM IR. Unless we are on // For performance reasons we use names only when emitting LLVM IR.
// LLVM < 14, where the use of unnamed types resulted in various issues, e.g., #76213, if !cx.sess().fewer_names() =>
// #79564, and #79246.
if get_version() < (14, 0, 0) || !cx.sess().fewer_names() =>
{ {
let mut name = with_no_visible_paths!(with_no_trimmed_paths!(layout.ty.to_string())); let mut name = with_no_visible_paths!(with_no_trimmed_paths!(layout.ty.to_string()));
if let (&ty::Adt(def, _), &Variants::Single { index }) = if let (&ty::Adt(def, _), &Variants::Single { index }) =

View File

@ -14,6 +14,7 @@
#include "llvm/IR/AssemblyAnnotationWriter.h" #include "llvm/IR/AssemblyAnnotationWriter.h"
#include "llvm/IR/IntrinsicInst.h" #include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Verifier.h" #include "llvm/IR/Verifier.h"
#include "llvm/MC/TargetRegistry.h"
#include "llvm/Object/ObjectFile.h" #include "llvm/Object/ObjectFile.h"
#include "llvm/Object/IRObjectFile.h" #include "llvm/Object/IRObjectFile.h"
#include "llvm/Passes/PassBuilder.h" #include "llvm/Passes/PassBuilder.h"
@ -25,11 +26,6 @@
#include "llvm/Support/VirtualFileSystem.h" #include "llvm/Support/VirtualFileSystem.h"
#endif #endif
#include "llvm/Support/Host.h" #include "llvm/Support/Host.h"
#if LLVM_VERSION_LT(14, 0)
#include "llvm/Support/TargetRegistry.h"
#else
#include "llvm/MC/TargetRegistry.h"
#endif
#include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetMachine.h"
#include "llvm/Transforms/IPO/PassManagerBuilder.h" #include "llvm/Transforms/IPO/PassManagerBuilder.h"
#include "llvm/Transforms/IPO/AlwaysInliner.h" #include "llvm/Transforms/IPO/AlwaysInliner.h"
@ -267,10 +263,6 @@ enum class LLVMRustPassBuilderOptLevel {
Oz, Oz,
}; };
#if LLVM_VERSION_LT(14,0)
using OptimizationLevel = PassBuilder::OptimizationLevel;
#endif
static OptimizationLevel fromRust(LLVMRustPassBuilderOptLevel Level) { static OptimizationLevel fromRust(LLVMRustPassBuilderOptLevel Level) {
switch (Level) { switch (Level) {
case LLVMRustPassBuilderOptLevel::O0: case LLVMRustPassBuilderOptLevel::O0:
@ -747,27 +739,18 @@ LLVMRustOptimize(
if (SanitizerOptions) { if (SanitizerOptions) {
if (SanitizerOptions->SanitizeMemory) { if (SanitizerOptions->SanitizeMemory) {
#if LLVM_VERSION_GE(14, 0)
MemorySanitizerOptions Options( MemorySanitizerOptions Options(
SanitizerOptions->SanitizeMemoryTrackOrigins, SanitizerOptions->SanitizeMemoryTrackOrigins,
SanitizerOptions->SanitizeMemoryRecover, SanitizerOptions->SanitizeMemoryRecover,
/*CompileKernel=*/false, /*CompileKernel=*/false,
/*EagerChecks=*/true); /*EagerChecks=*/true);
#else
MemorySanitizerOptions Options(
SanitizerOptions->SanitizeMemoryTrackOrigins,
SanitizerOptions->SanitizeMemoryRecover,
/*CompileKernel=*/false);
#endif
OptimizerLastEPCallbacks.push_back( OptimizerLastEPCallbacks.push_back(
[Options](ModulePassManager &MPM, OptimizationLevel Level) { [Options](ModulePassManager &MPM, OptimizationLevel Level) {
#if LLVM_VERSION_GE(14, 0) && LLVM_VERSION_LT(16, 0) #if LLVM_VERSION_LT(16, 0)
MPM.addPass(ModuleMemorySanitizerPass(Options)); MPM.addPass(ModuleMemorySanitizerPass(Options));
MPM.addPass(createModuleToFunctionPassAdaptor(MemorySanitizerPass(Options)));
#else #else
MPM.addPass(MemorySanitizerPass(Options)); MPM.addPass(MemorySanitizerPass(Options));
#endif
#if LLVM_VERSION_LT(16, 0)
MPM.addPass(createModuleToFunctionPassAdaptor(MemorySanitizerPass(Options)));
#endif #endif
} }
); );
@ -776,11 +759,7 @@ LLVMRustOptimize(
if (SanitizerOptions->SanitizeThread) { if (SanitizerOptions->SanitizeThread) {
OptimizerLastEPCallbacks.push_back( OptimizerLastEPCallbacks.push_back(
[](ModulePassManager &MPM, OptimizationLevel Level) { [](ModulePassManager &MPM, OptimizationLevel Level) {
#if LLVM_VERSION_GE(14, 0)
MPM.addPass(ModuleThreadSanitizerPass()); MPM.addPass(ModuleThreadSanitizerPass());
#else
MPM.addPass(ThreadSanitizerPass());
#endif
MPM.addPass(createModuleToFunctionPassAdaptor(ThreadSanitizerPass())); MPM.addPass(createModuleToFunctionPassAdaptor(ThreadSanitizerPass()));
} }
); );
@ -792,7 +771,6 @@ LLVMRustOptimize(
#if LLVM_VERSION_LT(15, 0) #if LLVM_VERSION_LT(15, 0)
MPM.addPass(RequireAnalysisPass<ASanGlobalsMetadataAnalysis, Module>()); MPM.addPass(RequireAnalysisPass<ASanGlobalsMetadataAnalysis, Module>());
#endif #endif
#if LLVM_VERSION_GE(14, 0)
AddressSanitizerOptions opts = AddressSanitizerOptions{ AddressSanitizerOptions opts = AddressSanitizerOptions{
/*CompileKernel=*/false, /*CompileKernel=*/false,
SanitizerOptions->SanitizeAddressRecover, SanitizerOptions->SanitizeAddressRecover,
@ -803,13 +781,6 @@ LLVMRustOptimize(
MPM.addPass(ModuleAddressSanitizerPass(opts)); MPM.addPass(ModuleAddressSanitizerPass(opts));
#else #else
MPM.addPass(AddressSanitizerPass(opts)); MPM.addPass(AddressSanitizerPass(opts));
#endif
#else
MPM.addPass(ModuleAddressSanitizerPass(
/*CompileKernel=*/false, SanitizerOptions->SanitizeAddressRecover));
MPM.addPass(createModuleToFunctionPassAdaptor(AddressSanitizerPass(
/*CompileKernel=*/false, SanitizerOptions->SanitizeAddressRecover,
/*UseAfterScope=*/true)));
#endif #endif
} }
); );
@ -817,15 +788,10 @@ LLVMRustOptimize(
if (SanitizerOptions->SanitizeHWAddress) { if (SanitizerOptions->SanitizeHWAddress) {
OptimizerLastEPCallbacks.push_back( OptimizerLastEPCallbacks.push_back(
[SanitizerOptions](ModulePassManager &MPM, OptimizationLevel Level) { [SanitizerOptions](ModulePassManager &MPM, OptimizationLevel Level) {
#if LLVM_VERSION_GE(14, 0)
HWAddressSanitizerOptions opts( HWAddressSanitizerOptions opts(
/*CompileKernel=*/false, SanitizerOptions->SanitizeHWAddressRecover, /*CompileKernel=*/false, SanitizerOptions->SanitizeHWAddressRecover,
/*DisableOptimization=*/false); /*DisableOptimization=*/false);
MPM.addPass(HWAddressSanitizerPass(opts)); MPM.addPass(HWAddressSanitizerPass(opts));
#else
MPM.addPass(HWAddressSanitizerPass(
/*CompileKernel=*/false, SanitizerOptions->SanitizeHWAddressRecover));
#endif
} }
); );
} }
@ -1328,11 +1294,7 @@ extern "C" bool
LLVMRustPrepareThinLTOResolveWeak(const LLVMRustThinLTOData *Data, LLVMModuleRef M) { LLVMRustPrepareThinLTOResolveWeak(const LLVMRustThinLTOData *Data, LLVMModuleRef M) {
Module &Mod = *unwrap(M); Module &Mod = *unwrap(M);
const auto &DefinedGlobals = Data->ModuleToDefinedGVSummaries.lookup(Mod.getModuleIdentifier()); const auto &DefinedGlobals = Data->ModuleToDefinedGVSummaries.lookup(Mod.getModuleIdentifier());
#if LLVM_VERSION_GE(14, 0)
thinLTOFinalizeInModule(Mod, DefinedGlobals, /*PropagateAttrs=*/true); thinLTOFinalizeInModule(Mod, DefinedGlobals, /*PropagateAttrs=*/true);
#else
thinLTOResolvePrevailingInModule(Mod, DefinedGlobals);
#endif
return true; return true;
} }

View File

@ -63,11 +63,7 @@ static LLVM_THREAD_LOCAL char *LastError;
// //
// Notably it exits the process with code 101, unlike LLVM's default of 1. // Notably it exits the process with code 101, unlike LLVM's default of 1.
static void FatalErrorHandler(void *UserData, static void FatalErrorHandler(void *UserData,
#if LLVM_VERSION_LT(14, 0)
const std::string& Reason,
#else
const char* Reason, const char* Reason,
#endif
bool GenCrashDiag) { bool GenCrashDiag) {
// Do the same thing that the default error handler does. // Do the same thing that the default error handler does.
std::cerr << "LLVM ERROR: " << Reason << std::endl; std::cerr << "LLVM ERROR: " << Reason << std::endl;
@ -249,18 +245,10 @@ static Attribute::AttrKind fromRust(LLVMRustAttribute Kind) {
template<typename T> static inline void AddAttributes(T *t, unsigned Index, template<typename T> static inline void AddAttributes(T *t, unsigned Index,
LLVMAttributeRef *Attrs, size_t AttrsLen) { LLVMAttributeRef *Attrs, size_t AttrsLen) {
AttributeList PAL = t->getAttributes(); AttributeList PAL = t->getAttributes();
AttributeList PALNew;
#if LLVM_VERSION_LT(14, 0)
AttrBuilder B;
for (LLVMAttributeRef Attr : makeArrayRef(Attrs, AttrsLen))
B.addAttribute(unwrap(Attr));
PALNew = PAL.addAttributes(t->getContext(), Index, B);
#else
AttrBuilder B(t->getContext()); AttrBuilder B(t->getContext());
for (LLVMAttributeRef Attr : ArrayRef<LLVMAttributeRef>(Attrs, AttrsLen)) for (LLVMAttributeRef Attr : ArrayRef<LLVMAttributeRef>(Attrs, AttrsLen))
B.addAttribute(unwrap(Attr)); B.addAttribute(unwrap(Attr));
PALNew = PAL.addAttributesAtIndex(t->getContext(), Index, B); AttributeList PALNew = PAL.addAttributesAtIndex(t->getContext(), Index, B);
#endif
t->setAttributes(PALNew); t->setAttributes(PALNew);
} }

View File

@ -8,7 +8,7 @@ pub fn target() -> Target {
data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(), data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
arch: "aarch64".into(), arch: "aarch64".into(),
options: TargetOptions { options: TargetOptions {
features: "+outline-atomics".into(), features: "+v8a,+outline-atomics".into(),
max_atomic_width: Some(128), max_atomic_width: Some(128),
mcount: "\u{1}_mcount".into(), mcount: "\u{1}_mcount".into(),
endian: Endian::Big, endian: Endian::Big,

View File

@ -12,7 +12,7 @@ pub fn target() -> Target {
arch: "aarch64".into(), arch: "aarch64".into(),
options: TargetOptions { options: TargetOptions {
abi: "ilp32".into(), abi: "ilp32".into(),
features: "+outline-atomics".into(), features: "+v8a,+outline-atomics".into(),
mcount: "\u{1}_mcount".into(), mcount: "\u{1}_mcount".into(),
endian: Endian::Big, endian: Endian::Big,
..base ..base

View File

@ -9,7 +9,7 @@ pub fn target() -> Target {
arch: "aarch64".into(), arch: "aarch64".into(),
options: TargetOptions { options: TargetOptions {
linker: Some("aarch64-kmc-elf-gcc".into()), linker: Some("aarch64-kmc-elf-gcc".into()),
features: "+neon,+fp-armv8".into(), features: "+v8a,+neon,+fp-armv8".into(),
relocation_model: RelocModel::Static, relocation_model: RelocModel::Static,
disable_redzone: true, disable_redzone: true,
max_atomic_width: Some(128), max_atomic_width: Some(128),

View File

@ -13,7 +13,7 @@ pub fn target() -> Target {
max_atomic_width: Some(128), max_atomic_width: Some(128),
// As documented in https://developer.android.com/ndk/guides/cpu-features.html // As documented in https://developer.android.com/ndk/guides/cpu-features.html
// the neon (ASIMD) and FP must exist on all android aarch64 targets. // the neon (ASIMD) and FP must exist on all android aarch64 targets.
features: "+neon,+fp-armv8".into(), features: "+v8a,+neon,+fp-armv8".into(),
supported_sanitizers: SanitizerSet::CFI supported_sanitizers: SanitizerSet::CFI
| SanitizerSet::HWADDRESS | SanitizerSet::HWADDRESS
| SanitizerSet::MEMTAG | SanitizerSet::MEMTAG

View File

@ -10,6 +10,7 @@ pub fn target() -> Target {
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(), data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
arch: "aarch64".into(), arch: "aarch64".into(),
options: TargetOptions { options: TargetOptions {
features: "+v8a".into(),
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes), linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
linker: Some("rust-lld".into()), linker: Some("rust-lld".into()),
link_script: Some(LINKER_SCRIPT.into()), link_script: Some(LINKER_SCRIPT.into()),

View File

@ -3,7 +3,7 @@ use crate::spec::Target;
pub fn target() -> Target { pub fn target() -> Target {
let mut base = super::windows_gnullvm_base::opts(); let mut base = super::windows_gnullvm_base::opts();
base.max_atomic_width = Some(128); base.max_atomic_width = Some(128);
base.features = "+neon,+fp-armv8".into(); base.features = "+v8a,+neon,+fp-armv8".into();
base.linker = Some("aarch64-w64-mingw32-clang".into()); base.linker = Some("aarch64-w64-mingw32-clang".into());
Target { Target {

View File

@ -3,7 +3,7 @@ use crate::spec::Target;
pub fn target() -> Target { pub fn target() -> Target {
let mut base = super::windows_msvc_base::opts(); let mut base = super::windows_msvc_base::opts();
base.max_atomic_width = Some(128); base.max_atomic_width = Some(128);
base.features = "+neon,+fp-armv8".into(); base.features = "+v8a,+neon,+fp-armv8".into();
Target { Target {
llvm_target: "aarch64-pc-windows-msvc".into(), llvm_target: "aarch64-pc-windows-msvc".into(),

View File

@ -7,6 +7,7 @@ pub fn target() -> Target {
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(), data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
arch: "aarch64".into(), arch: "aarch64".into(),
options: TargetOptions { options: TargetOptions {
features: "+v8a".into(),
max_atomic_width: Some(128), max_atomic_width: Some(128),
supported_sanitizers: SanitizerSet::ADDRESS supported_sanitizers: SanitizerSet::ADDRESS
| SanitizerSet::CFI | SanitizerSet::CFI

View File

@ -7,6 +7,7 @@ pub fn target() -> Target {
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(), data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
arch: "aarch64".into(), arch: "aarch64".into(),
options: TargetOptions { options: TargetOptions {
features: "+v8a".into(),
max_atomic_width: Some(128), max_atomic_width: Some(128),
supported_sanitizers: SanitizerSet::ADDRESS supported_sanitizers: SanitizerSet::ADDRESS
| SanitizerSet::CFI | SanitizerSet::CFI

View File

@ -3,7 +3,7 @@ use crate::spec::Target;
pub fn target() -> Target { pub fn target() -> Target {
let mut base = super::hermit_base::opts(); let mut base = super::hermit_base::opts();
base.max_atomic_width = Some(128); base.max_atomic_width = Some(128);
base.features = "+strict-align,+neon,+fp-armv8".into(); base.features = "+v8a,+strict-align,+neon,+fp-armv8".into();
Target { Target {
llvm_target: "aarch64-unknown-hermit".into(), llvm_target: "aarch64-unknown-hermit".into(),

View File

@ -7,7 +7,7 @@ pub fn target() -> Target {
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(), data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
arch: "aarch64".into(), arch: "aarch64".into(),
options: TargetOptions { options: TargetOptions {
features: "+outline-atomics".into(), features: "+v8a,+outline-atomics".into(),
mcount: "\u{1}_mcount".into(), mcount: "\u{1}_mcount".into(),
max_atomic_width: Some(128), max_atomic_width: Some(128),
supported_sanitizers: SanitizerSet::ADDRESS supported_sanitizers: SanitizerSet::ADDRESS

View File

@ -8,7 +8,7 @@ pub fn target() -> Target {
arch: "aarch64".into(), arch: "aarch64".into(),
options: TargetOptions { options: TargetOptions {
abi: "ilp32".into(), abi: "ilp32".into(),
features: "+outline-atomics".into(), features: "+v8a,+outline-atomics".into(),
max_atomic_width: Some(128), max_atomic_width: Some(128),
mcount: "\u{1}_mcount".into(), mcount: "\u{1}_mcount".into(),
..super::linux_gnu_base::opts() ..super::linux_gnu_base::opts()

View File

@ -4,6 +4,7 @@ pub fn target() -> Target {
let mut base = super::linux_musl_base::opts(); let mut base = super::linux_musl_base::opts();
base.max_atomic_width = Some(128); base.max_atomic_width = Some(128);
base.supports_xray = true; base.supports_xray = true;
base.features = "+v8a".into();
Target { Target {
llvm_target: "aarch64-unknown-linux-musl".into(), llvm_target: "aarch64-unknown-linux-musl".into(),

View File

@ -7,6 +7,7 @@ pub fn target() -> Target {
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(), data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
arch: "aarch64".into(), arch: "aarch64".into(),
options: TargetOptions { options: TargetOptions {
features: "+v8a".into(),
mcount: "__mcount".into(), mcount: "__mcount".into(),
max_atomic_width: Some(128), max_atomic_width: Some(128),
..super::netbsd_base::opts() ..super::netbsd_base::opts()

View File

@ -14,7 +14,7 @@ pub fn target() -> Target {
let opts = TargetOptions { let opts = TargetOptions {
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes), linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
linker: Some("rust-lld".into()), linker: Some("rust-lld".into()),
features: "+strict-align,+neon,+fp-armv8".into(), features: "+v8a,+strict-align,+neon,+fp-armv8".into(),
supported_sanitizers: SanitizerSet::KCFI, supported_sanitizers: SanitizerSet::KCFI,
relocation_model: RelocModel::Static, relocation_model: RelocModel::Static,
disable_redzone: true, disable_redzone: true,

View File

@ -13,7 +13,7 @@ pub fn target() -> Target {
abi: "softfloat".into(), abi: "softfloat".into(),
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes), linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
linker: Some("rust-lld".into()), linker: Some("rust-lld".into()),
features: "+strict-align,-neon,-fp-armv8".into(), features: "+v8a,+strict-align,-neon,-fp-armv8".into(),
relocation_model: RelocModel::Static, relocation_model: RelocModel::Static,
disable_redzone: true, disable_redzone: true,
max_atomic_width: Some(128), max_atomic_width: Some(128),

View File

@ -17,6 +17,7 @@ pub fn target() -> Target {
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(), data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
arch: "aarch64".into(), arch: "aarch64".into(),
options: TargetOptions { options: TargetOptions {
features: "+v8a".into(),
max_atomic_width: Some(128), max_atomic_width: Some(128),
pre_link_args: TargetOptions::link_args( pre_link_args: TargetOptions::link_args(
LinkerFlavor::Gnu(Cc::Yes, Lld::No), LinkerFlavor::Gnu(Cc::Yes, Lld::No),

View File

@ -6,6 +6,10 @@ pub fn target() -> Target {
pointer_width: 64, pointer_width: 64,
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(), data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
arch: "aarch64".into(), arch: "aarch64".into(),
options: TargetOptions { max_atomic_width: Some(128), ..super::openbsd_base::opts() }, options: TargetOptions {
features: "+v8a".into(),
max_atomic_width: Some(128),
..super::openbsd_base::opts()
},
} }
} }

View File

@ -3,6 +3,7 @@ use crate::spec::Target;
pub fn target() -> Target { pub fn target() -> Target {
let mut base = super::redox_base::opts(); let mut base = super::redox_base::opts();
base.max_atomic_width = Some(128); base.max_atomic_width = Some(128);
base.features = "+v8a".into();
Target { Target {
llvm_target: "aarch64-unknown-redox".into(), llvm_target: "aarch64-unknown-redox".into(),

View File

@ -9,6 +9,7 @@ pub fn target() -> Target {
base.max_atomic_width = Some(128); base.max_atomic_width = Some(128);
base.add_pre_link_args(LinkerFlavor::Msvc(Lld::No), &["/machine:arm64"]); base.add_pre_link_args(LinkerFlavor::Msvc(Lld::No), &["/machine:arm64"]);
base.features = "+v8a".into();
Target { Target {
llvm_target: "aarch64-unknown-windows".into(), llvm_target: "aarch64-unknown-windows".into(),

View File

@ -3,6 +3,7 @@ use crate::spec::Target;
pub fn target() -> Target { pub fn target() -> Target {
let mut base = super::windows_uwp_msvc_base::opts(); let mut base = super::windows_uwp_msvc_base::opts();
base.max_atomic_width = Some(128); base.max_atomic_width = Some(128);
base.features = "+v8a".into();
Target { Target {
llvm_target: "aarch64-pc-windows-msvc".into(), llvm_target: "aarch64-pc-windows-msvc".into(),

View File

@ -6,6 +6,10 @@ pub fn target() -> Target {
pointer_width: 64, pointer_width: 64,
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(), data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
arch: "aarch64".into(), arch: "aarch64".into(),
options: TargetOptions { max_atomic_width: Some(128), ..super::vxworks_base::opts() }, options: TargetOptions {
features: "+v8a".into(),
max_atomic_width: Some(128),
..super::vxworks_base::opts()
},
} }
} }

View File

@ -9,7 +9,7 @@ pub fn target() -> Target {
data_layout: "e-m:o-p:32:32-i64:64-i128:128-n32:64-S128".into(), data_layout: "e-m:o-p:32:32-i64:64-i128:128-n32:64-S128".into(),
arch: "aarch64".into(), arch: "aarch64".into(),
options: TargetOptions { options: TargetOptions {
features: "+neon,+fp-armv8,+apple-a7".into(), features: "+v8a,+neon,+fp-armv8,+apple-a7".into(),
max_atomic_width: Some(128), max_atomic_width: Some(128),
forces_embed_bitcode: true, forces_embed_bitcode: true,
dynamic_linking: false, dynamic_linking: false,

View File

@ -16,7 +16,7 @@ panic_unwind = { path = "../panic_unwind", optional = true }
panic_abort = { path = "../panic_abort" } panic_abort = { path = "../panic_abort" }
core = { path = "../core" } core = { path = "../core" }
libc = { version = "0.2.138", default-features = false, features = ['rustc-dep-of-std'] } libc = { version = "0.2.138", default-features = false, features = ['rustc-dep-of-std'] }
compiler_builtins = { version = "0.1.85" } compiler_builtins = { version = "0.1.87" }
profiler_builtins = { path = "../profiler_builtins", optional = true } profiler_builtins = { path = "../profiler_builtins", optional = true }
unwind = { path = "../unwind" } unwind = { path = "../unwind" }
hashbrown = { version = "0.12", default-features = false, features = ['rustc-dep-of-std'] } hashbrown = { version = "0.12", default-features = false, features = ['rustc-dep-of-std'] }

View File

@ -561,11 +561,11 @@ fn check_llvm_version(builder: &Builder<'_>, llvm_config: &Path) {
let version = output(cmd.arg("--version")); let version = output(cmd.arg("--version"));
let mut parts = version.split('.').take(2).filter_map(|s| s.parse::<u32>().ok()); let mut parts = version.split('.').take(2).filter_map(|s| s.parse::<u32>().ok());
if let (Some(major), Some(_minor)) = (parts.next(), parts.next()) { if let (Some(major), Some(_minor)) = (parts.next(), parts.next()) {
if major >= 13 { if major >= 14 {
return; return;
} }
} }
panic!("\n\nbad LLVM version: {}, need >=13.0\n\n", version) panic!("\n\nbad LLVM version: {}, need >=14.0\n\n", version)
} }
fn configure_cmake( fn configure_cmake(

View File

@ -1,49 +0,0 @@
FROM ubuntu:22.04
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
gcc-multilib \
make \
ninja-build \
file \
curl \
ca-certificates \
python2.7 \
git \
cmake \
sudo \
gdb \
llvm-13-tools \
llvm-13-dev \
libedit-dev \
libssl-dev \
pkg-config \
zlib1g-dev \
xz-utils \
nodejs \
&& rm -rf /var/lib/apt/lists/*
COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh
# We are disabling CI LLVM since this builder is intentionally using a host
# LLVM, rather than the typical src/llvm-project LLVM.
ENV NO_DOWNLOAD_CI_LLVM 1
# Using llvm-link-shared due to libffi issues -- see #34486
ENV RUST_CONFIGURE_ARGS \
--build=x86_64-unknown-linux-gnu \
--llvm-root=/usr/lib/llvm-13 \
--enable-llvm-link-shared \
--set rust.thin-lto-import-instr-limit=10
ENV SCRIPT python2.7 ../x.py --stage 1 test --exclude src/tools/tidy && \
# Run the `mir-opt` tests again but this time for a 32-bit target.
# This enforces that tests using `// EMIT_MIR_FOR_EACH_BIT_WIDTH` have
# both 32-bit and 64-bit outputs updated by the PR author, before
# the PR is approved and tested for merging.
# It will also detect tests lacking `// EMIT_MIR_FOR_EACH_BIT_WIDTH`,
# despite having different output on 32-bit vs 64-bit targets.
python2.7 ../x.py --stage 1 test tests/mir-opt \
--host='' --target=i686-unknown-linux-gnu

View File

@ -1,8 +1,6 @@
FROM ubuntu:22.04 FROM ubuntu:22.04
ARG DEBIAN_FRONTEND=noninteractive ARG DEBIAN_FRONTEND=noninteractive
# NOTE: intentionally installs both python2 and python3 so we can test support for both.
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \ g++ \
gcc-multilib \ gcc-multilib \
@ -11,28 +9,20 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
file \ file \
curl \ curl \
ca-certificates \ ca-certificates \
python2.7 \ python3 \
python3.9 \
git \ git \
cmake \ cmake \
sudo \ sudo \
gdb \ gdb \
llvm-13-tools \ llvm-14-tools \
llvm-13-dev \ llvm-14-dev \
libedit-dev \ libedit-dev \
libssl-dev \ libssl-dev \
pkg-config \ pkg-config \
zlib1g-dev \ zlib1g-dev \
xz-utils \ xz-utils \
nodejs \ nodejs \
\ && rm -rf /var/lib/apt/lists/*
# Install powershell so we can test x.ps1 on Linux
apt-transport-https software-properties-common && \
curl -s "https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb" > packages-microsoft-prod.deb && \
dpkg -i packages-microsoft-prod.deb && \
apt-get update && \
apt-get install -y powershell \
&& rm -rf /var/lib/apt/lists/*
COPY scripts/sccache.sh /scripts/ COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh RUN sh /scripts/sccache.sh
@ -44,26 +34,16 @@ ENV NO_DOWNLOAD_CI_LLVM 1
# Using llvm-link-shared due to libffi issues -- see #34486 # Using llvm-link-shared due to libffi issues -- see #34486
ENV RUST_CONFIGURE_ARGS \ ENV RUST_CONFIGURE_ARGS \
--build=x86_64-unknown-linux-gnu \ --build=x86_64-unknown-linux-gnu \
--llvm-root=/usr/lib/llvm-13 \ --llvm-root=/usr/lib/llvm-14 \
--enable-llvm-link-shared \ --enable-llvm-link-shared \
--set rust.thin-lto-import-instr-limit=10 --set rust.thin-lto-import-instr-limit=10
# NOTE: intentionally uses all of `x.py`, `x`, and `x.ps1` to make sure they all work on Linux. ENV SCRIPT ../x.py --stage 1 test --exclude src/tools/tidy && \
ENV SCRIPT ../x.py --stage 2 test --exclude src/tools/tidy && \
# Run the `mir-opt` tests again but this time for a 32-bit target. # Run the `mir-opt` tests again but this time for a 32-bit target.
# This enforces that tests using `// EMIT_MIR_FOR_EACH_BIT_WIDTH` have # This enforces that tests using `// EMIT_MIR_FOR_EACH_BIT_WIDTH` have
# both 32-bit and 64-bit outputs updated by the PR author, before # both 32-bit and 64-bit outputs updated by the PR author, before
# the PR is approved and tested for merging. # the PR is approved and tested for merging.
# It will also detect tests lacking `// EMIT_MIR_FOR_EACH_BIT_WIDTH`, # It will also detect tests lacking `// EMIT_MIR_FOR_EACH_BIT_WIDTH`,
# despite having different output on 32-bit vs 64-bit targets. # despite having different output on 32-bit vs 64-bit targets.
../x --stage 2 test tests/mir-opt \ ../x.py --stage 1 test tests/mir-opt \
--host='' --target=i686-unknown-linux-gnu && \ --host='' --target=i686-unknown-linux-gnu
# Run the UI test suite again, but in `--pass=check` mode
#
# This is intended to make sure that both `--pass=check` continues to
# work.
#
../x.ps1 --stage 2 test tests/ui --pass=check \
--host='' --target=i686-unknown-linux-gnu && \
# Run tidy at the very end, after all the other tests.
python2.7 ../x.py --stage 2 test src/tools/tidy

View File

@ -300,7 +300,7 @@ jobs:
<<: *job-linux-xl <<: *job-linux-xl
tidy: true tidy: true
- name: x86_64-gnu-llvm-13 - name: x86_64-gnu-llvm-14
<<: *job-linux-xl <<: *job-linux-xl
tidy: false tidy: false
@ -459,12 +459,7 @@ jobs:
RUST_BACKTRACE: 1 RUST_BACKTRACE: 1
<<: *job-linux-xl <<: *job-linux-xl
- name: x86_64-gnu-llvm-13 - name: x86_64-gnu-llvm-14-stage1
env:
RUST_BACKTRACE: 1
<<: *job-linux-xl
- name: x86_64-gnu-llvm-13-stage1
env: env:
RUST_BACKTRACE: 1 RUST_BACKTRACE: 1
<<: *job-linux-xl <<: *job-linux-xl

View File

@ -1,7 +1,6 @@
// assembly-output: emit-asm // assembly-output: emit-asm
// compile-flags: -Copt-level=1 // compile-flags: -Copt-level=1
// only-x86_64 // only-x86_64
// min-llvm-version: 14.0
#![crate_type="rlib"] #![crate_type="rlib"]
// CHECK-LABEL: align_offset_byte_ptr // CHECK-LABEL: align_offset_byte_ptr

View File

@ -1,5 +1,4 @@
// compile-flags: -C no-prepopulate-passes // compile-flags: -C no-prepopulate-passes
// min-llvm-version: 14.0
#![crate_type = "lib"] #![crate_type = "lib"]

View File

@ -1,4 +1,3 @@
// min-llvm-version: 14.0
// revisions: O Os // revisions: O Os
//[Os] compile-flags: -Copt-level=s //[Os] compile-flags: -Copt-level=s
//[O] compile-flags: -O //[O] compile-flags: -O

View File

@ -1,5 +1,4 @@
// only-x86_64 // only-x86_64
// min-llvm-version: 14.0
// compile-flags: -Copt-level=3 // compile-flags: -Copt-level=3
#![crate_type = "lib"] #![crate_type = "lib"]

View File

@ -1,5 +1,4 @@
// compile-flags: -C no-prepopulate-passes // compile-flags: -C no-prepopulate-passes
// min-llvm-version: 14.0
// Check that we use undef (and not zero) for uninitialized bytes in constants. // Check that we use undef (and not zero) for uninitialized bytes in constants.

View File

@ -1,4 +1,3 @@
// min-llvm-version: 14.0
// ignore-debug: the debug assertions get in the way // ignore-debug: the debug assertions get in the way
// compile-flags: -O -Z merge-functions=disabled // compile-flags: -O -Z merge-functions=disabled
#![crate_type = "lib"] #![crate_type = "lib"]

View File

@ -1,6 +1,5 @@
// build-pass // build-pass
// ignore-pass // ignore-pass
// min-llvm-version: 14.0.0
// revisions: all inline merge1 merge2 // revisions: all inline merge1 merge2
// compile-flags: --crate-type=lib -Cdebuginfo=1 -Copt-level=2 // compile-flags: --crate-type=lib -Cdebuginfo=1 -Copt-level=2
// //

View File

@ -1,6 +1,5 @@
// needs-sanitizer-support // needs-sanitizer-support
// needs-sanitizer-memory // needs-sanitizer-memory
// min-llvm-version: 14.0.0
// //
// revisions: unoptimized optimized // revisions: unoptimized optimized
// //