-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update the minimum external LLVM to 14 #107573
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If my memory serves me right, addition of the special case caused this function to start returning a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That addition was commit 0605a41, so no, it was already returning a |
||
} | ||
|
||
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, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this is somewhat unfortunate in that this introduces a constraint on the version of compiler-builtins that works with the new version of LLVM due to how this feature was set up (rather than enabling the behaviour for old LLVM versions it enables the behaviour for the new LLVM versions). I wonder if it would make sense to keep setting this feature for a little longer…? Maybe I’m overthinking this and nobody is really depending on the crate except for rustc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The risk would be using an older version of
compiler_builtins
with a nightly where we've removed this feature -- but I think that's kind of par for the course with nightly crates. It looks like most of the reverse dependencies are just forrustc-std-workspace
hacking, but I'm not sure.