Auto merge of #108056 - matthiaskrgr:rollup-oa6bxvh, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - #107573 (Update the minimum external LLVM to 14) - #107626 (Fix `x fix` on the standard library itself) - #107673 (update ICU4X to 1.1.0) - #107733 (Store metrics from `metrics.json` to CI PGO timer) - #108007 (Use `is_str` instead of string kind comparison) - #108033 (add an unstable `#[rustc_coinductive]` attribute) - #108039 (Refactor refcounted structural_impls via functors) - #108040 (Use derive attributes for uninteresting traversals) - #108044 (interpret: rename Pointer::from_addr → from_addr_invalid) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
0416b1a6f6
106 changed files with 3190 additions and 2703 deletions
|
@ -3,7 +3,6 @@ use crate::common::{self, CodegenCx};
|
|||
use crate::debuginfo;
|
||||
use crate::errors::{InvalidMinimumAlignment, SymbolAlreadyDefined};
|
||||
use crate::llvm::{self, True};
|
||||
use crate::llvm_util;
|
||||
use crate::type_::Type;
|
||||
use crate::type_of::LayoutLlvmExt;
|
||||
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.
|
||||
// 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... }`.
|
||||
let max = if llvm_util::get_version() < (14, 0, 0) {
|
||||
// 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 max = cx.sess().opts.unstable_opts.uninit_const_chunk_threshold;
|
||||
let allow_uninit_chunks = chunks.clone().take(max.saturating_add(1)).count() <= max;
|
||||
|
||||
if allow_uninit_chunks {
|
||||
|
|
|
@ -143,17 +143,6 @@ pub unsafe fn create_module<'ll>(
|
|||
|
||||
let mut target_data_layout = sess.target.data_layout.to_string();
|
||||
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 sess.target.arch == "s390x" {
|
||||
target_data_layout = target_data_layout.replace("-v128:64", "");
|
||||
|
|
|
@ -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]> {
|
||||
let arch = if sess.target.arch == "x86_64" { "x86" } else { &*sess.target.arch };
|
||||
match (arch, s) {
|
||||
("x86", "sse4.2") => {
|
||||
if get_version() >= (14, 0, 0) {
|
||||
smallvec!["sse4.2", "crc32"]
|
||||
} else {
|
||||
smallvec!["sse4.2"]
|
||||
}
|
||||
}
|
||||
("x86", "sse4.2") => smallvec!["sse4.2", "crc32"],
|
||||
("x86", "pclmulqdq") => smallvec!["pclmul"],
|
||||
("x86", "rdrand") => smallvec!["rdrnd"],
|
||||
("x86", "bmi1") => smallvec!["bmi"],
|
||||
|
@ -217,7 +211,7 @@ pub fn check_tied_features(
|
|||
/// Must express features in the way Rust understands them
|
||||
pub fn target_features(sess: &Session, allow_unstable: bool) -> Vec<Symbol> {
|
||||
let target_machine = create_informational_target_machine(sess);
|
||||
let mut features: Vec<Symbol> = supported_target_features(sess)
|
||||
supported_target_features(sess)
|
||||
.iter()
|
||||
.filter_map(|&(feature, gate)| {
|
||||
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
|
||||
})
|
||||
.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
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn print_version() {
|
||||
|
@ -494,11 +479,6 @@ pub(crate) fn global_llvm_features(sess: &Session, diagnostics: bool) -> Vec<Str
|
|||
.flatten();
|
||||
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) {
|
||||
sess.emit_err(TargetFeatureDisableOrEnable {
|
||||
features: f,
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use crate::common::*;
|
||||
use crate::context::TypeLowering;
|
||||
use crate::llvm_util::get_version;
|
||||
use crate::type_::Type;
|
||||
use rustc_codegen_ssa::traits::*;
|
||||
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).
|
||||
// ty::Dynamic(..) |
|
||||
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
|
||||
// LLVM < 14, where the use of unnamed types resulted in various issues, e.g., #76213,
|
||||
// #79564, and #79246.
|
||||
if get_version() < (14, 0, 0) || !cx.sess().fewer_names() =>
|
||||
// For performance reasons we use names only when emitting LLVM IR.
|
||||
if !cx.sess().fewer_names() =>
|
||||
{
|
||||
let mut name = with_no_visible_paths!(with_no_trimmed_paths!(layout.ty.to_string()));
|
||||
if let (&ty::Adt(def, _), &Variants::Single { index }) =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue