about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorTsukasa OI <floss_rust@irq.a4lg.com>2025-09-17 12:35:21 +0000
committerTsukasa OI <floss_rust@irq.a4lg.com>2025-09-17 12:35:21 +0000
commitea8baccbb15fd58afcde959eed7dc73741dd626d (patch)
tree99d6d7c4ecd663c010833b51aefbb6d522619c6f /compiler
parent2ebb1263e3506412889410b567fa813ca3cb5c63 (diff)
downloadrust-ea8baccbb15fd58afcde959eed7dc73741dd626d.tar.gz
rust-ea8baccbb15fd58afcde959eed7dc73741dd626d.zip
rustc_codegen_llvm: Name major version of LLVM
It makes LLVM version comparison clearer.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_codegen_llvm/src/llvm_util.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs
index 8461c8b03d5..393361a1afe 100644
--- a/compiler/rustc_codegen_llvm/src/llvm_util.rs
+++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs
@@ -228,6 +228,7 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option<LLVMFea
     } else {
         &*sess.target.arch
     };
+    let (major, _, _) = get_version();
     match (arch, s) {
         ("x86", "sse4.2") => Some(LLVMFeature::with_dependencies(
             "sse4.2",
@@ -260,7 +261,7 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option<LLVMFea
         ("aarch64", "fpmr") => None, // only existed in 18
         ("arm", "fp16") => Some(LLVMFeature::new("fullfp16")),
         // Filter out features that are not supported by the current LLVM version
-        ("loongarch32" | "loongarch64", "32s") if get_version().0 < 21 => None,
+        ("loongarch32" | "loongarch64", "32s") if major < 21 => None,
         // Enable the evex512 target feature if an avx512 target feature is enabled.
         ("x86", s) if s.starts_with("avx512") => Some(LLVMFeature::with_dependencies(
             s,