From 52dfa94cdcd3ed16f31c6afbf406826e2c5688dd Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 10 Mar 2026 18:18:55 -0700 Subject: [PATCH] Update the minimum external LLVM to 21 --- compiler/rustc_codegen_llvm/src/abi.rs | 27 ++++---- compiler/rustc_codegen_llvm/src/attributes.rs | 14 ++-- compiler/rustc_codegen_llvm/src/context.rs | 16 ----- compiler/rustc_codegen_llvm/src/errors.rs | 4 -- compiler/rustc_codegen_llvm/src/llvm_util.rs | 20 ------ .../rustc_llvm/llvm-wrapper/PassWrapper.cpp | 29 +------- .../rustc_llvm/llvm-wrapper/RustWrapper.cpp | 10 --- src/bootstrap/src/core/build_steps/llvm.rs | 4 +- src/ci/docker/README.md | 8 +-- .../Dockerfile | 6 +- .../host-x86_64/x86_64-gnu-llvm-20/Dockerfile | 66 ------------------- src/ci/github-actions/jobs.yml | 35 ++-------- tests/assembly-llvm/aarch64-pointer-auth.rs | 1 - tests/assembly-llvm/asm/s390x-types.rs | 1 - tests/assembly-llvm/nvptx-safe-naming.rs | 6 +- .../sanitizer/kcfi/emit-arity-indicator.rs | 1 - .../assembly-llvm/x86_64-windows-float-abi.rs | 3 +- tests/codegen-llvm/cffi/c-variadic-va_list.rs | 1 - tests/codegen-llvm/cffi/c-variadic.rs | 1 - tests/codegen-llvm/dead_on_return.rs | 1 - tests/codegen-llvm/deduced-param-attrs.rs | 24 +++---- .../codegen-llvm/enum/enum-discriminant-eq.rs | 44 ++++--------- tests/codegen-llvm/issues/issue-101082.rs | 1 - .../issues/issue-122734-match-eq.rs | 1 - ...e-138497-nonzero-remove-trailing-zeroes.rs | 1 - .../issues/saturating-sub-index-139759.rs | 1 - .../lib-optimizations/append-elements.rs | 1 - tests/codegen-llvm/option-niche-eq.rs | 10 ++- tests/codegen-llvm/read-only-capture-opt.rs | 1 - .../riscv-abi/call-llvm-intrinsics.rs | 1 - .../sanitizer/kcfi/add-kcfi-arity-flag.rs | 1 - tests/codegen-llvm/slice-range-indexing.rs | 1 - tests/codegen-llvm/str-range-indexing.rs | 1 - tests/codegen-llvm/vec-calloc.rs | 21 +++--- tests/run-make/repr128-dwarf/main.rs | 8 +-- tests/run-make/repr128-dwarf/rmake.rs | 21 +----- .../kcfi-arity-requires-llvm-21-0-0.rs | 11 ---- .../kcfi-arity-requires-llvm-21-0-0.stderr | 4 -- 38 files changed, 68 insertions(+), 339 deletions(-) rename src/ci/docker/host-aarch64/{aarch64-gnu-llvm-20 => aarch64-gnu-llvm-21}/Dockerfile (94%) delete mode 100644 src/ci/docker/host-x86_64/x86_64-gnu-llvm-20/Dockerfile delete mode 100644 tests/ui/sanitizer/kcfi-arity-requires-llvm-21-0-0.rs delete mode 100644 tests/ui/sanitizer/kcfi-arity-requires-llvm-21-0-0.stderr diff --git a/compiler/rustc_codegen_llvm/src/abi.rs b/compiler/rustc_codegen_llvm/src/abi.rs index 994077251acca..a6e841e440a21 100644 --- a/compiler/rustc_codegen_llvm/src/abi.rs +++ b/compiler/rustc_codegen_llvm/src/abi.rs @@ -23,7 +23,6 @@ use crate::attributes::{self, llfn_attrs_from_instance}; use crate::builder::Builder; use crate::context::CodegenCx; use crate::llvm::{self, Attribute, AttributePlace, Type, Value}; -use crate::llvm_util; use crate::type_of::LayoutLlvmExt; trait ArgAttributesExt { @@ -46,6 +45,12 @@ const OPTIMIZATION_ATTRIBUTES: [(ArgAttribute, llvm::AttributeKind); 4] = [ (ArgAttribute::NoUndef, llvm::AttributeKind::NoUndef), ]; +const CAPTURES_ATTRIBUTES: [(ArgAttribute, llvm::AttributeKind); 3] = [ + (ArgAttribute::CapturesNone, llvm::AttributeKind::CapturesNone), + (ArgAttribute::CapturesAddress, llvm::AttributeKind::CapturesAddress), + (ArgAttribute::CapturesReadOnly, llvm::AttributeKind::CapturesReadOnly), +]; + fn get_attrs<'ll>(this: &ArgAttributes, cx: &CodegenCx<'ll, '_>) -> SmallVec<[&'ll Attribute; 8]> { let mut regular = this.regular; @@ -82,18 +87,10 @@ fn get_attrs<'ll>(this: &ArgAttributes, cx: &CodegenCx<'ll, '_>) -> SmallVec<[&' attrs.push(llattr.create_attr(cx.llcx)); } } - // captures(...) is only available since LLVM 21. - if (21, 0, 0) <= llvm_util::get_version() { - const CAPTURES_ATTRIBUTES: [(ArgAttribute, llvm::AttributeKind); 3] = [ - (ArgAttribute::CapturesNone, llvm::AttributeKind::CapturesNone), - (ArgAttribute::CapturesAddress, llvm::AttributeKind::CapturesAddress), - (ArgAttribute::CapturesReadOnly, llvm::AttributeKind::CapturesReadOnly), - ]; - for (attr, llattr) in CAPTURES_ATTRIBUTES { - if regular.contains(attr) { - attrs.push(llattr.create_attr(cx.llcx)); - break; - } + for (attr, llattr) in CAPTURES_ATTRIBUTES { + if regular.contains(attr) { + attrs.push(llattr.create_attr(cx.llcx)); + break; } } } else if cx.tcx.sess.sanitizers().contains(SanitizerSet::MEMORY) { @@ -508,9 +505,7 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> { } PassMode::Indirect { attrs, meta_attrs: None, on_stack: false } => { let i = apply(attrs); - if cx.sess().opts.optimize != config::OptLevel::No - && llvm_util::get_version() >= (21, 0, 0) - { + if cx.sess().opts.optimize != config::OptLevel::No { attributes::apply_to_llfn( llfn, llvm::AttributePlace::Argument(i), diff --git a/compiler/rustc_codegen_llvm/src/attributes.rs b/compiler/rustc_codegen_llvm/src/attributes.rs index 546fa87ff5612..d51adb6e13b07 100644 --- a/compiler/rustc_codegen_llvm/src/attributes.rs +++ b/compiler/rustc_codegen_llvm/src/attributes.rs @@ -506,15 +506,11 @@ pub(crate) fn llfn_attrs_from_instance<'ll, 'tcx>( to_add.push(llvm::CreateAllocKindAttr(cx.llcx, AllocKindFlags::Free)); // applies to argument place instead of function place let allocated_pointer = AttributeKind::AllocatedPointer.create_attr(cx.llcx); - let attrs: &[_] = if llvm_util::get_version() >= (21, 0, 0) { - // "Does not capture provenance" means "if the function call stashes the pointer somewhere, - // accessing that pointer after the function returns is UB". That is definitely the case here since - // freeing will destroy the provenance. - let captures_addr = AttributeKind::CapturesAddress.create_attr(cx.llcx); - &[allocated_pointer, captures_addr] - } else { - &[allocated_pointer] - }; + // "Does not capture provenance" means "if the function call stashes the pointer somewhere, + // accessing that pointer after the function returns is UB". That is definitely the case here since + // freeing will destroy the provenance. + let captures_addr = AttributeKind::CapturesAddress.create_attr(cx.llcx); + let attrs = &[allocated_pointer, captures_addr]; attributes::apply_to_llfn(llfn, AttributePlace::Argument(0), attrs); } if let Some(align) = codegen_fn_attrs.alignment { diff --git a/compiler/rustc_codegen_llvm/src/context.rs b/compiler/rustc_codegen_llvm/src/context.rs index 545a9add911d4..cc4c5e2c92913 100644 --- a/compiler/rustc_codegen_llvm/src/context.rs +++ b/compiler/rustc_codegen_llvm/src/context.rs @@ -190,17 +190,6 @@ pub(crate) 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 < (21, 0, 0) { - if sess.target.arch == Arch::Nvptx64 { - // LLVM 21 updated the default layout on nvptx: https://github.com/llvm/llvm-project/pull/124961 - target_data_layout = target_data_layout.replace("e-p6:32:32-i64", "e-i64"); - } - if sess.target.arch == Arch::AmdGpu { - // LLVM 21 adds the address width for address space 8. - // See https://github.com/llvm/llvm-project/pull/139419 - target_data_layout = target_data_layout.replace("p8:128:128:128:48", "p8:128:128") - } - } if llvm_version < (22, 0, 0) { if sess.target.arch == Arch::Avr { // LLVM 22.0 updated the default layout on avr: https://github.com/llvm/llvm-project/pull/153010 @@ -342,11 +331,6 @@ pub(crate) unsafe fn create_module<'ll>( // Add "kcfi-arity" module flag if KCFI arity indicator is enabled. (See // https://github.com/llvm/llvm-project/pull/117121.) if sess.is_sanitizer_kcfi_arity_enabled() { - // KCFI arity indicator requires LLVM 21.0.0 or later. - if llvm_version < (21, 0, 0) { - tcx.dcx().emit_err(crate::errors::SanitizerKcfiArityRequiresLLVM2100); - } - llvm::add_module_flag_u32( llmod, llvm::ModuleFlagMergeBehavior::Override, diff --git a/compiler/rustc_codegen_llvm/src/errors.rs b/compiler/rustc_codegen_llvm/src/errors.rs index a7b5bdbf7bdff..9fb406516f66a 100644 --- a/compiler/rustc_codegen_llvm/src/errors.rs +++ b/compiler/rustc_codegen_llvm/src/errors.rs @@ -204,7 +204,3 @@ pub(crate) struct MismatchedDataLayout<'a> { pub(crate) struct FixedX18InvalidArch<'a> { pub arch: &'a str, } - -#[derive(Diagnostic)] -#[diag("`-Zsanitizer-kcfi-arity` requires LLVM 21.0.0 or later")] -pub(crate) struct SanitizerKcfiArityRequiresLLVM2100; diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs index 85b515f2ef9cb..2423880ab8696 100644 --- a/compiler/rustc_codegen_llvm/src/llvm_util.rs +++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs @@ -254,10 +254,6 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option match s { - "32s" if major < 21 => None, - s => Some(LLVMFeature::new(s)), - }, Arch::PowerPC | Arch::PowerPC64 => match s { "power8-crypto" => Some(LLVMFeature::new("crypto")), s => Some(LLVMFeature::new(s)), @@ -372,23 +368,12 @@ fn update_target_reliable_float_cfg(sess: &Session, cfg: &mut TargetConfig) { let (major, _, _) = version; cfg.has_reliable_f16 = match (target_arch, target_os) { - // LLVM crash without neon (fixed in LLVM 20.1.1) - (Arch::AArch64, _) - if !cfg.target_features.iter().any(|f| f.as_str() == "neon") - && version < (20, 1, 1) => - { - false - } // Unsupported (fixed in llvm22) (Arch::Arm64EC, _) if major < 22 => false, - // Selection failure (fixed in llvm21) - (Arch::S390x, _) if major < 21 => false, // MinGW ABI bugs (Arch::X86_64, Os::Windows) if *target_env == Env::Gnu && *target_abi != Abi::Llvm => false, // Infinite recursion (Arch::CSky, _) if major < 22 => false, // (fixed in llvm22) - (Arch::Hexagon, _) if major < 21 => false, // (fixed in llvm21) - (Arch::LoongArch32 | Arch::LoongArch64, _) if major < 21 => false, // (fixed in llvm21) (Arch::PowerPC | Arch::PowerPC64, _) if major < 22 => false, // (fixed in llvm22) (Arch::Sparc | Arch::Sparc64, _) if major < 22 => false, // (fixed in llvm22) (Arch::Wasm32 | Arch::Wasm64, _) if major < 22 => false, // (fixed in llvm22) @@ -403,8 +388,6 @@ fn update_target_reliable_float_cfg(sess: &Session, cfg: &mut TargetConfig) { (Arch::AmdGpu, _) => false, // Unsupported (Arch::Arm64EC, _) => false, - // Selection bug (fixed in LLVM 20.1.0) - (Arch::Mips64 | Arch::Mips64r6, _) if version < (20, 1, 0) => false, // Selection bug . This issue is closed // but basic math still does not work. (Arch::Nvptx64, _) => false, @@ -413,9 +396,6 @@ fn update_target_reliable_float_cfg(sess: &Session, cfg: &mut TargetConfig) { (Arch::PowerPC | Arch::PowerPC64, _) => false, // ABI unsupported (Arch::Sparc, _) => false, - // Stack alignment bug . NB: tests may - // not fail if our compiler-builtins is linked. (fixed in llvm21) - (Arch::X86, _) if major < 21 => false, // MinGW ABI bugs (Arch::X86_64, Os::Windows) if *target_env == Env::Gnu && *target_abi != Abi::Llvm => false, // There are no known problems on other platforms, so the only requirement is that symbols diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp index a47179c14d27b..00d03f023924a 100644 --- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp @@ -301,12 +301,7 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine( std::string Error; auto Trip = Triple(Triple::normalize(TripleStr)); - const llvm::Target *TheTarget = -#if LLVM_VERSION_GE(21, 0) - TargetRegistry::lookupTarget(Trip, Error); -#else - TargetRegistry::lookupTarget(Trip.getTriple(), Error); -#endif + const llvm::Target *TheTarget = TargetRegistry::lookupTarget(Trip, Error); if (TheTarget == nullptr) { LLVMRustSetLastError(Error.c_str()); return nullptr; @@ -367,13 +362,8 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine( Options.EmitStackSizeSection = EmitStackSizeSection; -#if LLVM_VERSION_GE(21, 0) TargetMachine *TM = TheTarget->createTargetMachine(Trip, CPU, Feature, Options, RM, CM, OptLevel); -#else - TargetMachine *TM = TheTarget->createTargetMachine( - Trip.getTriple(), CPU, Feature, Options, RM, CM, OptLevel); -#endif if (LargeDataThreshold != 0) { TM->setLargeDataThreshold(LargeDataThreshold); @@ -701,12 +691,8 @@ extern "C" LLVMRustResult LLVMRustOptimize( if (LintIR) { PipelineStartEPCallbacks.push_back([](ModulePassManager &MPM, OptimizationLevel Level) { -#if LLVM_VERSION_GE(21, 0) MPM.addPass( createModuleToFunctionPassAdaptor(LintPass(/*AbortOnError=*/true))); -#else - MPM.addPass(createModuleToFunctionPassAdaptor(LintPass())); -#endif }); } @@ -1210,12 +1196,8 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules, size_t num_modules, // Convert the preserved symbols set from string to GUID, this is then needed // for internalization. for (size_t i = 0; i < num_symbols; i++) { -#if LLVM_VERSION_GE(21, 0) auto GUID = GlobalValue::getGUIDAssumingExternalLinkage(preserved_symbols[i]); -#else - auto GUID = GlobalValue::getGUID(preserved_symbols[i]); -#endif Ret->GUIDPreservedSymbols.insert(GUID); } @@ -1474,21 +1456,12 @@ extern "C" void LLVMRustComputeLTOCacheKey(RustStringRef KeyOut, DenseSet CfiFunctionDecls; // Based on the 'InProcessThinBackend' constructor in LLVM -#if LLVM_VERSION_GE(21, 0) for (auto &Name : Data->Index.cfiFunctionDefs().symbols()) CfiFunctionDefs.insert(GlobalValue::getGUIDAssumingExternalLinkage( GlobalValue::dropLLVMManglingEscape(Name))); for (auto &Name : Data->Index.cfiFunctionDecls().symbols()) CfiFunctionDecls.insert(GlobalValue::getGUIDAssumingExternalLinkage( GlobalValue::dropLLVMManglingEscape(Name))); -#else - for (auto &Name : Data->Index.cfiFunctionDefs()) - CfiFunctionDefs.insert( - GlobalValue::getGUID(GlobalValue::dropLLVMManglingEscape(Name))); - for (auto &Name : Data->Index.cfiFunctionDecls()) - CfiFunctionDecls.insert( - GlobalValue::getGUID(GlobalValue::dropLLVMManglingEscape(Name))); -#endif Key = llvm::computeLTOCacheKey(conf, Data->Index, ModId, ImportList, ExportList, ResolvedODR, DefinedGlobals, diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp index eabc1c94f26e9..16796541d4fd9 100644 --- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp @@ -137,11 +137,7 @@ extern "C" void LLVMRustSetLastError(const char *Err) { extern "C" void LLVMRustSetNormalizedTarget(LLVMModuleRef M, const char *Target) { -#if LLVM_VERSION_GE(21, 0) unwrap(M)->setTargetTriple(Triple(Triple::normalize(Target))); -#else - unwrap(M)->setTargetTriple(Triple::normalize(Target)); -#endif } extern "C" void LLVMRustPrintPassTimings(RustStringRef OutBuf) { @@ -452,11 +448,7 @@ static Attribute::AttrKind fromRust(LLVMRustAttributeKind Kind) { case LLVMRustAttributeKind::DeadOnUnwind: return Attribute::DeadOnUnwind; case LLVMRustAttributeKind::DeadOnReturn: -#if LLVM_VERSION_GE(21, 0) return Attribute::DeadOnReturn; -#else - report_fatal_error("DeadOnReturn attribute requires LLVM 21 or later"); -#endif case LLVMRustAttributeKind::CapturesAddress: case LLVMRustAttributeKind::CapturesReadOnly: case LLVMRustAttributeKind::CapturesNone: @@ -514,7 +506,6 @@ extern "C" void LLVMRustEraseInstFromParent(LLVMValueRef Instr) { extern "C" LLVMAttributeRef LLVMRustCreateAttrNoValue(LLVMContextRef C, LLVMRustAttributeKind RustAttr) { -#if LLVM_VERSION_GE(21, 0) if (RustAttr == LLVMRustAttributeKind::CapturesNone) { return wrap(Attribute::getWithCaptureInfo(*unwrap(C), CaptureInfo::none())); } @@ -527,7 +518,6 @@ LLVMRustCreateAttrNoValue(LLVMContextRef C, LLVMRustAttributeKind RustAttr) { *unwrap(C), CaptureInfo(CaptureComponents::Address | CaptureComponents::ReadProvenance))); } -#endif #if LLVM_VERSION_GE(23, 0) if (RustAttr == LLVMRustAttributeKind::DeadOnReturn) { return wrap(Attribute::getWithDeadOnReturnInfo(*unwrap(C), diff --git a/src/bootstrap/src/core/build_steps/llvm.rs b/src/bootstrap/src/core/build_steps/llvm.rs index b0f8cdd28e82b..a6cb6a4308823 100644 --- a/src/bootstrap/src/core/build_steps/llvm.rs +++ b/src/bootstrap/src/core/build_steps/llvm.rs @@ -631,11 +631,11 @@ fn check_llvm_version(builder: &Builder<'_>, llvm_config: &Path) { let version = get_llvm_version(builder, llvm_config); let mut parts = version.split('.').take(2).filter_map(|s| s.parse::().ok()); if let (Some(major), Some(_minor)) = (parts.next(), parts.next()) - && major >= 20 + && major >= 21 { return; } - panic!("\n\nbad LLVM version: {version}, need >=20\n\n") + panic!("\n\nbad LLVM version: {version}, need >=21\n\n") } fn configure_cmake( diff --git a/src/ci/docker/README.md b/src/ci/docker/README.md index b6d01528d8c3e..6e5a38a3c515a 100644 --- a/src/ci/docker/README.md +++ b/src/ci/docker/README.md @@ -14,9 +14,9 @@ To run a specific CI job locally, you can use the `citool` Rust crate: cargo run --manifest-path src/ci/citool/Cargo.toml run-local ``` -For example, to run the `x86_64-gnu-llvm-20-1` job: +For example, to run the `x86_64-gnu-llvm-21-1` job: ``` -cargo run --manifest-path src/ci/citool/Cargo.toml run-local x86_64-gnu-llvm-20-1 +cargo run --manifest-path src/ci/citool/Cargo.toml run-local x86_64-gnu-llvm-21-1 ``` The job will output artifacts in an `obj/` dir at the root of a repository. Note @@ -27,10 +27,10 @@ Docker image executed in the given CI job. while locally, to the `obj/` directory. This is primarily to prevent strange linker errors when using multiple Docker images. -For some Linux workflows (for example `x86_64-gnu-llvm-20-N`), the process is more involved. You will need to see which script is executed for the given workflow inside the [`jobs.yml`](../github-actions/jobs.yml) file and pass it through the `DOCKER_SCRIPT` environment variable. For example, to reproduce the `x86_64-gnu-llvm-20-3` workflow, you can run the following script: +For some Linux workflows (for example `x86_64-gnu-llvm-21-N`), the process is more involved. You will need to see which script is executed for the given workflow inside the [`jobs.yml`](../github-actions/jobs.yml) file and pass it through the `DOCKER_SCRIPT` environment variable. For example, to reproduce the `x86_64-gnu-llvm-21-3` workflow, you can run the following script: ``` -DOCKER_SCRIPT=x86_64-gnu-llvm3.sh ./src/ci/docker/run.sh x86_64-gnu-llvm-20 +DOCKER_SCRIPT=x86_64-gnu-llvm3.sh ./src/ci/docker/run.sh x86_64-gnu-llvm-21 ``` ## Local Development diff --git a/src/ci/docker/host-aarch64/aarch64-gnu-llvm-20/Dockerfile b/src/ci/docker/host-aarch64/aarch64-gnu-llvm-21/Dockerfile similarity index 94% rename from src/ci/docker/host-aarch64/aarch64-gnu-llvm-20/Dockerfile rename to src/ci/docker/host-aarch64/aarch64-gnu-llvm-21/Dockerfile index 5dbca7e7b675b..c364ac27aaa52 100644 --- a/src/ci/docker/host-aarch64/aarch64-gnu-llvm-20/Dockerfile +++ b/src/ci/docker/host-aarch64/aarch64-gnu-llvm-21/Dockerfile @@ -15,8 +15,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ cmake \ sudo \ gdb \ - llvm-20-tools \ - llvm-20-dev \ + llvm-21-tools \ + llvm-21-dev \ libedit-dev \ libssl-dev \ pkg-config \ @@ -42,7 +42,7 @@ ENV EXTERNAL_LLVM="1" # Using llvm-link-shared due to libffi issues -- see #34486 ENV RUST_CONFIGURE_ARGS="--build=aarch64-unknown-linux-gnu \ - --llvm-root=/usr/lib/llvm-20 \ + --llvm-root=/usr/lib/llvm-21 \ --enable-llvm-link-shared \ --set rust.randomize-layout=true \ --set rust.thin-lto-import-instr-limit=10" diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-20/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-20/Dockerfile deleted file mode 100644 index 92c2631000f9e..0000000000000 --- a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-20/Dockerfile +++ /dev/null @@ -1,66 +0,0 @@ -FROM ubuntu:25.04 - -ARG DEBIAN_FRONTEND=noninteractive - -RUN apt-get update && apt-get install -y --no-install-recommends \ - bzip2 \ - g++ \ - gcc-multilib \ - make \ - ninja-build \ - file \ - curl \ - ca-certificates \ - python3 \ - git \ - cmake \ - sudo \ - gdb \ - llvm-20-tools \ - llvm-20-dev \ - libedit-dev \ - libssl-dev \ - pkg-config \ - zlib1g-dev \ - xz-utils \ - nodejs \ - mingw-w64 \ - # libgccjit dependencies - flex \ - libmpfr-dev \ - libgmp-dev \ - libmpc3 \ - libmpc-dev \ - && rm -rf /var/lib/apt/lists/* - -# Install powershell (universal package) so we can test x.ps1 on Linux -# FIXME: need a "universal" version that supports libicu74, but for now it still works to ignore that dep. -RUN curl -sL "https://github.com/PowerShell/PowerShell/releases/download/v7.3.1/powershell_7.3.1-1.deb_amd64.deb" > powershell.deb && \ - dpkg --ignore-depends=libicu72 -i powershell.deb && \ - rm -f powershell.deb - -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 -ENV EXTERNAL_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-20 \ - --enable-llvm-link-shared \ - --set rust.randomize-layout=true \ - --set rust.thin-lto-import-instr-limit=10 - -COPY scripts/shared.sh /scripts/ - -COPY scripts/x86_64-gnu-llvm.sh /scripts/ -COPY scripts/x86_64-gnu-llvm2.sh /scripts/ -COPY scripts/x86_64-gnu-llvm3.sh /scripts/ -COPY scripts/stage_2_test_set1.sh /scripts/ -COPY scripts/stage_2_test_set2.sh /scripts/ - -ENV SCRIPT "Must specify DOCKER_SCRIPT for this image" diff --git a/src/ci/github-actions/jobs.yml b/src/ci/github-actions/jobs.yml index 563083cd450bc..a70e4acf94a36 100644 --- a/src/ci/github-actions/jobs.yml +++ b/src/ci/github-actions/jobs.yml @@ -122,19 +122,19 @@ pr: # tidy. This speeds up the PR CI job by ~1 minute. SKIP_SUBMODULES: src/gcc <<: *job-linux-4c - - name: x86_64-gnu-llvm-20 + - name: x86_64-gnu-llvm-21 env: ENABLE_GCC_CODEGEN: "1" DOCKER_SCRIPT: x86_64-gnu-llvm.sh <<: *job-linux-4c - - name: aarch64-gnu-llvm-20-1 + - name: aarch64-gnu-llvm-21-1 env: - IMAGE: aarch64-gnu-llvm-20 + IMAGE: aarch64-gnu-llvm-21 DOCKER_SCRIPT: stage_2_test_set1.sh <<: *job-aarch64-linux - - name: aarch64-gnu-llvm-20-2 + - name: aarch64-gnu-llvm-21-2 env: - IMAGE: aarch64-gnu-llvm-20 + IMAGE: aarch64-gnu-llvm-21 DOCKER_SCRIPT: stage_2_test_set2.sh <<: *job-aarch64-linux - name: x86_64-gnu-tools @@ -381,31 +381,6 @@ auto: - name: x86_64-gnu-distcheck <<: *job-linux-4c - # The x86_64-gnu-llvm-20 job is split into multiple jobs to run tests in parallel. - # x86_64-gnu-llvm-20-1 skips tests that run in x86_64-gnu-llvm-20-{2,3}. - - name: x86_64-gnu-llvm-20-1 - env: - RUST_BACKTRACE: 1 - IMAGE: x86_64-gnu-llvm-20 - DOCKER_SCRIPT: stage_2_test_set2.sh - <<: *job-linux-4c - - # Skip tests that run in x86_64-gnu-llvm-20-{1,3} - - name: x86_64-gnu-llvm-20-2 - env: - RUST_BACKTRACE: 1 - IMAGE: x86_64-gnu-llvm-20 - DOCKER_SCRIPT: x86_64-gnu-llvm2.sh - <<: *job-linux-4c - - # Skip tests that run in x86_64-gnu-llvm-20-{1,2} - - name: x86_64-gnu-llvm-20-3 - env: - RUST_BACKTRACE: 1 - IMAGE: x86_64-gnu-llvm-20 - DOCKER_SCRIPT: x86_64-gnu-llvm3.sh - <<: *job-linux-4c - # The x86_64-gnu-llvm-21 job is split into multiple jobs to run tests in parallel. # x86_64-gnu-llvm-21-1 skips tests that run in x86_64-gnu-llvm-21-{2,3}. - name: x86_64-gnu-llvm-21-1 diff --git a/tests/assembly-llvm/aarch64-pointer-auth.rs b/tests/assembly-llvm/aarch64-pointer-auth.rs index cf255d6aa639b..2406e8ccb5dc9 100644 --- a/tests/assembly-llvm/aarch64-pointer-auth.rs +++ b/tests/assembly-llvm/aarch64-pointer-auth.rs @@ -5,7 +5,6 @@ //@ assembly-output: emit-asm //@ needs-llvm-components: aarch64 //@ compile-flags: --target aarch64-unknown-linux-gnu -//@ [GCS] min-llvm-version: 21 //@ [GCS] ignore-apple (XCode version needs updating) //@ [GCS] compile-flags: -Z branch-protection=gcs //@ [PACRET] compile-flags: -Z branch-protection=pac-ret,leaf diff --git a/tests/assembly-llvm/asm/s390x-types.rs b/tests/assembly-llvm/asm/s390x-types.rs index 10e2966ace0a3..dee7eb553cde8 100644 --- a/tests/assembly-llvm/asm/s390x-types.rs +++ b/tests/assembly-llvm/asm/s390x-types.rs @@ -6,7 +6,6 @@ //@[s390x_vector] compile-flags: --target s390x-unknown-linux-gnu -C target-feature=+vector //@[s390x_vector] needs-llvm-components: systemz //@ compile-flags: -Zmerge-functions=disabled -//@ min-llvm-version: 21 #![feature(no_core, repr_simd, f16, f128)] #![cfg_attr(s390x_vector, feature(asm_experimental_reg))] diff --git a/tests/assembly-llvm/nvptx-safe-naming.rs b/tests/assembly-llvm/nvptx-safe-naming.rs index 85415b6ca5b5a..050c3fb9d93b6 100644 --- a/tests/assembly-llvm/nvptx-safe-naming.rs +++ b/tests/assembly-llvm/nvptx-safe-naming.rs @@ -1,9 +1,6 @@ //@ assembly-output: ptx-linker //@ compile-flags: --crate-type cdylib //@ only-nvptx64 -//@ revisions: LLVM20 LLVM21 -//@ [LLVM21] min-llvm-version: 21 -//@ [LLVM20] max-llvm-major-version: 20 #![feature(abi_ptx)] #![no_std] @@ -18,8 +15,7 @@ extern crate breakpoint_panic_handler; #[no_mangle] pub unsafe extern "ptx-kernel" fn top_kernel(a: *const u32, b: *mut u32) { // CHECK: call.uni (retval0), - // LLVM20-NEXT: [[IMPL_FN]] - // LLVM21-SAME: [[IMPL_FN]] + // CHECK-SAME: [[IMPL_FN]] *b = deep::private::MyStruct::new(*a).square(); } diff --git a/tests/assembly-llvm/sanitizer/kcfi/emit-arity-indicator.rs b/tests/assembly-llvm/sanitizer/kcfi/emit-arity-indicator.rs index 63fe7e2bd536c..ba9cabd6cef74 100644 --- a/tests/assembly-llvm/sanitizer/kcfi/emit-arity-indicator.rs +++ b/tests/assembly-llvm/sanitizer/kcfi/emit-arity-indicator.rs @@ -5,7 +5,6 @@ //@ assembly-output: emit-asm //@[x86_64] compile-flags: --target x86_64-unknown-linux-gnu -Cllvm-args=-x86-asm-syntax=intel -Ctarget-feature=-crt-static -Cpanic=abort -Zsanitizer=kcfi -Zsanitizer-kcfi-arity -Copt-level=0 //@ [x86_64] needs-llvm-components: x86 -//@ min-llvm-version: 21.0.0 #![crate_type = "lib"] #![feature(no_core)] diff --git a/tests/assembly-llvm/x86_64-windows-float-abi.rs b/tests/assembly-llvm/x86_64-windows-float-abi.rs index 8f5cc1e944861..51daff56789e6 100644 --- a/tests/assembly-llvm/x86_64-windows-float-abi.rs +++ b/tests/assembly-llvm/x86_64-windows-float-abi.rs @@ -37,8 +37,7 @@ pub extern "C" fn second_f64(_: f64, x: f64) -> f64 { } // CHECK-LABEL: second_f128 -// FIXME(llvm21): this can be just %rdx instead of the regex once we don't test on LLVM 20 -// CHECK: movaps {{(%xmm1|\(%rdx\))}}, %xmm0 +// CHECK: movaps (%rdx), %xmm0 // CHECK-NEXT: retq #[no_mangle] pub extern "C" fn second_f128(_: f128, x: f128) -> f128 { diff --git a/tests/codegen-llvm/cffi/c-variadic-va_list.rs b/tests/codegen-llvm/cffi/c-variadic-va_list.rs index b2f5ffc3495b4..0b3cda677ce20 100644 --- a/tests/codegen-llvm/cffi/c-variadic-va_list.rs +++ b/tests/codegen-llvm/cffi/c-variadic-va_list.rs @@ -1,6 +1,5 @@ //@ needs-unwind //@ compile-flags: -Copt-level=3 -//@ min-llvm-version: 21 #![crate_type = "lib"] #![feature(c_variadic)] diff --git a/tests/codegen-llvm/cffi/c-variadic.rs b/tests/codegen-llvm/cffi/c-variadic.rs index 7a2e2ba5047e8..5df256961de57 100644 --- a/tests/codegen-llvm/cffi/c-variadic.rs +++ b/tests/codegen-llvm/cffi/c-variadic.rs @@ -1,6 +1,5 @@ //@ needs-unwind //@ compile-flags: -C no-prepopulate-passes -Copt-level=0 -//@ min-llvm-version: 21 #![crate_type = "lib"] #![feature(c_variadic)] diff --git a/tests/codegen-llvm/dead_on_return.rs b/tests/codegen-llvm/dead_on_return.rs index 3c1940d6ba7c9..79f936550e89c 100644 --- a/tests/codegen-llvm/dead_on_return.rs +++ b/tests/codegen-llvm/dead_on_return.rs @@ -1,5 +1,4 @@ //@ compile-flags: -C opt-level=3 -//@ min-llvm-version: 21 #![crate_type = "lib"] #![allow(unused_assignments, unused_variables)] diff --git a/tests/codegen-llvm/deduced-param-attrs.rs b/tests/codegen-llvm/deduced-param-attrs.rs index b24c74a2f8403..6a5e79ae460ca 100644 --- a/tests/codegen-llvm/deduced-param-attrs.rs +++ b/tests/codegen-llvm/deduced-param-attrs.rs @@ -1,8 +1,5 @@ //@ compile-flags: -Copt-level=3 -Cno-prepopulate-passes //@ compile-flags: -Cpanic=abort -Csymbol-mangling-version=v0 -//@ revisions: LLVM21 LLVM20 -//@ [LLVM21] min-llvm-version: 21 -//@ [LLVM20] max-llvm-major-version: 20 #![feature(custom_mir, core_intrinsics, unboxed_closures)] #![crate_type = "lib"] extern crate core; @@ -37,15 +34,13 @@ pub fn mutate(mut b: Big) { black_box(&b); } -// LLVM21-LABEL: @deref_mut({{.*}}readonly {{.*}}captures(none) {{.*}}%c) -// LLVM20-LABEL: @deref_mut({{.*}}readonly {{.*}}%c) +// CHECK-LABEL: @deref_mut({{.*}}readonly {{.*}}captures(none) {{.*}}%c) #[unsafe(no_mangle)] pub fn deref_mut(c: (BigCell, &mut usize)) { *c.1 = 42; } -// LLVM21-LABEL: @call_copy_arg(ptr {{.*}}readonly {{.*}}captures(none){{.*}}) -// LLVM20-LABEL: @call_copy_arg(ptr {{.*}}readonly {{.*}}) +// CHECK-LABEL: @call_copy_arg(ptr {{.*}}readonly {{.*}}captures(none){{.*}}) #[unsafe(no_mangle)] #[custom_mir(dialect = "runtime", phase = "optimized")] pub fn call_copy_arg(a: Big) { @@ -61,7 +56,7 @@ pub fn call_copy_arg(a: Big) { // CHECK-LABEL: @call_move_arg( // CHECK-NOT: readonly -// LLVM21-SAME: captures(address) +// CHECK-SAME: captures(address) // CHECK-SAME: ) #[unsafe(no_mangle)] #[custom_mir(dialect = "runtime", phase = "optimized")] @@ -84,8 +79,7 @@ fn shared_borrow(a: T) { // // CHECK-LABEL: ; deduced_param_attrs::shared_borrow:: // CHECK-NEXT: ; -// LLVM21-NEXT: (ptr {{.*}}readonly {{.*}}captures(address) {{.*}}%a) -// LLVM20-NEXT: (ptr {{.*}}readonly {{.*}}%a) +// CHECK-NEXT: (ptr {{.*}}readonly {{.*}}captures(address) {{.*}}%a) pub static A0: fn(Big) = shared_borrow; // !Freeze parameter can be mutated through a shared borrow. @@ -113,16 +107,14 @@ fn consume(_: T) {} // // CHECK-LABEL: ; deduced_param_attrs::consume:: // CHECK-NEXT: ; -// LLVM21-NEXT: (ptr {{.*}}readonly {{.*}}captures(none) {{.*}}) -// LLVM20-NEXT: (ptr {{.*}}readonly {{.*}}) +// CHECK-NEXT: (ptr {{.*}}readonly {{.*}}captures(none) {{.*}}) pub static B0: fn(BigCell) = consume; // The parameter needs to be dropped. // // CHECK-LABEL: ; deduced_param_attrs::consume:: // CHECK-NEXT: ; -// LLVM21-NEXT: (ptr {{.*}}captures(address) {{.*}}) -// LLVM20-NEXT: (ptr {{.*}}) +// CHECK-NEXT: (ptr {{.*}}captures(address) {{.*}}) pub static B1: fn(BigDrop) = consume; fn consume_parts(t: (T, T)) { @@ -160,13 +152,13 @@ pub fn never_returns() -> [u8; 80] { loop {} } -// LLVM21-LABEL: @not_captured_return_place(ptr{{.*}} captures(none) {{.*}}%_0) +// CHECK-LABEL: @not_captured_return_place(ptr{{.*}} captures(none) {{.*}}%_0) #[unsafe(no_mangle)] pub fn not_captured_return_place() -> [u8; 80] { [0u8; 80] } -// LLVM21-LABEL: @captured_return_place(ptr{{.*}} captures(address) {{.*}}%_0) +// CHECK-LABEL: @captured_return_place(ptr{{.*}} captures(address) {{.*}}%_0) #[unsafe(no_mangle)] pub fn captured_return_place() -> [u8; 80] { black_box([0u8; 80]) diff --git a/tests/codegen-llvm/enum/enum-discriminant-eq.rs b/tests/codegen-llvm/enum/enum-discriminant-eq.rs index 68cd58643e84e..72fb7e00c902c 100644 --- a/tests/codegen-llvm/enum/enum-discriminant-eq.rs +++ b/tests/codegen-llvm/enum/enum-discriminant-eq.rs @@ -1,8 +1,5 @@ //@ compile-flags: -Copt-level=3 -Zmerge-functions=disabled //@ only-64bit -//@ revisions: LLVM20 LLVM21 -//@ [LLVM21] min-llvm-version: 21 -//@ [LLVM20] max-llvm-major-version: 20 // The `derive(PartialEq)` on enums with field-less variants compares discriminants, // so make sure we emit that in some reasonable way. @@ -92,21 +89,16 @@ pub fn mid_bool_eq_discr(a: Mid, b: Mid) -> bool { // CHECK: %[[A_NOT_HOLE:.+]] = icmp ne i8 %a, 3 // CHECK: tail call void @llvm.assume(i1 %[[A_NOT_HOLE]]) - // LLVM20: %[[A_REL_DISCR:.+]] = add nsw i8 %a, -2 // CHECK: %[[A_IS_NICHE:.+]] = icmp samesign ugt i8 %a, 1 - // LLVM20: %[[A_DISCR:.+]] = select i1 %[[A_IS_NICHE]], i8 %[[A_REL_DISCR]], i8 1 // CHECK: %[[B_NOT_HOLE:.+]] = icmp ne i8 %b, 3 // CHECK: tail call void @llvm.assume(i1 %[[B_NOT_HOLE]]) - // LLVM20: %[[B_REL_DISCR:.+]] = add nsw i8 %b, -2 // CHECK: %[[B_IS_NICHE:.+]] = icmp samesign ugt i8 %b, 1 - // LLVM20: %[[B_DISCR:.+]] = select i1 %[[B_IS_NICHE]], i8 %[[B_REL_DISCR]], i8 1 - // LLVM21: %[[A_MOD_DISCR:.+]] = select i1 %[[A_IS_NICHE]], i8 %a, i8 3 - // LLVM21: %[[B_MOD_DISCR:.+]] = select i1 %[[B_IS_NICHE]], i8 %b, i8 3 + // CHECK: %[[A_MOD_DISCR:.+]] = select i1 %[[A_IS_NICHE]], i8 %a, i8 3 + // CHECK: %[[B_MOD_DISCR:.+]] = select i1 %[[B_IS_NICHE]], i8 %b, i8 3 - // LLVM20: %[[R:.+]] = icmp eq i8 %[[A_DISCR]], %[[B_DISCR]] - // LLVM21: %[[R:.+]] = icmp eq i8 %[[A_MOD_DISCR]], %[[B_MOD_DISCR]] + // CHECK: %[[R:.+]] = icmp eq i8 %[[A_MOD_DISCR]], %[[B_MOD_DISCR]] // CHECK: ret i1 %[[R]] discriminant_value(&a) == discriminant_value(&b) } @@ -117,21 +109,16 @@ pub fn mid_ord_eq_discr(a: Mid, b: Mid) -> bool { // CHECK: %[[A_NOT_HOLE:.+]] = icmp ne i8 %a, 3 // CHECK: tail call void @llvm.assume(i1 %[[A_NOT_HOLE]]) - // LLVM20: %[[A_REL_DISCR:.+]] = add nsw i8 %a, -2 // CHECK: %[[A_IS_NICHE:.+]] = icmp sgt i8 %a, 1 - // LLVM20: %[[A_DISCR:.+]] = select i1 %[[A_IS_NICHE]], i8 %[[A_REL_DISCR]], i8 1 // CHECK: %[[B_NOT_HOLE:.+]] = icmp ne i8 %b, 3 // CHECK: tail call void @llvm.assume(i1 %[[B_NOT_HOLE]]) - // LLVM20: %[[B_REL_DISCR:.+]] = add nsw i8 %b, -2 // CHECK: %[[B_IS_NICHE:.+]] = icmp sgt i8 %b, 1 - // LLVM20: %[[B_DISCR:.+]] = select i1 %[[B_IS_NICHE]], i8 %[[B_REL_DISCR]], i8 1 - // LLVM21: %[[A_MOD_DISCR:.+]] = select i1 %[[A_IS_NICHE]], i8 %a, i8 3 - // LLVM21: %[[B_MOD_DISCR:.+]] = select i1 %[[B_IS_NICHE]], i8 %b, i8 3 + // CHECK: %[[A_MOD_DISCR:.+]] = select i1 %[[A_IS_NICHE]], i8 %a, i8 3 + // CHECK: %[[B_MOD_DISCR:.+]] = select i1 %[[B_IS_NICHE]], i8 %b, i8 3 - // LLVM20: %[[R:.+]] = icmp eq i8 %[[A_DISCR]], %[[B_DISCR]] - // LLVM21: %[[R:.+]] = icmp eq i8 %[[A_MOD_DISCR]], %[[B_MOD_DISCR]] + // CHECK: %[[R:.+]] = icmp eq i8 %[[A_MOD_DISCR]], %[[B_MOD_DISCR]] // CHECK: ret i1 %[[R]] discriminant_value(&a) == discriminant_value(&b) } @@ -150,18 +137,14 @@ pub fn mid_ac_eq_discr(a: Mid, b: Mid) -> bool { // CHECK: %[[A_NOT_HOLE:.+]] = icmp ne i8 %a, -127 // CHECK: tail call void @llvm.assume(i1 %[[A_NOT_HOLE]]) - // LLVM20: %[[A_REL_DISCR:.+]] = xor i8 %a, -128 // CHECK: %[[A_IS_NICHE:.+]] = icmp slt i8 %a, 0 - // LLVM20: %[[A_DISCR:.+]] = select i1 %[[A_IS_NICHE]], i8 %[[A_REL_DISCR]], i8 1 // CHECK: %[[B_NOT_HOLE:.+]] = icmp ne i8 %b, -127 // CHECK: tail call void @llvm.assume(i1 %[[B_NOT_HOLE]]) - // LLVM20: %[[B_REL_DISCR:.+]] = xor i8 %b, -128 // CHECK: %[[B_IS_NICHE:.+]] = icmp slt i8 %b, 0 - // LLVM20: %[[B_DISCR:.+]] = select i1 %[[B_IS_NICHE]], i8 %[[B_REL_DISCR]], i8 1 - // LLVM21: %[[A_DISCR:.+]] = select i1 %[[A_IS_NICHE]], i8 %a, i8 -127 - // LLVM21: %[[B_DISCR:.+]] = select i1 %[[B_IS_NICHE]], i8 %b, i8 -127 + // CHECK: %[[A_DISCR:.+]] = select i1 %[[A_IS_NICHE]], i8 %a, i8 -127 + // CHECK: %[[B_DISCR:.+]] = select i1 %[[B_IS_NICHE]], i8 %b, i8 -127 // CHECK: %[[R:.+]] = icmp eq i8 %[[A_DISCR]], %[[B_DISCR]] // CHECK: ret i1 %[[R]] @@ -177,22 +160,17 @@ pub fn mid_giant_eq_discr(a: Mid, b: Mid) -> bool { // CHECK: %[[A_NOT_HOLE:.+]] = icmp ne i128 %a, 6 // CHECK: tail call void @llvm.assume(i1 %[[A_NOT_HOLE]]) // CHECK: %[[A_TRUNC:.+]] = trunc nuw nsw i128 %a to i64 - // LLVM20: %[[A_REL_DISCR:.+]] = add nsw i64 %[[A_TRUNC]], -5 // CHECK: %[[A_IS_NICHE:.+]] = icmp samesign ugt i128 %a, 4 - // LLVM20: %[[A_DISCR:.+]] = select i1 %[[A_IS_NICHE]], i64 %[[A_REL_DISCR]], i64 1 // CHECK: %[[B_NOT_HOLE:.+]] = icmp ne i128 %b, 6 // CHECK: tail call void @llvm.assume(i1 %[[B_NOT_HOLE]]) // CHECK: %[[B_TRUNC:.+]] = trunc nuw nsw i128 %b to i64 - // LLVM20: %[[B_REL_DISCR:.+]] = add nsw i64 %[[B_TRUNC]], -5 // CHECK: %[[B_IS_NICHE:.+]] = icmp samesign ugt i128 %b, 4 - // LLVM20: %[[B_DISCR:.+]] = select i1 %[[B_IS_NICHE]], i64 %[[B_REL_DISCR]], i64 1 - // LLVM21: %[[A_MODIFIED_TAG:.+]] = select i1 %[[A_IS_NICHE]], i64 %[[A_TRUNC]], i64 6 - // LLVM21: %[[B_MODIFIED_TAG:.+]] = select i1 %[[B_IS_NICHE]], i64 %[[B_TRUNC]], i64 6 - // LLVM21: %[[R:.+]] = icmp eq i64 %[[A_MODIFIED_TAG]], %[[B_MODIFIED_TAG]] + // CHECK: %[[A_MODIFIED_TAG:.+]] = select i1 %[[A_IS_NICHE]], i64 %[[A_TRUNC]], i64 6 + // CHECK: %[[B_MODIFIED_TAG:.+]] = select i1 %[[B_IS_NICHE]], i64 %[[B_TRUNC]], i64 6 + // CHECK: %[[R:.+]] = icmp eq i64 %[[A_MODIFIED_TAG]], %[[B_MODIFIED_TAG]] - // LLVM20: %[[R:.+]] = icmp eq i64 %[[A_DISCR]], %[[B_DISCR]] // CHECK: ret i1 %[[R]] discriminant_value(&a) == discriminant_value(&b) } diff --git a/tests/codegen-llvm/issues/issue-101082.rs b/tests/codegen-llvm/issues/issue-101082.rs index 0c1f90f951a72..403fc9a558462 100644 --- a/tests/codegen-llvm/issues/issue-101082.rs +++ b/tests/codegen-llvm/issues/issue-101082.rs @@ -11,7 +11,6 @@ // at the time still sometimes fails, so only verify it for the power-of-two size // - https://github.com/llvm/llvm-project/issues/134735 //@[x86-64-v3] only-x86_64 -//@[x86-64-v3] min-llvm-version: 21 //@[x86-64-v3] compile-flags: -Ctarget-cpu=x86-64-v3 #![crate_type = "lib"] diff --git a/tests/codegen-llvm/issues/issue-122734-match-eq.rs b/tests/codegen-llvm/issues/issue-122734-match-eq.rs index 89858972677fe..643c2f959e3cb 100644 --- a/tests/codegen-llvm/issues/issue-122734-match-eq.rs +++ b/tests/codegen-llvm/issues/issue-122734-match-eq.rs @@ -1,4 +1,3 @@ -//@ min-llvm-version: 21 //@ compile-flags: -Copt-level=3 -Zmerge-functions=disabled //! Tests that matching + eq on `Option` produces a simple compare with no branching diff --git a/tests/codegen-llvm/issues/issue-138497-nonzero-remove-trailing-zeroes.rs b/tests/codegen-llvm/issues/issue-138497-nonzero-remove-trailing-zeroes.rs index 77cdbaf2bfe51..bd2c42ad2bdf2 100644 --- a/tests/codegen-llvm/issues/issue-138497-nonzero-remove-trailing-zeroes.rs +++ b/tests/codegen-llvm/issues/issue-138497-nonzero-remove-trailing-zeroes.rs @@ -1,7 +1,6 @@ //! This test checks that removing trailing zeroes from a `NonZero`, //! then creating a new `NonZero` from the result does not panic. -//@ min-llvm-version: 21 //@ compile-flags: -O -Zmerge-functions=disabled #![crate_type = "lib"] diff --git a/tests/codegen-llvm/issues/saturating-sub-index-139759.rs b/tests/codegen-llvm/issues/saturating-sub-index-139759.rs index eac2f4d306b93..8c2a4ce9ecb33 100644 --- a/tests/codegen-llvm/issues/saturating-sub-index-139759.rs +++ b/tests/codegen-llvm/issues/saturating-sub-index-139759.rs @@ -2,7 +2,6 @@ // index doesn't generate another bounds check. //@ compile-flags: -Copt-level=3 -//@ min-llvm-version: 21 #![crate_type = "lib"] diff --git a/tests/codegen-llvm/lib-optimizations/append-elements.rs b/tests/codegen-llvm/lib-optimizations/append-elements.rs index 5d7d746dbb6c1..47211e3f388a0 100644 --- a/tests/codegen-llvm/lib-optimizations/append-elements.rs +++ b/tests/codegen-llvm/lib-optimizations/append-elements.rs @@ -1,6 +1,5 @@ //@ compile-flags: -O -Zmerge-functions=disabled //@ needs-deterministic-layouts -//@ min-llvm-version: 21 //@ ignore-std-debug-assertions (causes different value naming) #![crate_type = "lib"] diff --git a/tests/codegen-llvm/option-niche-eq.rs b/tests/codegen-llvm/option-niche-eq.rs index e9c3fa2407e7e..377a5fb194875 100644 --- a/tests/codegen-llvm/option-niche-eq.rs +++ b/tests/codegen-llvm/option-niche-eq.rs @@ -1,6 +1,4 @@ -//@ revisions: REGULAR LLVM21 //@ compile-flags: -Copt-level=3 -Zmerge-functions=disabled -//@ [LLVM21] min-llvm-version: 21 #![crate_type = "lib"] extern crate core; @@ -76,11 +74,11 @@ pub fn niche_eq(l: Option, r: Option) -> bool { l == r } -// LLVM21-LABEL: @bool_eq +// CHECK-LABEL: @bool_eq #[no_mangle] pub fn bool_eq(l: Option, r: Option) -> bool { - // LLVM21: start: - // LLVM21-NEXT: icmp eq i8 - // LLVM21-NEXT: ret i1 + // CHECK: start: + // CHECK-NEXT: icmp eq i8 + // CHECK-NEXT: ret i1 l == r } diff --git a/tests/codegen-llvm/read-only-capture-opt.rs b/tests/codegen-llvm/read-only-capture-opt.rs index 78d56f8efc23a..b2680fb103f63 100644 --- a/tests/codegen-llvm/read-only-capture-opt.rs +++ b/tests/codegen-llvm/read-only-capture-opt.rs @@ -1,5 +1,4 @@ //@ compile-flags: -C opt-level=3 -Z mir-opt-level=0 -//@ min-llvm-version: 21 #![crate_type = "lib"] diff --git a/tests/codegen-llvm/riscv-abi/call-llvm-intrinsics.rs b/tests/codegen-llvm/riscv-abi/call-llvm-intrinsics.rs index fb520d38df3ca..c384eeae39fb0 100644 --- a/tests/codegen-llvm/riscv-abi/call-llvm-intrinsics.rs +++ b/tests/codegen-llvm/riscv-abi/call-llvm-intrinsics.rs @@ -5,7 +5,6 @@ //@ [riscv32gc] needs-llvm-components: riscv //@ [riscv64gc] compile-flags: --target riscv64gc-unknown-linux-gnu //@ [riscv64gc] needs-llvm-components: riscv -//@ min-llvm-version: 21 #![feature(link_llvm_intrinsics)] #![feature(no_core, lang_items)] diff --git a/tests/codegen-llvm/sanitizer/kcfi/add-kcfi-arity-flag.rs b/tests/codegen-llvm/sanitizer/kcfi/add-kcfi-arity-flag.rs index a8e3b034eae75..7a0e3b1da2506 100644 --- a/tests/codegen-llvm/sanitizer/kcfi/add-kcfi-arity-flag.rs +++ b/tests/codegen-llvm/sanitizer/kcfi/add-kcfi-arity-flag.rs @@ -5,7 +5,6 @@ //@ [x86_64] compile-flags: --target x86_64-unknown-none //@ [x86_64] needs-llvm-components: x86 //@ compile-flags: -Ctarget-feature=-crt-static -Cpanic=abort -Zsanitizer=kcfi -Zsanitizer-kcfi-arity -//@ min-llvm-version: 21.0.0 #![feature(no_core, lang_items)] #![crate_type = "lib"] diff --git a/tests/codegen-llvm/slice-range-indexing.rs b/tests/codegen-llvm/slice-range-indexing.rs index c4b3492dc4dc6..de28fa284f451 100644 --- a/tests/codegen-llvm/slice-range-indexing.rs +++ b/tests/codegen-llvm/slice-range-indexing.rs @@ -1,5 +1,4 @@ //@ compile-flags: -Copt-level=3 -//@ min-llvm-version: 21 #![crate_type = "lib"] diff --git a/tests/codegen-llvm/str-range-indexing.rs b/tests/codegen-llvm/str-range-indexing.rs index dee1a3a41c46e..5fa8e0dd17d3c 100644 --- a/tests/codegen-llvm/str-range-indexing.rs +++ b/tests/codegen-llvm/str-range-indexing.rs @@ -1,5 +1,4 @@ //@ compile-flags: -Copt-level=3 -//@ min-llvm-version: 21 #![crate_type = "lib"] diff --git a/tests/codegen-llvm/vec-calloc.rs b/tests/codegen-llvm/vec-calloc.rs index 4e893cc736c90..0203590174151 100644 --- a/tests/codegen-llvm/vec-calloc.rs +++ b/tests/codegen-llvm/vec-calloc.rs @@ -1,6 +1,4 @@ -//@ revisions: normal llvm21 //@ compile-flags: -Copt-level=3 -Z merge-functions=disabled -//@ [llvm21] min-llvm-version: 21 //@ only-x86_64 #![crate_type = "lib"] @@ -178,21 +176,20 @@ pub fn vec_option_i32(n: usize) -> Vec> { vec![None; n] } -// LLVM21-LABEL: @vec_array -#[cfg(llvm21)] +// CHECK-LABEL: @vec_array #[no_mangle] pub fn vec_array(n: usize) -> Vec<[u32; 1_000_000]> { - // LLVM21-NOT: call {{.*}}alloc::vec::from_elem - // LLVM21-NOT: call {{.*}}reserve - // LLVM21-NOT: call {{.*}}__rust_alloc( + // CHECK-NOT: call {{.*}}alloc::vec::from_elem + // CHECK-NOT: call {{.*}}reserve + // CHECK-NOT: call {{.*}}__rust_alloc( - // LLVM21: call {{.*}}__rust_alloc_zeroed( + // CHECK: call {{.*}}__rust_alloc_zeroed( - // LLVM21-NOT: call {{.*}}alloc::vec::from_elem - // LLVM21-NOT: call {{.*}}reserve - // LLVM21-NOT: call {{.*}}__rust_alloc( + // CHECK-NOT: call {{.*}}alloc::vec::from_elem + // CHECK-NOT: call {{.*}}reserve + // CHECK-NOT: call {{.*}}__rust_alloc( - // LLVM21: ret void + // CHECK: ret void vec![[0; 1_000_000]; 3] } diff --git a/tests/run-make/repr128-dwarf/main.rs b/tests/run-make/repr128-dwarf/main.rs index a8a414fd72e40..a50c950a0c40a 100644 --- a/tests/run-make/repr128-dwarf/main.rs +++ b/tests/run-make/repr128-dwarf/main.rs @@ -17,7 +17,6 @@ pub enum I128Enum { I128D = i128::MAX.to_le(), } -#[cfg(not(old_llvm))] #[repr(u128)] pub enum U128VariantEnum { VariantU128A(u8) = 0_u128.to_le(), @@ -26,7 +25,6 @@ pub enum U128VariantEnum { VariantU128D = u128::MAX.to_le(), } -#[cfg(not(old_llvm))] #[repr(i128)] pub enum I128VariantEnum { VariantI128A(u8) = 0_i128.to_le(), @@ -37,13 +35,9 @@ pub enum I128VariantEnum { pub fn f(_: U128Enum, _: I128Enum) {} -#[cfg(not(old_llvm))] pub fn g(_: U128VariantEnum, _: I128VariantEnum) {} fn main() { f(U128Enum::U128A, I128Enum::I128A); - #[cfg(not(old_llvm))] - { - g(U128VariantEnum::VariantU128A(1), I128VariantEnum::VariantI128A(2)); - } + g(U128VariantEnum::VariantU128A(1), I128VariantEnum::VariantI128A(2)); } diff --git a/tests/run-make/repr128-dwarf/rmake.rs b/tests/run-make/repr128-dwarf/rmake.rs index 96c65d7d89773..38c69d5107337 100644 --- a/tests/run-make/repr128-dwarf/rmake.rs +++ b/tests/run-make/repr128-dwarf/rmake.rs @@ -13,25 +13,8 @@ use object::{Object, ObjectSection}; use run_make_support::{gimli, object, rfs, rustc}; fn main() { - // Before LLVM 20, 128-bit enums with variants didn't emit debuginfo correctly. - // This check can be removed once Rust no longer supports LLVM 18 and 19. - let llvm_version = rustc() - .verbose() - .arg("--version") - .run() - .stdout_utf8() - .lines() - .filter_map(|line| line.strip_prefix("LLVM version: ")) - .map(|version| version.split(".").next().unwrap().parse::().unwrap()) - .next() - .unwrap(); - let is_old_llvm = llvm_version < 20; - let output = PathBuf::from("repr128"); let mut rustc = rustc(); - if is_old_llvm { - rustc.cfg("old_llvm"); - } rustc.input("main.rs").output(&output).arg("-Cdebuginfo=2").run(); // Mach-O uses packed debug info let dsym_location = output @@ -88,7 +71,7 @@ fn main() { while let Some((_, entry)) = cursor.next_dfs().unwrap() { match entry.tag() { - gimli::constants::DW_TAG_variant if !is_old_llvm => { + gimli::constants::DW_TAG_variant => { let Some(value) = entry.attr(gimli::constants::DW_AT_discr_value).unwrap() else { // `std` enums might have variants without `DW_AT_discr_value`. @@ -143,7 +126,7 @@ fn main() { if !enumerators_to_find.is_empty() { panic!("Didn't find debug enumerator entries for {enumerators_to_find:?}"); } - if !is_old_llvm && !variants_to_find.is_empty() { + if !variants_to_find.is_empty() { panic!("Didn't find debug variant entries for {variants_to_find:?}"); } } diff --git a/tests/ui/sanitizer/kcfi-arity-requires-llvm-21-0-0.rs b/tests/ui/sanitizer/kcfi-arity-requires-llvm-21-0-0.rs deleted file mode 100644 index c3046708e4eba..0000000000000 --- a/tests/ui/sanitizer/kcfi-arity-requires-llvm-21-0-0.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Verifies that `-Zsanitizer-kcfi-arity` requires LLVM 21.0.0 or later. -// -//@ needs-sanitizer-kcfi -//@ compile-flags: -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Cpanic=abort -Zsanitizer=kcfi -Zsanitizer-kcfi-arity -//@ build-fail -//@ max-llvm-major-version: 20 - -//~? ERROR `-Zsanitizer-kcfi-arity` requires LLVM 21.0.0 or later -#![feature(no_core)] -#![no_core] -#![no_main] diff --git a/tests/ui/sanitizer/kcfi-arity-requires-llvm-21-0-0.stderr b/tests/ui/sanitizer/kcfi-arity-requires-llvm-21-0-0.stderr deleted file mode 100644 index c5f886e3a3907..0000000000000 --- a/tests/ui/sanitizer/kcfi-arity-requires-llvm-21-0-0.stderr +++ /dev/null @@ -1,4 +0,0 @@ -error: `-Zsanitizer-kcfi-arity` requires LLVM 21.0.0 or later - -error: aborting due to 1 previous error -