authorbors <bors@rust-lang.org> 2026-03-13 10:36:35 UTC
committerbors <bors@rust-lang.org> 2026-03-13 10:36:35 UTC
log8db65c71725664d85d06ec96ee3e575665de1f6a
treecd1cdb599eb6e534862bd5ca832a94b6d1ded5b1
parenteaf4e7489b6ae3d4ba9a71b720b03b6d58e4f102
parent52dfa94cdcd3ed16f31c6afbf406826e2c5688dd

Auto merge of #153684 - cuviper:min-llvm-21, r=nikic

Update the minimum external LLVM to 21 With this change, we'll have stable support for LLVM 21 and 22. For reference, the previous increase to LLVM 20 was rust-lang/rust#145071. cc @rust-lang/wg-llvm r? nikic

39 files changed, 120 insertions(+), 391 deletions(-)

compiler/rustc_codegen_llvm/src/abi.rs+11-16
......@@ -23,7 +23,6 @@ use crate::attributes::{self, llfn_attrs_from_instance};
2323use crate::builder::Builder;
2424use crate::context::CodegenCx;
2525use crate::llvm::{self, Attribute, AttributePlace, Type, Value};
26use crate::llvm_util;
2726use crate::type_of::LayoutLlvmExt;
2827
2928trait ArgAttributesExt {
......@@ -46,6 +45,12 @@ const OPTIMIZATION_ATTRIBUTES: [(ArgAttribute, llvm::AttributeKind); 4] = [
4645 (ArgAttribute::NoUndef, llvm::AttributeKind::NoUndef),
4746];
4847
48const CAPTURES_ATTRIBUTES: [(ArgAttribute, llvm::AttributeKind); 3] = [
49 (ArgAttribute::CapturesNone, llvm::AttributeKind::CapturesNone),
50 (ArgAttribute::CapturesAddress, llvm::AttributeKind::CapturesAddress),
51 (ArgAttribute::CapturesReadOnly, llvm::AttributeKind::CapturesReadOnly),
52];
53
4954fn get_attrs<'ll>(this: &ArgAttributes, cx: &CodegenCx<'ll, '_>) -> SmallVec<[&'ll Attribute; 8]> {
5055 let mut regular = this.regular;
5156
......@@ -82,18 +87,10 @@ fn get_attrs<'ll>(this: &ArgAttributes, cx: &CodegenCx<'ll, '_>) -> SmallVec<[&'
8287 attrs.push(llattr.create_attr(cx.llcx));
8388 }
8489 }
85 // captures(...) is only available since LLVM 21.
86 if (21, 0, 0) <= llvm_util::get_version() {
87 const CAPTURES_ATTRIBUTES: [(ArgAttribute, llvm::AttributeKind); 3] = [
88 (ArgAttribute::CapturesNone, llvm::AttributeKind::CapturesNone),
89 (ArgAttribute::CapturesAddress, llvm::AttributeKind::CapturesAddress),
90 (ArgAttribute::CapturesReadOnly, llvm::AttributeKind::CapturesReadOnly),
91 ];
92 for (attr, llattr) in CAPTURES_ATTRIBUTES {
93 if regular.contains(attr) {
94 attrs.push(llattr.create_attr(cx.llcx));
95 break;
96 }
90 for (attr, llattr) in CAPTURES_ATTRIBUTES {
91 if regular.contains(attr) {
92 attrs.push(llattr.create_attr(cx.llcx));
93 break;
9794 }
9895 }
9996 } else if cx.tcx.sess.sanitizers().contains(SanitizerSet::MEMORY) {
......@@ -508,9 +505,7 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
508505 }
509506 PassMode::Indirect { attrs, meta_attrs: None, on_stack: false } => {
510507 let i = apply(attrs);
511 if cx.sess().opts.optimize != config::OptLevel::No
512 && llvm_util::get_version() >= (21, 0, 0)
513 {
508 if cx.sess().opts.optimize != config::OptLevel::No {
514509 attributes::apply_to_llfn(
515510 llfn,
516511 llvm::AttributePlace::Argument(i),
compiler/rustc_codegen_llvm/src/attributes.rs+5-9
......@@ -506,15 +506,11 @@ pub(crate) fn llfn_attrs_from_instance<'ll, 'tcx>(
506506 to_add.push(llvm::CreateAllocKindAttr(cx.llcx, AllocKindFlags::Free));
507507 // applies to argument place instead of function place
508508 let allocated_pointer = AttributeKind::AllocatedPointer.create_attr(cx.llcx);
509 let attrs: &[_] = if llvm_util::get_version() >= (21, 0, 0) {
510 // "Does not capture provenance" means "if the function call stashes the pointer somewhere,
511 // accessing that pointer after the function returns is UB". That is definitely the case here since
512 // freeing will destroy the provenance.
513 let captures_addr = AttributeKind::CapturesAddress.create_attr(cx.llcx);
514 &[allocated_pointer, captures_addr]
515 } else {
516 &[allocated_pointer]
517 };
509 // "Does not capture provenance" means "if the function call stashes the pointer somewhere,
510 // accessing that pointer after the function returns is UB". That is definitely the case here since
511 // freeing will destroy the provenance.
512 let captures_addr = AttributeKind::CapturesAddress.create_attr(cx.llcx);
513 let attrs = &[allocated_pointer, captures_addr];
518514 attributes::apply_to_llfn(llfn, AttributePlace::Argument(0), attrs);
519515 }
520516 if let Some(align) = codegen_fn_attrs.alignment {
compiler/rustc_codegen_llvm/src/context.rs-16
......@@ -190,17 +190,6 @@ pub(crate) unsafe fn create_module<'ll>(
190190 let mut target_data_layout = sess.target.data_layout.to_string();
191191 let llvm_version = llvm_util::get_version();
192192
193 if llvm_version < (21, 0, 0) {
194 if sess.target.arch == Arch::Nvptx64 {
195 // LLVM 21 updated the default layout on nvptx: https://github.com/llvm/llvm-project/pull/124961
196 target_data_layout = target_data_layout.replace("e-p6:32:32-i64", "e-i64");
197 }
198 if sess.target.arch == Arch::AmdGpu {
199 // LLVM 21 adds the address width for address space 8.
200 // See https://github.com/llvm/llvm-project/pull/139419
201 target_data_layout = target_data_layout.replace("p8:128:128:128:48", "p8:128:128")
202 }
203 }
204193 if llvm_version < (22, 0, 0) {
205194 if sess.target.arch == Arch::Avr {
206195 // 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>(
342331 // Add "kcfi-arity" module flag if KCFI arity indicator is enabled. (See
343332 // https://github.com/llvm/llvm-project/pull/117121.)
344333 if sess.is_sanitizer_kcfi_arity_enabled() {
345 // KCFI arity indicator requires LLVM 21.0.0 or later.
346 if llvm_version < (21, 0, 0) {
347 tcx.dcx().emit_err(crate::errors::SanitizerKcfiArityRequiresLLVM2100);
348 }
349
350334 llvm::add_module_flag_u32(
351335 llmod,
352336 llvm::ModuleFlagMergeBehavior::Override,
compiler/rustc_codegen_llvm/src/errors.rs-4
......@@ -204,7 +204,3 @@ pub(crate) struct MismatchedDataLayout<'a> {
204204pub(crate) struct FixedX18InvalidArch<'a> {
205205 pub arch: &'a str,
206206}
207
208#[derive(Diagnostic)]
209#[diag("`-Zsanitizer-kcfi-arity` requires LLVM 21.0.0 or later")]
210pub(crate) struct SanitizerKcfiArityRequiresLLVM2100;
compiler/rustc_codegen_llvm/src/llvm_util.rs-20
......@@ -254,10 +254,6 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option<LLVMFea
254254 },
255255
256256 // Filter out features that are not supported by the current LLVM version
257 Arch::LoongArch32 | Arch::LoongArch64 => match s {
258 "32s" if major < 21 => None,
259 s => Some(LLVMFeature::new(s)),
260 },
261257 Arch::PowerPC | Arch::PowerPC64 => match s {
262258 "power8-crypto" => Some(LLVMFeature::new("crypto")),
263259 s => Some(LLVMFeature::new(s)),
......@@ -372,23 +368,12 @@ fn update_target_reliable_float_cfg(sess: &Session, cfg: &mut TargetConfig) {
372368 let (major, _, _) = version;
373369
374370 cfg.has_reliable_f16 = match (target_arch, target_os) {
375 // LLVM crash without neon <https://github.com/llvm/llvm-project/issues/129394> (fixed in LLVM 20.1.1)
376 (Arch::AArch64, _)
377 if !cfg.target_features.iter().any(|f| f.as_str() == "neon")
378 && version < (20, 1, 1) =>
379 {
380 false
381 }
382371 // Unsupported <https://github.com/llvm/llvm-project/issues/94434> (fixed in llvm22)
383372 (Arch::Arm64EC, _) if major < 22 => false,
384 // Selection failure <https://github.com/llvm/llvm-project/issues/50374> (fixed in llvm21)
385 (Arch::S390x, _) if major < 21 => false,
386373 // MinGW ABI bugs <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115054>
387374 (Arch::X86_64, Os::Windows) if *target_env == Env::Gnu && *target_abi != Abi::Llvm => false,
388375 // Infinite recursion <https://github.com/llvm/llvm-project/issues/97981>
389376 (Arch::CSky, _) if major < 22 => false, // (fixed in llvm22)
390 (Arch::Hexagon, _) if major < 21 => false, // (fixed in llvm21)
391 (Arch::LoongArch32 | Arch::LoongArch64, _) if major < 21 => false, // (fixed in llvm21)
392377 (Arch::PowerPC | Arch::PowerPC64, _) if major < 22 => false, // (fixed in llvm22)
393378 (Arch::Sparc | Arch::Sparc64, _) if major < 22 => false, // (fixed in llvm22)
394379 (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) {
403388 (Arch::AmdGpu, _) => false,
404389 // Unsupported <https://github.com/llvm/llvm-project/issues/94434>
405390 (Arch::Arm64EC, _) => false,
406 // Selection bug <https://github.com/llvm/llvm-project/issues/96432> (fixed in LLVM 20.1.0)
407 (Arch::Mips64 | Arch::Mips64r6, _) if version < (20, 1, 0) => false,
408391 // Selection bug <https://github.com/llvm/llvm-project/issues/95471>. This issue is closed
409392 // but basic math still does not work.
410393 (Arch::Nvptx64, _) => false,
......@@ -413,9 +396,6 @@ fn update_target_reliable_float_cfg(sess: &Session, cfg: &mut TargetConfig) {
413396 (Arch::PowerPC | Arch::PowerPC64, _) => false,
414397 // ABI unsupported <https://github.com/llvm/llvm-project/issues/41838>
415398 (Arch::Sparc, _) => false,
416 // Stack alignment bug <https://github.com/llvm/llvm-project/issues/77401>. NB: tests may
417 // not fail if our compiler-builtins is linked. (fixed in llvm21)
418 (Arch::X86, _) if major < 21 => false,
419399 // MinGW ABI bugs <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115054>
420400 (Arch::X86_64, Os::Windows) if *target_env == Env::Gnu && *target_abi != Abi::Llvm => false,
421401 // There are no known problems on other platforms, so the only requirement is that symbols
compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp+1-28
......@@ -301,12 +301,7 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
301301
302302 std::string Error;
303303 auto Trip = Triple(Triple::normalize(TripleStr));
304 const llvm::Target *TheTarget =
305#if LLVM_VERSION_GE(21, 0)
306 TargetRegistry::lookupTarget(Trip, Error);
307#else
308 TargetRegistry::lookupTarget(Trip.getTriple(), Error);
309#endif
304 const llvm::Target *TheTarget = TargetRegistry::lookupTarget(Trip, Error);
310305 if (TheTarget == nullptr) {
311306 LLVMRustSetLastError(Error.c_str());
312307 return nullptr;
......@@ -367,13 +362,8 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
367362
368363 Options.EmitStackSizeSection = EmitStackSizeSection;
369364
370#if LLVM_VERSION_GE(21, 0)
371365 TargetMachine *TM = TheTarget->createTargetMachine(Trip, CPU, Feature,
372366 Options, RM, CM, OptLevel);
373#else
374 TargetMachine *TM = TheTarget->createTargetMachine(
375 Trip.getTriple(), CPU, Feature, Options, RM, CM, OptLevel);
376#endif
377367
378368 if (LargeDataThreshold != 0) {
379369 TM->setLargeDataThreshold(LargeDataThreshold);
......@@ -701,12 +691,8 @@ extern "C" LLVMRustResult LLVMRustOptimize(
701691 if (LintIR) {
702692 PipelineStartEPCallbacks.push_back([](ModulePassManager &MPM,
703693 OptimizationLevel Level) {
704#if LLVM_VERSION_GE(21, 0)
705694 MPM.addPass(
706695 createModuleToFunctionPassAdaptor(LintPass(/*AbortOnError=*/true)));
707#else
708 MPM.addPass(createModuleToFunctionPassAdaptor(LintPass()));
709#endif
710696 });
711697 }
712698
......@@ -1210,12 +1196,8 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules, size_t num_modules,
12101196 // Convert the preserved symbols set from string to GUID, this is then needed
12111197 // for internalization.
12121198 for (size_t i = 0; i < num_symbols; i++) {
1213#if LLVM_VERSION_GE(21, 0)
12141199 auto GUID =
12151200 GlobalValue::getGUIDAssumingExternalLinkage(preserved_symbols[i]);
1216#else
1217 auto GUID = GlobalValue::getGUID(preserved_symbols[i]);
1218#endif
12191201 Ret->GUIDPreservedSymbols.insert(GUID);
12201202 }
12211203
......@@ -1474,21 +1456,12 @@ extern "C" void LLVMRustComputeLTOCacheKey(RustStringRef KeyOut,
14741456 DenseSet<GlobalValue::GUID> CfiFunctionDecls;
14751457
14761458 // Based on the 'InProcessThinBackend' constructor in LLVM
1477#if LLVM_VERSION_GE(21, 0)
14781459 for (auto &Name : Data->Index.cfiFunctionDefs().symbols())
14791460 CfiFunctionDefs.insert(GlobalValue::getGUIDAssumingExternalLinkage(
14801461 GlobalValue::dropLLVMManglingEscape(Name)));
14811462 for (auto &Name : Data->Index.cfiFunctionDecls().symbols())
14821463 CfiFunctionDecls.insert(GlobalValue::getGUIDAssumingExternalLinkage(
14831464 GlobalValue::dropLLVMManglingEscape(Name)));
1484#else
1485 for (auto &Name : Data->Index.cfiFunctionDefs())
1486 CfiFunctionDefs.insert(
1487 GlobalValue::getGUID(GlobalValue::dropLLVMManglingEscape(Name)));
1488 for (auto &Name : Data->Index.cfiFunctionDecls())
1489 CfiFunctionDecls.insert(
1490 GlobalValue::getGUID(GlobalValue::dropLLVMManglingEscape(Name)));
1491#endif
14921465
14931466 Key = llvm::computeLTOCacheKey(conf, Data->Index, ModId, ImportList,
14941467 ExportList, ResolvedODR, DefinedGlobals,
compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp-10
......@@ -137,11 +137,7 @@ extern "C" void LLVMRustSetLastError(const char *Err) {
137137
138138extern "C" void LLVMRustSetNormalizedTarget(LLVMModuleRef M,
139139 const char *Target) {
140#if LLVM_VERSION_GE(21, 0)
141140 unwrap(M)->setTargetTriple(Triple(Triple::normalize(Target)));
142#else
143 unwrap(M)->setTargetTriple(Triple::normalize(Target));
144#endif
145141}
146142
147143extern "C" void LLVMRustPrintPassTimings(RustStringRef OutBuf) {
......@@ -452,11 +448,7 @@ static Attribute::AttrKind fromRust(LLVMRustAttributeKind Kind) {
452448 case LLVMRustAttributeKind::DeadOnUnwind:
453449 return Attribute::DeadOnUnwind;
454450 case LLVMRustAttributeKind::DeadOnReturn:
455#if LLVM_VERSION_GE(21, 0)
456451 return Attribute::DeadOnReturn;
457#else
458 report_fatal_error("DeadOnReturn attribute requires LLVM 21 or later");
459#endif
460452 case LLVMRustAttributeKind::CapturesAddress:
461453 case LLVMRustAttributeKind::CapturesReadOnly:
462454 case LLVMRustAttributeKind::CapturesNone:
......@@ -514,7 +506,6 @@ extern "C" void LLVMRustEraseInstFromParent(LLVMValueRef Instr) {
514506
515507extern "C" LLVMAttributeRef
516508LLVMRustCreateAttrNoValue(LLVMContextRef C, LLVMRustAttributeKind RustAttr) {
517#if LLVM_VERSION_GE(21, 0)
518509 if (RustAttr == LLVMRustAttributeKind::CapturesNone) {
519510 return wrap(Attribute::getWithCaptureInfo(*unwrap(C), CaptureInfo::none()));
520511 }
......@@ -527,7 +518,6 @@ LLVMRustCreateAttrNoValue(LLVMContextRef C, LLVMRustAttributeKind RustAttr) {
527518 *unwrap(C), CaptureInfo(CaptureComponents::Address |
528519 CaptureComponents::ReadProvenance)));
529520 }
530#endif
531521#if LLVM_VERSION_GE(23, 0)
532522 if (RustAttr == LLVMRustAttributeKind::DeadOnReturn) {
533523 return wrap(Attribute::getWithDeadOnReturnInfo(*unwrap(C),
src/bootstrap/src/core/build_steps/llvm.rs+2-2
......@@ -631,11 +631,11 @@ fn check_llvm_version(builder: &Builder<'_>, llvm_config: &Path) {
631631 let version = get_llvm_version(builder, llvm_config);
632632 let mut parts = version.split('.').take(2).filter_map(|s| s.parse::<u32>().ok());
633633 if let (Some(major), Some(_minor)) = (parts.next(), parts.next())
634 && major >= 20
634 && major >= 21
635635 {
636636 return;
637637 }
638 panic!("\n\nbad LLVM version: {version}, need >=20\n\n")
638 panic!("\n\nbad LLVM version: {version}, need >=21\n\n")
639639}
640640
641641fn configure_cmake(
src/ci/docker/README.md+4-4
......@@ -14,9 +14,9 @@ To run a specific CI job locally, you can use the `citool` Rust crate:
1414cargo run --manifest-path src/ci/citool/Cargo.toml run-local <job-name>
1515```
1616
17For example, to run the `x86_64-gnu-llvm-20-1` job:
17For example, to run the `x86_64-gnu-llvm-21-1` job:
1818```
19cargo run --manifest-path src/ci/citool/Cargo.toml run-local x86_64-gnu-llvm-20-1
19cargo run --manifest-path src/ci/citool/Cargo.toml run-local x86_64-gnu-llvm-21-1
2020```
2121
2222The job will output artifacts in an `obj/<image-name>` dir at the root of a repository. Note
......@@ -27,10 +27,10 @@ Docker image executed in the given CI job.
2727while locally, to the `obj/<image-name>` directory. This is primarily to prevent
2828strange linker errors when using multiple Docker images.
2929
30For 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:
30For 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:
3131
3232```
33DOCKER_SCRIPT=x86_64-gnu-llvm3.sh ./src/ci/docker/run.sh x86_64-gnu-llvm-20
33DOCKER_SCRIPT=x86_64-gnu-llvm3.sh ./src/ci/docker/run.sh x86_64-gnu-llvm-21
3434```
3535
3636## Local Development
src/ci/docker/host-aarch64/aarch64-gnu-llvm-20/Dockerfile deleted-55
......@@ -1,55 +0,0 @@
1FROM ubuntu:25.10
2
3ARG DEBIAN_FRONTEND=noninteractive
4
5RUN apt-get update && apt-get install -y --no-install-recommends \
6 bzip2 \
7 g++ \
8 make \
9 ninja-build \
10 file \
11 curl \
12 ca-certificates \
13 python3 \
14 git \
15 cmake \
16 sudo \
17 gdb \
18 llvm-20-tools \
19 llvm-20-dev \
20 libedit-dev \
21 libssl-dev \
22 pkg-config \
23 zlib1g-dev \
24 xz-utils \
25 nodejs \
26 mingw-w64 \
27 # libgccjit dependencies
28 flex \
29 libmpfr-dev \
30 libgmp-dev \
31 libmpc3 \
32 libmpc-dev \
33 && rm -rf /var/lib/apt/lists/*
34
35COPY scripts/sccache.sh /scripts/
36RUN sh /scripts/sccache.sh
37
38# We are disabling CI LLVM since this builder is intentionally using a host
39# LLVM, rather than the typical src/llvm-project LLVM.
40ENV NO_DOWNLOAD_CI_LLVM="1"
41ENV EXTERNAL_LLVM="1"
42
43# Using llvm-link-shared due to libffi issues -- see #34486
44ENV RUST_CONFIGURE_ARGS="--build=aarch64-unknown-linux-gnu \
45 --llvm-root=/usr/lib/llvm-20 \
46 --enable-llvm-link-shared \
47 --set rust.randomize-layout=true \
48 --set rust.thin-lto-import-instr-limit=10"
49
50COPY scripts/shared.sh /scripts/
51
52COPY scripts/stage_2_test_set1.sh /scripts/
53COPY scripts/stage_2_test_set2.sh /scripts/
54
55ENV SCRIPT="Must specify DOCKER_SCRIPT for this image"
src/ci/docker/host-aarch64/aarch64-gnu-llvm-21/Dockerfile created+55
......@@ -0,0 +1,55 @@
1FROM ubuntu:25.10
2
3ARG DEBIAN_FRONTEND=noninteractive
4
5RUN apt-get update && apt-get install -y --no-install-recommends \
6 bzip2 \
7 g++ \
8 make \
9 ninja-build \
10 file \
11 curl \
12 ca-certificates \
13 python3 \
14 git \
15 cmake \
16 sudo \
17 gdb \
18 llvm-21-tools \
19 llvm-21-dev \
20 libedit-dev \
21 libssl-dev \
22 pkg-config \
23 zlib1g-dev \
24 xz-utils \
25 nodejs \
26 mingw-w64 \
27 # libgccjit dependencies
28 flex \
29 libmpfr-dev \
30 libgmp-dev \
31 libmpc3 \
32 libmpc-dev \
33 && rm -rf /var/lib/apt/lists/*
34
35COPY scripts/sccache.sh /scripts/
36RUN sh /scripts/sccache.sh
37
38# We are disabling CI LLVM since this builder is intentionally using a host
39# LLVM, rather than the typical src/llvm-project LLVM.
40ENV NO_DOWNLOAD_CI_LLVM="1"
41ENV EXTERNAL_LLVM="1"
42
43# Using llvm-link-shared due to libffi issues -- see #34486
44ENV RUST_CONFIGURE_ARGS="--build=aarch64-unknown-linux-gnu \
45 --llvm-root=/usr/lib/llvm-21 \
46 --enable-llvm-link-shared \
47 --set rust.randomize-layout=true \
48 --set rust.thin-lto-import-instr-limit=10"
49
50COPY scripts/shared.sh /scripts/
51
52COPY scripts/stage_2_test_set1.sh /scripts/
53COPY scripts/stage_2_test_set2.sh /scripts/
54
55ENV SCRIPT="Must specify DOCKER_SCRIPT for this image"
src/ci/docker/host-x86_64/x86_64-gnu-llvm-20/Dockerfile deleted-66
......@@ -1,66 +0,0 @@
1FROM ubuntu:25.04
2
3ARG DEBIAN_FRONTEND=noninteractive
4
5RUN apt-get update && apt-get install -y --no-install-recommends \
6 bzip2 \
7 g++ \
8 gcc-multilib \
9 make \
10 ninja-build \
11 file \
12 curl \
13 ca-certificates \
14 python3 \
15 git \
16 cmake \
17 sudo \
18 gdb \
19 llvm-20-tools \
20 llvm-20-dev \
21 libedit-dev \
22 libssl-dev \
23 pkg-config \
24 zlib1g-dev \
25 xz-utils \
26 nodejs \
27 mingw-w64 \
28 # libgccjit dependencies
29 flex \
30 libmpfr-dev \
31 libgmp-dev \
32 libmpc3 \
33 libmpc-dev \
34 && rm -rf /var/lib/apt/lists/*
35
36# Install powershell (universal package) so we can test x.ps1 on Linux
37# FIXME: need a "universal" version that supports libicu74, but for now it still works to ignore that dep.
38RUN curl -sL "https://github.com/PowerShell/PowerShell/releases/download/v7.3.1/powershell_7.3.1-1.deb_amd64.deb" > powershell.deb && \
39 dpkg --ignore-depends=libicu72 -i powershell.deb && \
40 rm -f powershell.deb
41
42COPY scripts/sccache.sh /scripts/
43RUN sh /scripts/sccache.sh
44
45# We are disabling CI LLVM since this builder is intentionally using a host
46# LLVM, rather than the typical src/llvm-project LLVM.
47ENV NO_DOWNLOAD_CI_LLVM 1
48ENV EXTERNAL_LLVM 1
49
50# Using llvm-link-shared due to libffi issues -- see #34486
51ENV RUST_CONFIGURE_ARGS \
52 --build=x86_64-unknown-linux-gnu \
53 --llvm-root=/usr/lib/llvm-20 \
54 --enable-llvm-link-shared \
55 --set rust.randomize-layout=true \
56 --set rust.thin-lto-import-instr-limit=10
57
58COPY scripts/shared.sh /scripts/
59
60COPY scripts/x86_64-gnu-llvm.sh /scripts/
61COPY scripts/x86_64-gnu-llvm2.sh /scripts/
62COPY scripts/x86_64-gnu-llvm3.sh /scripts/
63COPY scripts/stage_2_test_set1.sh /scripts/
64COPY scripts/stage_2_test_set2.sh /scripts/
65
66ENV SCRIPT "Must specify DOCKER_SCRIPT for this image"
src/ci/github-actions/jobs.yml+5-30
......@@ -122,19 +122,19 @@ pr:
122122 # tidy. This speeds up the PR CI job by ~1 minute.
123123 SKIP_SUBMODULES: src/gcc
124124 <<: *job-linux-4c
125 - name: x86_64-gnu-llvm-20
125 - name: x86_64-gnu-llvm-21
126126 env:
127127 ENABLE_GCC_CODEGEN: "1"
128128 DOCKER_SCRIPT: x86_64-gnu-llvm.sh
129129 <<: *job-linux-4c
130 - name: aarch64-gnu-llvm-20-1
130 - name: aarch64-gnu-llvm-21-1
131131 env:
132 IMAGE: aarch64-gnu-llvm-20
132 IMAGE: aarch64-gnu-llvm-21
133133 DOCKER_SCRIPT: stage_2_test_set1.sh
134134 <<: *job-aarch64-linux
135 - name: aarch64-gnu-llvm-20-2
135 - name: aarch64-gnu-llvm-21-2
136136 env:
137 IMAGE: aarch64-gnu-llvm-20
137 IMAGE: aarch64-gnu-llvm-21
138138 DOCKER_SCRIPT: stage_2_test_set2.sh
139139 <<: *job-aarch64-linux
140140 - name: x86_64-gnu-tools
......@@ -381,31 +381,6 @@ auto:
381381 - name: x86_64-gnu-distcheck
382382 <<: *job-linux-4c
383383
384 # The x86_64-gnu-llvm-20 job is split into multiple jobs to run tests in parallel.
385 # x86_64-gnu-llvm-20-1 skips tests that run in x86_64-gnu-llvm-20-{2,3}.
386 - name: x86_64-gnu-llvm-20-1
387 env:
388 RUST_BACKTRACE: 1
389 IMAGE: x86_64-gnu-llvm-20
390 DOCKER_SCRIPT: stage_2_test_set2.sh
391 <<: *job-linux-4c
392
393 # Skip tests that run in x86_64-gnu-llvm-20-{1,3}
394 - name: x86_64-gnu-llvm-20-2
395 env:
396 RUST_BACKTRACE: 1
397 IMAGE: x86_64-gnu-llvm-20
398 DOCKER_SCRIPT: x86_64-gnu-llvm2.sh
399 <<: *job-linux-4c
400
401 # Skip tests that run in x86_64-gnu-llvm-20-{1,2}
402 - name: x86_64-gnu-llvm-20-3
403 env:
404 RUST_BACKTRACE: 1
405 IMAGE: x86_64-gnu-llvm-20
406 DOCKER_SCRIPT: x86_64-gnu-llvm3.sh
407 <<: *job-linux-4c
408
409384 # The x86_64-gnu-llvm-21 job is split into multiple jobs to run tests in parallel.
410385 # x86_64-gnu-llvm-21-1 skips tests that run in x86_64-gnu-llvm-21-{2,3}.
411386 - name: x86_64-gnu-llvm-21-1
tests/assembly-llvm/aarch64-pointer-auth.rs-1
......@@ -5,7 +5,6 @@
55//@ assembly-output: emit-asm
66//@ needs-llvm-components: aarch64
77//@ compile-flags: --target aarch64-unknown-linux-gnu
8//@ [GCS] min-llvm-version: 21
98//@ [GCS] ignore-apple (XCode version needs updating)
109//@ [GCS] compile-flags: -Z branch-protection=gcs
1110//@ [PACRET] compile-flags: -Z branch-protection=pac-ret,leaf
tests/assembly-llvm/asm/s390x-types.rs-1
......@@ -6,7 +6,6 @@
66//@[s390x_vector] compile-flags: --target s390x-unknown-linux-gnu -C target-feature=+vector
77//@[s390x_vector] needs-llvm-components: systemz
88//@ compile-flags: -Zmerge-functions=disabled
9//@ min-llvm-version: 21
109
1110#![feature(no_core, repr_simd, f16, f128)]
1211#![cfg_attr(s390x_vector, feature(asm_experimental_reg))]
tests/assembly-llvm/nvptx-safe-naming.rs+1-5
......@@ -1,9 +1,6 @@
11//@ assembly-output: ptx-linker
22//@ compile-flags: --crate-type cdylib
33//@ only-nvptx64
4//@ revisions: LLVM20 LLVM21
5//@ [LLVM21] min-llvm-version: 21
6//@ [LLVM20] max-llvm-major-version: 20
74
85#![feature(abi_ptx)]
96#![no_std]
......@@ -18,8 +15,7 @@ extern crate breakpoint_panic_handler;
1815#[no_mangle]
1916pub unsafe extern "ptx-kernel" fn top_kernel(a: *const u32, b: *mut u32) {
2017 // CHECK: call.uni (retval0),
21 // LLVM20-NEXT: [[IMPL_FN]]
22 // LLVM21-SAME: [[IMPL_FN]]
18 // CHECK-SAME: [[IMPL_FN]]
2319 *b = deep::private::MyStruct::new(*a).square();
2420}
2521
tests/assembly-llvm/sanitizer/kcfi/emit-arity-indicator.rs-1
......@@ -5,7 +5,6 @@
55//@ assembly-output: emit-asm
66//@[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
77//@ [x86_64] needs-llvm-components: x86
8//@ min-llvm-version: 21.0.0
98
109#![crate_type = "lib"]
1110#![feature(no_core)]
tests/assembly-llvm/x86_64-windows-float-abi.rs+1-2
......@@ -37,8 +37,7 @@ pub extern "C" fn second_f64(_: f64, x: f64) -> f64 {
3737}
3838
3939// CHECK-LABEL: second_f128
40// FIXME(llvm21): this can be just %rdx instead of the regex once we don't test on LLVM 20
41// CHECK: movaps {{(%xmm1|\(%rdx\))}}, %xmm0
40// CHECK: movaps (%rdx), %xmm0
4241// CHECK-NEXT: retq
4342#[no_mangle]
4443pub extern "C" fn second_f128(_: f128, x: f128) -> f128 {
tests/codegen-llvm/cffi/c-variadic-va_list.rs-1
......@@ -1,6 +1,5 @@
11//@ needs-unwind
22//@ compile-flags: -Copt-level=3
3//@ min-llvm-version: 21
43
54#![crate_type = "lib"]
65#![feature(c_variadic)]
tests/codegen-llvm/cffi/c-variadic.rs-1
......@@ -1,6 +1,5 @@
11//@ needs-unwind
22//@ compile-flags: -C no-prepopulate-passes -Copt-level=0
3//@ min-llvm-version: 21
43
54#![crate_type = "lib"]
65#![feature(c_variadic)]
tests/codegen-llvm/dead_on_return.rs-1
......@@ -1,5 +1,4 @@
11//@ compile-flags: -C opt-level=3
2//@ min-llvm-version: 21
32
43#![crate_type = "lib"]
54#![allow(unused_assignments, unused_variables)]
tests/codegen-llvm/deduced-param-attrs.rs+8-16
......@@ -1,8 +1,5 @@
11//@ compile-flags: -Copt-level=3 -Cno-prepopulate-passes
22//@ compile-flags: -Cpanic=abort -Csymbol-mangling-version=v0
3//@ revisions: LLVM21 LLVM20
4//@ [LLVM21] min-llvm-version: 21
5//@ [LLVM20] max-llvm-major-version: 20
63#![feature(custom_mir, core_intrinsics, unboxed_closures)]
74#![crate_type = "lib"]
85extern crate core;
......@@ -37,15 +34,13 @@ pub fn mutate(mut b: Big) {
3734 black_box(&b);
3835}
3936
40// LLVM21-LABEL: @deref_mut({{.*}}readonly {{.*}}captures(none) {{.*}}%c)
41// LLVM20-LABEL: @deref_mut({{.*}}readonly {{.*}}%c)
37// CHECK-LABEL: @deref_mut({{.*}}readonly {{.*}}captures(none) {{.*}}%c)
4238#[unsafe(no_mangle)]
4339pub fn deref_mut(c: (BigCell, &mut usize)) {
4440 *c.1 = 42;
4541}
4642
47// LLVM21-LABEL: @call_copy_arg(ptr {{.*}}readonly {{.*}}captures(none){{.*}})
48// LLVM20-LABEL: @call_copy_arg(ptr {{.*}}readonly {{.*}})
43// CHECK-LABEL: @call_copy_arg(ptr {{.*}}readonly {{.*}}captures(none){{.*}})
4944#[unsafe(no_mangle)]
5045#[custom_mir(dialect = "runtime", phase = "optimized")]
5146pub fn call_copy_arg(a: Big) {
......@@ -61,7 +56,7 @@ pub fn call_copy_arg(a: Big) {
6156
6257// CHECK-LABEL: @call_move_arg(
6358// CHECK-NOT: readonly
64// LLVM21-SAME: captures(address)
59// CHECK-SAME: captures(address)
6560// CHECK-SAME: )
6661#[unsafe(no_mangle)]
6762#[custom_mir(dialect = "runtime", phase = "optimized")]
......@@ -84,8 +79,7 @@ fn shared_borrow<T>(a: T) {
8479//
8580// CHECK-LABEL: ; deduced_param_attrs::shared_borrow::<deduced_param_attrs::Big>
8681// CHECK-NEXT: ;
87// LLVM21-NEXT: (ptr {{.*}}readonly {{.*}}captures(address) {{.*}}%a)
88// LLVM20-NEXT: (ptr {{.*}}readonly {{.*}}%a)
82// CHECK-NEXT: (ptr {{.*}}readonly {{.*}}captures(address) {{.*}}%a)
8983pub static A0: fn(Big) = shared_borrow;
9084
9185// !Freeze parameter can be mutated through a shared borrow.
......@@ -113,16 +107,14 @@ fn consume<T>(_: T) {}
113107//
114108// CHECK-LABEL: ; deduced_param_attrs::consume::<deduced_param_attrs::BigCell>
115109// CHECK-NEXT: ;
116// LLVM21-NEXT: (ptr {{.*}}readonly {{.*}}captures(none) {{.*}})
117// LLVM20-NEXT: (ptr {{.*}}readonly {{.*}})
110// CHECK-NEXT: (ptr {{.*}}readonly {{.*}}captures(none) {{.*}})
118111pub static B0: fn(BigCell) = consume;
119112
120113// The parameter needs to be dropped.
121114//
122115// CHECK-LABEL: ; deduced_param_attrs::consume::<deduced_param_attrs::BigDrop>
123116// CHECK-NEXT: ;
124// LLVM21-NEXT: (ptr {{.*}}captures(address) {{.*}})
125// LLVM20-NEXT: (ptr {{.*}})
117// CHECK-NEXT: (ptr {{.*}}captures(address) {{.*}})
126118pub static B1: fn(BigDrop) = consume;
127119
128120fn consume_parts<T>(t: (T, T)) {
......@@ -160,13 +152,13 @@ pub fn never_returns() -> [u8; 80] {
160152 loop {}
161153}
162154
163// LLVM21-LABEL: @not_captured_return_place(ptr{{.*}} captures(none) {{.*}}%_0)
155// CHECK-LABEL: @not_captured_return_place(ptr{{.*}} captures(none) {{.*}}%_0)
164156#[unsafe(no_mangle)]
165157pub fn not_captured_return_place() -> [u8; 80] {
166158 [0u8; 80]
167159}
168160
169// LLVM21-LABEL: @captured_return_place(ptr{{.*}} captures(address) {{.*}}%_0)
161// CHECK-LABEL: @captured_return_place(ptr{{.*}} captures(address) {{.*}}%_0)
170162#[unsafe(no_mangle)]
171163pub fn captured_return_place() -> [u8; 80] {
172164 black_box([0u8; 80])
tests/codegen-llvm/enum/enum-discriminant-eq.rs+11-33
......@@ -1,8 +1,5 @@
11//@ compile-flags: -Copt-level=3 -Zmerge-functions=disabled
22//@ only-64bit
3//@ revisions: LLVM20 LLVM21
4//@ [LLVM21] min-llvm-version: 21
5//@ [LLVM20] max-llvm-major-version: 20
63
74// The `derive(PartialEq)` on enums with field-less variants compares discriminants,
85// so make sure we emit that in some reasonable way.
......@@ -92,21 +89,16 @@ pub fn mid_bool_eq_discr(a: Mid<bool>, b: Mid<bool>) -> bool {
9289
9390 // CHECK: %[[A_NOT_HOLE:.+]] = icmp ne i8 %a, 3
9491 // CHECK: tail call void @llvm.assume(i1 %[[A_NOT_HOLE]])
95 // LLVM20: %[[A_REL_DISCR:.+]] = add nsw i8 %a, -2
9692 // CHECK: %[[A_IS_NICHE:.+]] = icmp samesign ugt i8 %a, 1
97 // LLVM20: %[[A_DISCR:.+]] = select i1 %[[A_IS_NICHE]], i8 %[[A_REL_DISCR]], i8 1
9893
9994 // CHECK: %[[B_NOT_HOLE:.+]] = icmp ne i8 %b, 3
10095 // CHECK: tail call void @llvm.assume(i1 %[[B_NOT_HOLE]])
101 // LLVM20: %[[B_REL_DISCR:.+]] = add nsw i8 %b, -2
10296 // CHECK: %[[B_IS_NICHE:.+]] = icmp samesign ugt i8 %b, 1
103 // LLVM20: %[[B_DISCR:.+]] = select i1 %[[B_IS_NICHE]], i8 %[[B_REL_DISCR]], i8 1
10497
105 // LLVM21: %[[A_MOD_DISCR:.+]] = select i1 %[[A_IS_NICHE]], i8 %a, i8 3
106 // LLVM21: %[[B_MOD_DISCR:.+]] = select i1 %[[B_IS_NICHE]], i8 %b, i8 3
98 // CHECK: %[[A_MOD_DISCR:.+]] = select i1 %[[A_IS_NICHE]], i8 %a, i8 3
99 // CHECK: %[[B_MOD_DISCR:.+]] = select i1 %[[B_IS_NICHE]], i8 %b, i8 3
107100
108 // LLVM20: %[[R:.+]] = icmp eq i8 %[[A_DISCR]], %[[B_DISCR]]
109 // LLVM21: %[[R:.+]] = icmp eq i8 %[[A_MOD_DISCR]], %[[B_MOD_DISCR]]
101 // CHECK: %[[R:.+]] = icmp eq i8 %[[A_MOD_DISCR]], %[[B_MOD_DISCR]]
110102 // CHECK: ret i1 %[[R]]
111103 discriminant_value(&a) == discriminant_value(&b)
112104}
......@@ -117,21 +109,16 @@ pub fn mid_ord_eq_discr(a: Mid<Ordering>, b: Mid<Ordering>) -> bool {
117109
118110 // CHECK: %[[A_NOT_HOLE:.+]] = icmp ne i8 %a, 3
119111 // CHECK: tail call void @llvm.assume(i1 %[[A_NOT_HOLE]])
120 // LLVM20: %[[A_REL_DISCR:.+]] = add nsw i8 %a, -2
121112 // CHECK: %[[A_IS_NICHE:.+]] = icmp sgt i8 %a, 1
122 // LLVM20: %[[A_DISCR:.+]] = select i1 %[[A_IS_NICHE]], i8 %[[A_REL_DISCR]], i8 1
123113
124114 // CHECK: %[[B_NOT_HOLE:.+]] = icmp ne i8 %b, 3
125115 // CHECK: tail call void @llvm.assume(i1 %[[B_NOT_HOLE]])
126 // LLVM20: %[[B_REL_DISCR:.+]] = add nsw i8 %b, -2
127116 // CHECK: %[[B_IS_NICHE:.+]] = icmp sgt i8 %b, 1
128 // LLVM20: %[[B_DISCR:.+]] = select i1 %[[B_IS_NICHE]], i8 %[[B_REL_DISCR]], i8 1
129117
130 // LLVM21: %[[A_MOD_DISCR:.+]] = select i1 %[[A_IS_NICHE]], i8 %a, i8 3
131 // LLVM21: %[[B_MOD_DISCR:.+]] = select i1 %[[B_IS_NICHE]], i8 %b, i8 3
118 // CHECK: %[[A_MOD_DISCR:.+]] = select i1 %[[A_IS_NICHE]], i8 %a, i8 3
119 // CHECK: %[[B_MOD_DISCR:.+]] = select i1 %[[B_IS_NICHE]], i8 %b, i8 3
132120
133 // LLVM20: %[[R:.+]] = icmp eq i8 %[[A_DISCR]], %[[B_DISCR]]
134 // LLVM21: %[[R:.+]] = icmp eq i8 %[[A_MOD_DISCR]], %[[B_MOD_DISCR]]
121 // CHECK: %[[R:.+]] = icmp eq i8 %[[A_MOD_DISCR]], %[[B_MOD_DISCR]]
135122 // CHECK: ret i1 %[[R]]
136123 discriminant_value(&a) == discriminant_value(&b)
137124}
......@@ -150,18 +137,14 @@ pub fn mid_ac_eq_discr(a: Mid<AC>, b: Mid<AC>) -> bool {
150137
151138 // CHECK: %[[A_NOT_HOLE:.+]] = icmp ne i8 %a, -127
152139 // CHECK: tail call void @llvm.assume(i1 %[[A_NOT_HOLE]])
153 // LLVM20: %[[A_REL_DISCR:.+]] = xor i8 %a, -128
154140 // CHECK: %[[A_IS_NICHE:.+]] = icmp slt i8 %a, 0
155 // LLVM20: %[[A_DISCR:.+]] = select i1 %[[A_IS_NICHE]], i8 %[[A_REL_DISCR]], i8 1
156141
157142 // CHECK: %[[B_NOT_HOLE:.+]] = icmp ne i8 %b, -127
158143 // CHECK: tail call void @llvm.assume(i1 %[[B_NOT_HOLE]])
159 // LLVM20: %[[B_REL_DISCR:.+]] = xor i8 %b, -128
160144 // CHECK: %[[B_IS_NICHE:.+]] = icmp slt i8 %b, 0
161 // LLVM20: %[[B_DISCR:.+]] = select i1 %[[B_IS_NICHE]], i8 %[[B_REL_DISCR]], i8 1
162145
163 // LLVM21: %[[A_DISCR:.+]] = select i1 %[[A_IS_NICHE]], i8 %a, i8 -127
164 // LLVM21: %[[B_DISCR:.+]] = select i1 %[[B_IS_NICHE]], i8 %b, i8 -127
146 // CHECK: %[[A_DISCR:.+]] = select i1 %[[A_IS_NICHE]], i8 %a, i8 -127
147 // CHECK: %[[B_DISCR:.+]] = select i1 %[[B_IS_NICHE]], i8 %b, i8 -127
165148
166149 // CHECK: %[[R:.+]] = icmp eq i8 %[[A_DISCR]], %[[B_DISCR]]
167150 // CHECK: ret i1 %[[R]]
......@@ -177,22 +160,17 @@ pub fn mid_giant_eq_discr(a: Mid<Giant>, b: Mid<Giant>) -> bool {
177160 // CHECK: %[[A_NOT_HOLE:.+]] = icmp ne i128 %a, 6
178161 // CHECK: tail call void @llvm.assume(i1 %[[A_NOT_HOLE]])
179162 // CHECK: %[[A_TRUNC:.+]] = trunc nuw nsw i128 %a to i64
180 // LLVM20: %[[A_REL_DISCR:.+]] = add nsw i64 %[[A_TRUNC]], -5
181163 // CHECK: %[[A_IS_NICHE:.+]] = icmp samesign ugt i128 %a, 4
182 // LLVM20: %[[A_DISCR:.+]] = select i1 %[[A_IS_NICHE]], i64 %[[A_REL_DISCR]], i64 1
183164
184165 // CHECK: %[[B_NOT_HOLE:.+]] = icmp ne i128 %b, 6
185166 // CHECK: tail call void @llvm.assume(i1 %[[B_NOT_HOLE]])
186167 // CHECK: %[[B_TRUNC:.+]] = trunc nuw nsw i128 %b to i64
187 // LLVM20: %[[B_REL_DISCR:.+]] = add nsw i64 %[[B_TRUNC]], -5
188168 // CHECK: %[[B_IS_NICHE:.+]] = icmp samesign ugt i128 %b, 4
189 // LLVM20: %[[B_DISCR:.+]] = select i1 %[[B_IS_NICHE]], i64 %[[B_REL_DISCR]], i64 1
190169
191 // LLVM21: %[[A_MODIFIED_TAG:.+]] = select i1 %[[A_IS_NICHE]], i64 %[[A_TRUNC]], i64 6
192 // LLVM21: %[[B_MODIFIED_TAG:.+]] = select i1 %[[B_IS_NICHE]], i64 %[[B_TRUNC]], i64 6
193 // LLVM21: %[[R:.+]] = icmp eq i64 %[[A_MODIFIED_TAG]], %[[B_MODIFIED_TAG]]
170 // CHECK: %[[A_MODIFIED_TAG:.+]] = select i1 %[[A_IS_NICHE]], i64 %[[A_TRUNC]], i64 6
171 // CHECK: %[[B_MODIFIED_TAG:.+]] = select i1 %[[B_IS_NICHE]], i64 %[[B_TRUNC]], i64 6
172 // CHECK: %[[R:.+]] = icmp eq i64 %[[A_MODIFIED_TAG]], %[[B_MODIFIED_TAG]]
194173
195 // LLVM20: %[[R:.+]] = icmp eq i64 %[[A_DISCR]], %[[B_DISCR]]
196174 // CHECK: ret i1 %[[R]]
197175 discriminant_value(&a) == discriminant_value(&b)
198176}
tests/codegen-llvm/issues/issue-101082.rs-1
......@@ -11,7 +11,6 @@
1111// at the time still sometimes fails, so only verify it for the power-of-two size
1212// - https://github.com/llvm/llvm-project/issues/134735
1313//@[x86-64-v3] only-x86_64
14//@[x86-64-v3] min-llvm-version: 21
1514//@[x86-64-v3] compile-flags: -Ctarget-cpu=x86-64-v3
1615
1716#![crate_type = "lib"]
tests/codegen-llvm/issues/issue-122734-match-eq.rs-1
......@@ -1,4 +1,3 @@
1//@ min-llvm-version: 21
21//@ compile-flags: -Copt-level=3 -Zmerge-functions=disabled
32//! Tests that matching + eq on `Option<FieldlessEnum>` produces a simple compare with no branching
43
tests/codegen-llvm/issues/issue-138497-nonzero-remove-trailing-zeroes.rs-1
......@@ -1,7 +1,6 @@
11//! This test checks that removing trailing zeroes from a `NonZero`,
22//! then creating a new `NonZero` from the result does not panic.
33
4//@ min-llvm-version: 21
54//@ compile-flags: -O -Zmerge-functions=disabled
65#![crate_type = "lib"]
76
tests/codegen-llvm/issues/saturating-sub-index-139759.rs-1
......@@ -2,7 +2,6 @@
22// index doesn't generate another bounds check.
33
44//@ compile-flags: -Copt-level=3
5//@ min-llvm-version: 21
65
76#![crate_type = "lib"]
87
tests/codegen-llvm/lib-optimizations/append-elements.rs-1
......@@ -1,6 +1,5 @@
11//@ compile-flags: -O -Zmerge-functions=disabled
22//@ needs-deterministic-layouts
3//@ min-llvm-version: 21
43//@ ignore-std-debug-assertions (causes different value naming)
54#![crate_type = "lib"]
65
tests/codegen-llvm/option-niche-eq.rs+4-6
......@@ -1,6 +1,4 @@
1//@ revisions: REGULAR LLVM21
21//@ compile-flags: -Copt-level=3 -Zmerge-functions=disabled
3//@ [LLVM21] min-llvm-version: 21
42#![crate_type = "lib"]
53
64extern crate core;
......@@ -76,11 +74,11 @@ pub fn niche_eq(l: Option<EnumWithNiche>, r: Option<EnumWithNiche>) -> bool {
7674 l == r
7775}
7876
79// LLVM21-LABEL: @bool_eq
77// CHECK-LABEL: @bool_eq
8078#[no_mangle]
8179pub fn bool_eq(l: Option<bool>, r: Option<bool>) -> bool {
82 // LLVM21: start:
83 // LLVM21-NEXT: icmp eq i8
84 // LLVM21-NEXT: ret i1
80 // CHECK: start:
81 // CHECK-NEXT: icmp eq i8
82 // CHECK-NEXT: ret i1
8583 l == r
8684}
tests/codegen-llvm/read-only-capture-opt.rs-1
......@@ -1,5 +1,4 @@
11//@ compile-flags: -C opt-level=3 -Z mir-opt-level=0
2//@ min-llvm-version: 21
32
43#![crate_type = "lib"]
54
tests/codegen-llvm/riscv-abi/call-llvm-intrinsics.rs-1
......@@ -5,7 +5,6 @@
55//@ [riscv32gc] needs-llvm-components: riscv
66//@ [riscv64gc] compile-flags: --target riscv64gc-unknown-linux-gnu
77//@ [riscv64gc] needs-llvm-components: riscv
8//@ min-llvm-version: 21
98
109#![feature(link_llvm_intrinsics)]
1110#![feature(no_core, lang_items)]
tests/codegen-llvm/sanitizer/kcfi/add-kcfi-arity-flag.rs-1
......@@ -5,7 +5,6 @@
55//@ [x86_64] compile-flags: --target x86_64-unknown-none
66//@ [x86_64] needs-llvm-components: x86
77//@ compile-flags: -Ctarget-feature=-crt-static -Cpanic=abort -Zsanitizer=kcfi -Zsanitizer-kcfi-arity
8//@ min-llvm-version: 21.0.0
98
109#![feature(no_core, lang_items)]
1110#![crate_type = "lib"]
tests/codegen-llvm/slice-range-indexing.rs-1
......@@ -1,5 +1,4 @@
11//@ compile-flags: -Copt-level=3
2//@ min-llvm-version: 21
32
43#![crate_type = "lib"]
54
tests/codegen-llvm/str-range-indexing.rs-1
......@@ -1,5 +1,4 @@
11//@ compile-flags: -Copt-level=3
2//@ min-llvm-version: 21
32
43#![crate_type = "lib"]
54
tests/codegen-llvm/vec-calloc.rs+9-12
......@@ -1,6 +1,4 @@
1//@ revisions: normal llvm21
21//@ compile-flags: -Copt-level=3 -Z merge-functions=disabled
3//@ [llvm21] min-llvm-version: 21
42//@ only-x86_64
53
64#![crate_type = "lib"]
......@@ -178,21 +176,20 @@ pub fn vec_option_i32(n: usize) -> Vec<Option<i32>> {
178176 vec![None; n]
179177}
180178
181// LLVM21-LABEL: @vec_array
182#[cfg(llvm21)]
179// CHECK-LABEL: @vec_array
183180#[no_mangle]
184181pub fn vec_array(n: usize) -> Vec<[u32; 1_000_000]> {
185 // LLVM21-NOT: call {{.*}}alloc::vec::from_elem
186 // LLVM21-NOT: call {{.*}}reserve
187 // LLVM21-NOT: call {{.*}}__rust_alloc(
182 // CHECK-NOT: call {{.*}}alloc::vec::from_elem
183 // CHECK-NOT: call {{.*}}reserve
184 // CHECK-NOT: call {{.*}}__rust_alloc(
188185
189 // LLVM21: call {{.*}}__rust_alloc_zeroed(
186 // CHECK: call {{.*}}__rust_alloc_zeroed(
190187
191 // LLVM21-NOT: call {{.*}}alloc::vec::from_elem
192 // LLVM21-NOT: call {{.*}}reserve
193 // LLVM21-NOT: call {{.*}}__rust_alloc(
188 // CHECK-NOT: call {{.*}}alloc::vec::from_elem
189 // CHECK-NOT: call {{.*}}reserve
190 // CHECK-NOT: call {{.*}}__rust_alloc(
194191
195 // LLVM21: ret void
192 // CHECK: ret void
196193 vec![[0; 1_000_000]; 3]
197194}
198195
tests/run-make/repr128-dwarf/main.rs+1-7
......@@ -17,7 +17,6 @@ pub enum I128Enum {
1717 I128D = i128::MAX.to_le(),
1818}
1919
20#[cfg(not(old_llvm))]
2120#[repr(u128)]
2221pub enum U128VariantEnum {
2322 VariantU128A(u8) = 0_u128.to_le(),
......@@ -26,7 +25,6 @@ pub enum U128VariantEnum {
2625 VariantU128D = u128::MAX.to_le(),
2726}
2827
29#[cfg(not(old_llvm))]
3028#[repr(i128)]
3129pub enum I128VariantEnum {
3230 VariantI128A(u8) = 0_i128.to_le(),
......@@ -37,13 +35,9 @@ pub enum I128VariantEnum {
3735
3836pub fn f(_: U128Enum, _: I128Enum) {}
3937
40#[cfg(not(old_llvm))]
4138pub fn g(_: U128VariantEnum, _: I128VariantEnum) {}
4239
4340fn main() {
4441 f(U128Enum::U128A, I128Enum::I128A);
45 #[cfg(not(old_llvm))]
46 {
47 g(U128VariantEnum::VariantU128A(1), I128VariantEnum::VariantI128A(2));
48 }
42 g(U128VariantEnum::VariantU128A(1), I128VariantEnum::VariantI128A(2));
4943}
tests/run-make/repr128-dwarf/rmake.rs+2-19
......@@ -13,25 +13,8 @@ use object::{Object, ObjectSection};
1313use run_make_support::{gimli, object, rfs, rustc};
1414
1515fn main() {
16 // Before LLVM 20, 128-bit enums with variants didn't emit debuginfo correctly.
17 // This check can be removed once Rust no longer supports LLVM 18 and 19.
18 let llvm_version = rustc()
19 .verbose()
20 .arg("--version")
21 .run()
22 .stdout_utf8()
23 .lines()
24 .filter_map(|line| line.strip_prefix("LLVM version: "))
25 .map(|version| version.split(".").next().unwrap().parse::<u32>().unwrap())
26 .next()
27 .unwrap();
28 let is_old_llvm = llvm_version < 20;
29
3016 let output = PathBuf::from("repr128");
3117 let mut rustc = rustc();
32 if is_old_llvm {
33 rustc.cfg("old_llvm");
34 }
3518 rustc.input("main.rs").output(&output).arg("-Cdebuginfo=2").run();
3619 // Mach-O uses packed debug info
3720 let dsym_location = output
......@@ -88,7 +71,7 @@ fn main() {
8871
8972 while let Some((_, entry)) = cursor.next_dfs().unwrap() {
9073 match entry.tag() {
91 gimli::constants::DW_TAG_variant if !is_old_llvm => {
74 gimli::constants::DW_TAG_variant => {
9275 let Some(value) = entry.attr(gimli::constants::DW_AT_discr_value).unwrap()
9376 else {
9477 // `std` enums might have variants without `DW_AT_discr_value`.
......@@ -143,7 +126,7 @@ fn main() {
143126 if !enumerators_to_find.is_empty() {
144127 panic!("Didn't find debug enumerator entries for {enumerators_to_find:?}");
145128 }
146 if !is_old_llvm && !variants_to_find.is_empty() {
129 if !variants_to_find.is_empty() {
147130 panic!("Didn't find debug variant entries for {variants_to_find:?}");
148131 }
149132}
tests/ui/sanitizer/kcfi-arity-requires-llvm-21-0-0.rs deleted-11
......@@ -1,11 +0,0 @@
1// Verifies that `-Zsanitizer-kcfi-arity` requires LLVM 21.0.0 or later.
2//
3//@ needs-sanitizer-kcfi
4//@ compile-flags: -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Cpanic=abort -Zsanitizer=kcfi -Zsanitizer-kcfi-arity
5//@ build-fail
6//@ max-llvm-major-version: 20
7
8//~? ERROR `-Zsanitizer-kcfi-arity` requires LLVM 21.0.0 or later
9#![feature(no_core)]
10#![no_core]
11#![no_main]
tests/ui/sanitizer/kcfi-arity-requires-llvm-21-0-0.stderr deleted-4
......@@ -1,4 +0,0 @@
1error: `-Zsanitizer-kcfi-arity` requires LLVM 21.0.0 or later
2
3error: aborting due to 1 previous error
4