| author | bors <bors@rust-lang.org> 2026-03-13 10:36:35 UTC |
| committer | bors <bors@rust-lang.org> 2026-03-13 10:36:35 UTC |
| log | 8db65c71725664d85d06ec96ee3e575665de1f6a |
| tree | cd1cdb599eb6e534862bd5ca832a94b6d1ded5b1 |
| parent | eaf4e7489b6ae3d4ba9a71b720b03b6d58e4f102 |
| parent | 52dfa94cdcd3ed16f31c6afbf406826e2c5688dd |
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}; |
| 23 | 23 | use crate::builder::Builder; |
| 24 | 24 | use crate::context::CodegenCx; |
| 25 | 25 | use crate::llvm::{self, Attribute, AttributePlace, Type, Value}; |
| 26 | use crate::llvm_util; | |
| 27 | 26 | use crate::type_of::LayoutLlvmExt; |
| 28 | 27 | |
| 29 | 28 | trait ArgAttributesExt { |
| ... | ... | @@ -46,6 +45,12 @@ const OPTIMIZATION_ATTRIBUTES: [(ArgAttribute, llvm::AttributeKind); 4] = [ |
| 46 | 45 | (ArgAttribute::NoUndef, llvm::AttributeKind::NoUndef), |
| 47 | 46 | ]; |
| 48 | 47 | |
| 48 | const 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 | ||
| 49 | 54 | fn get_attrs<'ll>(this: &ArgAttributes, cx: &CodegenCx<'ll, '_>) -> SmallVec<[&'ll Attribute; 8]> { |
| 50 | 55 | let mut regular = this.regular; |
| 51 | 56 | |
| ... | ... | @@ -82,18 +87,10 @@ fn get_attrs<'ll>(this: &ArgAttributes, cx: &CodegenCx<'ll, '_>) -> SmallVec<[&' |
| 82 | 87 | attrs.push(llattr.create_attr(cx.llcx)); |
| 83 | 88 | } |
| 84 | 89 | } |
| 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; | |
| 97 | 94 | } |
| 98 | 95 | } |
| 99 | 96 | } else if cx.tcx.sess.sanitizers().contains(SanitizerSet::MEMORY) { |
| ... | ... | @@ -508,9 +505,7 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> { |
| 508 | 505 | } |
| 509 | 506 | PassMode::Indirect { attrs, meta_attrs: None, on_stack: false } => { |
| 510 | 507 | 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 { | |
| 514 | 509 | attributes::apply_to_llfn( |
| 515 | 510 | llfn, |
| 516 | 511 | 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>( |
| 506 | 506 | to_add.push(llvm::CreateAllocKindAttr(cx.llcx, AllocKindFlags::Free)); |
| 507 | 507 | // applies to argument place instead of function place |
| 508 | 508 | 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]; | |
| 518 | 514 | attributes::apply_to_llfn(llfn, AttributePlace::Argument(0), attrs); |
| 519 | 515 | } |
| 520 | 516 | 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>( |
| 190 | 190 | let mut target_data_layout = sess.target.data_layout.to_string(); |
| 191 | 191 | let llvm_version = llvm_util::get_version(); |
| 192 | 192 | |
| 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 | } | |
| 204 | 193 | if llvm_version < (22, 0, 0) { |
| 205 | 194 | if sess.target.arch == Arch::Avr { |
| 206 | 195 | // 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>( |
| 342 | 331 | // Add "kcfi-arity" module flag if KCFI arity indicator is enabled. (See |
| 343 | 332 | // https://github.com/llvm/llvm-project/pull/117121.) |
| 344 | 333 | 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 | ||
| 350 | 334 | llvm::add_module_flag_u32( |
| 351 | 335 | llmod, |
| 352 | 336 | llvm::ModuleFlagMergeBehavior::Override, |
compiler/rustc_codegen_llvm/src/errors.rs-4| ... | ... | @@ -204,7 +204,3 @@ pub(crate) struct MismatchedDataLayout<'a> { |
| 204 | 204 | pub(crate) struct FixedX18InvalidArch<'a> { |
| 205 | 205 | pub arch: &'a str, |
| 206 | 206 | } |
| 207 | ||
| 208 | #[derive(Diagnostic)] | |
| 209 | #[diag("`-Zsanitizer-kcfi-arity` requires LLVM 21.0.0 or later")] | |
| 210 | pub(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 |
| 254 | 254 | }, |
| 255 | 255 | |
| 256 | 256 | // 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 | }, | |
| 261 | 257 | Arch::PowerPC | Arch::PowerPC64 => match s { |
| 262 | 258 | "power8-crypto" => Some(LLVMFeature::new("crypto")), |
| 263 | 259 | s => Some(LLVMFeature::new(s)), |
| ... | ... | @@ -372,23 +368,12 @@ fn update_target_reliable_float_cfg(sess: &Session, cfg: &mut TargetConfig) { |
| 372 | 368 | let (major, _, _) = version; |
| 373 | 369 | |
| 374 | 370 | 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 | } | |
| 382 | 371 | // Unsupported <https://github.com/llvm/llvm-project/issues/94434> (fixed in llvm22) |
| 383 | 372 | (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, | |
| 386 | 373 | // MinGW ABI bugs <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115054> |
| 387 | 374 | (Arch::X86_64, Os::Windows) if *target_env == Env::Gnu && *target_abi != Abi::Llvm => false, |
| 388 | 375 | // Infinite recursion <https://github.com/llvm/llvm-project/issues/97981> |
| 389 | 376 | (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) | |
| 392 | 377 | (Arch::PowerPC | Arch::PowerPC64, _) if major < 22 => false, // (fixed in llvm22) |
| 393 | 378 | (Arch::Sparc | Arch::Sparc64, _) if major < 22 => false, // (fixed in llvm22) |
| 394 | 379 | (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) { |
| 403 | 388 | (Arch::AmdGpu, _) => false, |
| 404 | 389 | // Unsupported <https://github.com/llvm/llvm-project/issues/94434> |
| 405 | 390 | (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, | |
| 408 | 391 | // Selection bug <https://github.com/llvm/llvm-project/issues/95471>. This issue is closed |
| 409 | 392 | // but basic math still does not work. |
| 410 | 393 | (Arch::Nvptx64, _) => false, |
| ... | ... | @@ -413,9 +396,6 @@ fn update_target_reliable_float_cfg(sess: &Session, cfg: &mut TargetConfig) { |
| 413 | 396 | (Arch::PowerPC | Arch::PowerPC64, _) => false, |
| 414 | 397 | // ABI unsupported <https://github.com/llvm/llvm-project/issues/41838> |
| 415 | 398 | (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, | |
| 419 | 399 | // MinGW ABI bugs <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115054> |
| 420 | 400 | (Arch::X86_64, Os::Windows) if *target_env == Env::Gnu && *target_abi != Abi::Llvm => false, |
| 421 | 401 | // 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( |
| 301 | 301 | |
| 302 | 302 | std::string Error; |
| 303 | 303 | 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); | |
| 310 | 305 | if (TheTarget == nullptr) { |
| 311 | 306 | LLVMRustSetLastError(Error.c_str()); |
| 312 | 307 | return nullptr; |
| ... | ... | @@ -367,13 +362,8 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine( |
| 367 | 362 | |
| 368 | 363 | Options.EmitStackSizeSection = EmitStackSizeSection; |
| 369 | 364 | |
| 370 | #if LLVM_VERSION_GE(21, 0) | |
| 371 | 365 | TargetMachine *TM = TheTarget->createTargetMachine(Trip, CPU, Feature, |
| 372 | 366 | Options, RM, CM, OptLevel); |
| 373 | #else | |
| 374 | TargetMachine *TM = TheTarget->createTargetMachine( | |
| 375 | Trip.getTriple(), CPU, Feature, Options, RM, CM, OptLevel); | |
| 376 | #endif | |
| 377 | 367 | |
| 378 | 368 | if (LargeDataThreshold != 0) { |
| 379 | 369 | TM->setLargeDataThreshold(LargeDataThreshold); |
| ... | ... | @@ -701,12 +691,8 @@ extern "C" LLVMRustResult LLVMRustOptimize( |
| 701 | 691 | if (LintIR) { |
| 702 | 692 | PipelineStartEPCallbacks.push_back([](ModulePassManager &MPM, |
| 703 | 693 | OptimizationLevel Level) { |
| 704 | #if LLVM_VERSION_GE(21, 0) | |
| 705 | 694 | MPM.addPass( |
| 706 | 695 | createModuleToFunctionPassAdaptor(LintPass(/*AbortOnError=*/true))); |
| 707 | #else | |
| 708 | MPM.addPass(createModuleToFunctionPassAdaptor(LintPass())); | |
| 709 | #endif | |
| 710 | 696 | }); |
| 711 | 697 | } |
| 712 | 698 | |
| ... | ... | @@ -1210,12 +1196,8 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules, size_t num_modules, |
| 1210 | 1196 | // Convert the preserved symbols set from string to GUID, this is then needed |
| 1211 | 1197 | // for internalization. |
| 1212 | 1198 | for (size_t i = 0; i < num_symbols; i++) { |
| 1213 | #if LLVM_VERSION_GE(21, 0) | |
| 1214 | 1199 | auto GUID = |
| 1215 | 1200 | GlobalValue::getGUIDAssumingExternalLinkage(preserved_symbols[i]); |
| 1216 | #else | |
| 1217 | auto GUID = GlobalValue::getGUID(preserved_symbols[i]); | |
| 1218 | #endif | |
| 1219 | 1201 | Ret->GUIDPreservedSymbols.insert(GUID); |
| 1220 | 1202 | } |
| 1221 | 1203 | |
| ... | ... | @@ -1474,21 +1456,12 @@ extern "C" void LLVMRustComputeLTOCacheKey(RustStringRef KeyOut, |
| 1474 | 1456 | DenseSet<GlobalValue::GUID> CfiFunctionDecls; |
| 1475 | 1457 | |
| 1476 | 1458 | // Based on the 'InProcessThinBackend' constructor in LLVM |
| 1477 | #if LLVM_VERSION_GE(21, 0) | |
| 1478 | 1459 | for (auto &Name : Data->Index.cfiFunctionDefs().symbols()) |
| 1479 | 1460 | CfiFunctionDefs.insert(GlobalValue::getGUIDAssumingExternalLinkage( |
| 1480 | 1461 | GlobalValue::dropLLVMManglingEscape(Name))); |
| 1481 | 1462 | for (auto &Name : Data->Index.cfiFunctionDecls().symbols()) |
| 1482 | 1463 | CfiFunctionDecls.insert(GlobalValue::getGUIDAssumingExternalLinkage( |
| 1483 | 1464 | 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 | |
| 1492 | 1465 | |
| 1493 | 1466 | Key = llvm::computeLTOCacheKey(conf, Data->Index, ModId, ImportList, |
| 1494 | 1467 | ExportList, ResolvedODR, DefinedGlobals, |
compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp-10| ... | ... | @@ -137,11 +137,7 @@ extern "C" void LLVMRustSetLastError(const char *Err) { |
| 137 | 137 | |
| 138 | 138 | extern "C" void LLVMRustSetNormalizedTarget(LLVMModuleRef M, |
| 139 | 139 | const char *Target) { |
| 140 | #if LLVM_VERSION_GE(21, 0) | |
| 141 | 140 | unwrap(M)->setTargetTriple(Triple(Triple::normalize(Target))); |
| 142 | #else | |
| 143 | unwrap(M)->setTargetTriple(Triple::normalize(Target)); | |
| 144 | #endif | |
| 145 | 141 | } |
| 146 | 142 | |
| 147 | 143 | extern "C" void LLVMRustPrintPassTimings(RustStringRef OutBuf) { |
| ... | ... | @@ -452,11 +448,7 @@ static Attribute::AttrKind fromRust(LLVMRustAttributeKind Kind) { |
| 452 | 448 | case LLVMRustAttributeKind::DeadOnUnwind: |
| 453 | 449 | return Attribute::DeadOnUnwind; |
| 454 | 450 | case LLVMRustAttributeKind::DeadOnReturn: |
| 455 | #if LLVM_VERSION_GE(21, 0) | |
| 456 | 451 | return Attribute::DeadOnReturn; |
| 457 | #else | |
| 458 | report_fatal_error("DeadOnReturn attribute requires LLVM 21 or later"); | |
| 459 | #endif | |
| 460 | 452 | case LLVMRustAttributeKind::CapturesAddress: |
| 461 | 453 | case LLVMRustAttributeKind::CapturesReadOnly: |
| 462 | 454 | case LLVMRustAttributeKind::CapturesNone: |
| ... | ... | @@ -514,7 +506,6 @@ extern "C" void LLVMRustEraseInstFromParent(LLVMValueRef Instr) { |
| 514 | 506 | |
| 515 | 507 | extern "C" LLVMAttributeRef |
| 516 | 508 | LLVMRustCreateAttrNoValue(LLVMContextRef C, LLVMRustAttributeKind RustAttr) { |
| 517 | #if LLVM_VERSION_GE(21, 0) | |
| 518 | 509 | if (RustAttr == LLVMRustAttributeKind::CapturesNone) { |
| 519 | 510 | return wrap(Attribute::getWithCaptureInfo(*unwrap(C), CaptureInfo::none())); |
| 520 | 511 | } |
| ... | ... | @@ -527,7 +518,6 @@ LLVMRustCreateAttrNoValue(LLVMContextRef C, LLVMRustAttributeKind RustAttr) { |
| 527 | 518 | *unwrap(C), CaptureInfo(CaptureComponents::Address | |
| 528 | 519 | CaptureComponents::ReadProvenance))); |
| 529 | 520 | } |
| 530 | #endif | |
| 531 | 521 | #if LLVM_VERSION_GE(23, 0) |
| 532 | 522 | if (RustAttr == LLVMRustAttributeKind::DeadOnReturn) { |
| 533 | 523 | 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) { |
| 631 | 631 | let version = get_llvm_version(builder, llvm_config); |
| 632 | 632 | let mut parts = version.split('.').take(2).filter_map(|s| s.parse::<u32>().ok()); |
| 633 | 633 | if let (Some(major), Some(_minor)) = (parts.next(), parts.next()) |
| 634 | && major >= 20 | |
| 634 | && major >= 21 | |
| 635 | 635 | { |
| 636 | 636 | return; |
| 637 | 637 | } |
| 638 | panic!("\n\nbad LLVM version: {version}, need >=20\n\n") | |
| 638 | panic!("\n\nbad LLVM version: {version}, need >=21\n\n") | |
| 639 | 639 | } |
| 640 | 640 | |
| 641 | 641 | fn 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: |
| 14 | 14 | cargo run --manifest-path src/ci/citool/Cargo.toml run-local <job-name> |
| 15 | 15 | ``` |
| 16 | 16 | |
| 17 | For example, to run the `x86_64-gnu-llvm-20-1` job: | |
| 17 | For example, to run the `x86_64-gnu-llvm-21-1` job: | |
| 18 | 18 | ``` |
| 19 | cargo run --manifest-path src/ci/citool/Cargo.toml run-local x86_64-gnu-llvm-20-1 | |
| 19 | cargo run --manifest-path src/ci/citool/Cargo.toml run-local x86_64-gnu-llvm-21-1 | |
| 20 | 20 | ``` |
| 21 | 21 | |
| 22 | 22 | The 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. |
| 27 | 27 | while locally, to the `obj/<image-name>` directory. This is primarily to prevent |
| 28 | 28 | strange linker errors when using multiple Docker images. |
| 29 | 29 | |
| 30 | 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: | |
| 30 | 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: | |
| 31 | 31 | |
| 32 | 32 | ``` |
| 33 | DOCKER_SCRIPT=x86_64-gnu-llvm3.sh ./src/ci/docker/run.sh x86_64-gnu-llvm-20 | |
| 33 | DOCKER_SCRIPT=x86_64-gnu-llvm3.sh ./src/ci/docker/run.sh x86_64-gnu-llvm-21 | |
| 34 | 34 | ``` |
| 35 | 35 | |
| 36 | 36 | ## Local Development |
src/ci/docker/host-aarch64/aarch64-gnu-llvm-20/Dockerfile deleted-55| ... | ... | @@ -1,55 +0,0 @@ |
| 1 | FROM ubuntu:25.10 | |
| 2 | ||
| 3 | ARG DEBIAN_FRONTEND=noninteractive | |
| 4 | ||
| 5 | RUN 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 | ||
| 35 | COPY scripts/sccache.sh /scripts/ | |
| 36 | RUN 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. | |
| 40 | ENV NO_DOWNLOAD_CI_LLVM="1" | |
| 41 | ENV EXTERNAL_LLVM="1" | |
| 42 | ||
| 43 | # Using llvm-link-shared due to libffi issues -- see #34486 | |
| 44 | ENV 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 | ||
| 50 | COPY scripts/shared.sh /scripts/ | |
| 51 | ||
| 52 | COPY scripts/stage_2_test_set1.sh /scripts/ | |
| 53 | COPY scripts/stage_2_test_set2.sh /scripts/ | |
| 54 | ||
| 55 | ENV SCRIPT="Must specify DOCKER_SCRIPT for this image" |
src/ci/docker/host-aarch64/aarch64-gnu-llvm-21/Dockerfile created+55| ... | ... | @@ -0,0 +1,55 @@ |
| 1 | FROM ubuntu:25.10 | |
| 2 | ||
| 3 | ARG DEBIAN_FRONTEND=noninteractive | |
| 4 | ||
| 5 | RUN 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 | ||
| 35 | COPY scripts/sccache.sh /scripts/ | |
| 36 | RUN 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. | |
| 40 | ENV NO_DOWNLOAD_CI_LLVM="1" | |
| 41 | ENV EXTERNAL_LLVM="1" | |
| 42 | ||
| 43 | # Using llvm-link-shared due to libffi issues -- see #34486 | |
| 44 | ENV 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 | ||
| 50 | COPY scripts/shared.sh /scripts/ | |
| 51 | ||
| 52 | COPY scripts/stage_2_test_set1.sh /scripts/ | |
| 53 | COPY scripts/stage_2_test_set2.sh /scripts/ | |
| 54 | ||
| 55 | ENV 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 @@ |
| 1 | FROM ubuntu:25.04 | |
| 2 | ||
| 3 | ARG DEBIAN_FRONTEND=noninteractive | |
| 4 | ||
| 5 | RUN 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. | |
| 38 | RUN 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 | ||
| 42 | COPY scripts/sccache.sh /scripts/ | |
| 43 | RUN 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. | |
| 47 | ENV NO_DOWNLOAD_CI_LLVM 1 | |
| 48 | ENV EXTERNAL_LLVM 1 | |
| 49 | ||
| 50 | # Using llvm-link-shared due to libffi issues -- see #34486 | |
| 51 | ENV 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 | ||
| 58 | COPY scripts/shared.sh /scripts/ | |
| 59 | ||
| 60 | COPY scripts/x86_64-gnu-llvm.sh /scripts/ | |
| 61 | COPY scripts/x86_64-gnu-llvm2.sh /scripts/ | |
| 62 | COPY scripts/x86_64-gnu-llvm3.sh /scripts/ | |
| 63 | COPY scripts/stage_2_test_set1.sh /scripts/ | |
| 64 | COPY scripts/stage_2_test_set2.sh /scripts/ | |
| 65 | ||
| 66 | ENV SCRIPT "Must specify DOCKER_SCRIPT for this image" |
src/ci/github-actions/jobs.yml+5-30| ... | ... | @@ -122,19 +122,19 @@ pr: |
| 122 | 122 | # tidy. This speeds up the PR CI job by ~1 minute. |
| 123 | 123 | SKIP_SUBMODULES: src/gcc |
| 124 | 124 | <<: *job-linux-4c |
| 125 | - name: x86_64-gnu-llvm-20 | |
| 125 | - name: x86_64-gnu-llvm-21 | |
| 126 | 126 | env: |
| 127 | 127 | ENABLE_GCC_CODEGEN: "1" |
| 128 | 128 | DOCKER_SCRIPT: x86_64-gnu-llvm.sh |
| 129 | 129 | <<: *job-linux-4c |
| 130 | - name: aarch64-gnu-llvm-20-1 | |
| 130 | - name: aarch64-gnu-llvm-21-1 | |
| 131 | 131 | env: |
| 132 | IMAGE: aarch64-gnu-llvm-20 | |
| 132 | IMAGE: aarch64-gnu-llvm-21 | |
| 133 | 133 | DOCKER_SCRIPT: stage_2_test_set1.sh |
| 134 | 134 | <<: *job-aarch64-linux |
| 135 | - name: aarch64-gnu-llvm-20-2 | |
| 135 | - name: aarch64-gnu-llvm-21-2 | |
| 136 | 136 | env: |
| 137 | IMAGE: aarch64-gnu-llvm-20 | |
| 137 | IMAGE: aarch64-gnu-llvm-21 | |
| 138 | 138 | DOCKER_SCRIPT: stage_2_test_set2.sh |
| 139 | 139 | <<: *job-aarch64-linux |
| 140 | 140 | - name: x86_64-gnu-tools |
| ... | ... | @@ -381,31 +381,6 @@ auto: |
| 381 | 381 | - name: x86_64-gnu-distcheck |
| 382 | 382 | <<: *job-linux-4c |
| 383 | 383 | |
| 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 | ||
| 409 | 384 | # The x86_64-gnu-llvm-21 job is split into multiple jobs to run tests in parallel. |
| 410 | 385 | # x86_64-gnu-llvm-21-1 skips tests that run in x86_64-gnu-llvm-21-{2,3}. |
| 411 | 386 | - name: x86_64-gnu-llvm-21-1 |
tests/assembly-llvm/aarch64-pointer-auth.rs-1| ... | ... | @@ -5,7 +5,6 @@ |
| 5 | 5 | //@ assembly-output: emit-asm |
| 6 | 6 | //@ needs-llvm-components: aarch64 |
| 7 | 7 | //@ compile-flags: --target aarch64-unknown-linux-gnu |
| 8 | //@ [GCS] min-llvm-version: 21 | |
| 9 | 8 | //@ [GCS] ignore-apple (XCode version needs updating) |
| 10 | 9 | //@ [GCS] compile-flags: -Z branch-protection=gcs |
| 11 | 10 | //@ [PACRET] compile-flags: -Z branch-protection=pac-ret,leaf |
tests/assembly-llvm/asm/s390x-types.rs-1| ... | ... | @@ -6,7 +6,6 @@ |
| 6 | 6 | //@[s390x_vector] compile-flags: --target s390x-unknown-linux-gnu -C target-feature=+vector |
| 7 | 7 | //@[s390x_vector] needs-llvm-components: systemz |
| 8 | 8 | //@ compile-flags: -Zmerge-functions=disabled |
| 9 | //@ min-llvm-version: 21 | |
| 10 | 9 | |
| 11 | 10 | #![feature(no_core, repr_simd, f16, f128)] |
| 12 | 11 | #![cfg_attr(s390x_vector, feature(asm_experimental_reg))] |
tests/assembly-llvm/nvptx-safe-naming.rs+1-5| ... | ... | @@ -1,9 +1,6 @@ |
| 1 | 1 | //@ assembly-output: ptx-linker |
| 2 | 2 | //@ compile-flags: --crate-type cdylib |
| 3 | 3 | //@ only-nvptx64 |
| 4 | //@ revisions: LLVM20 LLVM21 | |
| 5 | //@ [LLVM21] min-llvm-version: 21 | |
| 6 | //@ [LLVM20] max-llvm-major-version: 20 | |
| 7 | 4 | |
| 8 | 5 | #![feature(abi_ptx)] |
| 9 | 6 | #![no_std] |
| ... | ... | @@ -18,8 +15,7 @@ extern crate breakpoint_panic_handler; |
| 18 | 15 | #[no_mangle] |
| 19 | 16 | pub unsafe extern "ptx-kernel" fn top_kernel(a: *const u32, b: *mut u32) { |
| 20 | 17 | // CHECK: call.uni (retval0), |
| 21 | // LLVM20-NEXT: [[IMPL_FN]] | |
| 22 | // LLVM21-SAME: [[IMPL_FN]] | |
| 18 | // CHECK-SAME: [[IMPL_FN]] | |
| 23 | 19 | *b = deep::private::MyStruct::new(*a).square(); |
| 24 | 20 | } |
| 25 | 21 |
tests/assembly-llvm/sanitizer/kcfi/emit-arity-indicator.rs-1| ... | ... | @@ -5,7 +5,6 @@ |
| 5 | 5 | //@ assembly-output: emit-asm |
| 6 | 6 | //@[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 |
| 7 | 7 | //@ [x86_64] needs-llvm-components: x86 |
| 8 | //@ min-llvm-version: 21.0.0 | |
| 9 | 8 | |
| 10 | 9 | #![crate_type = "lib"] |
| 11 | 10 | #![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 { |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | // 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 | |
| 42 | 41 | // CHECK-NEXT: retq |
| 43 | 42 | #[no_mangle] |
| 44 | 43 | pub extern "C" fn second_f128(_: f128, x: f128) -> f128 { |
tests/codegen-llvm/cffi/c-variadic-va_list.rs-1| ... | ... | @@ -1,6 +1,5 @@ |
| 1 | 1 | //@ needs-unwind |
| 2 | 2 | //@ compile-flags: -Copt-level=3 |
| 3 | //@ min-llvm-version: 21 | |
| 4 | 3 | |
| 5 | 4 | #![crate_type = "lib"] |
| 6 | 5 | #![feature(c_variadic)] |
tests/codegen-llvm/cffi/c-variadic.rs-1| ... | ... | @@ -1,6 +1,5 @@ |
| 1 | 1 | //@ needs-unwind |
| 2 | 2 | //@ compile-flags: -C no-prepopulate-passes -Copt-level=0 |
| 3 | //@ min-llvm-version: 21 | |
| 4 | 3 | |
| 5 | 4 | #![crate_type = "lib"] |
| 6 | 5 | #![feature(c_variadic)] |
tests/codegen-llvm/dead_on_return.rs-1| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | //@ compile-flags: -C opt-level=3 |
| 2 | //@ min-llvm-version: 21 | |
| 3 | 2 | |
| 4 | 3 | #![crate_type = "lib"] |
| 5 | 4 | #![allow(unused_assignments, unused_variables)] |
tests/codegen-llvm/deduced-param-attrs.rs+8-16| ... | ... | @@ -1,8 +1,5 @@ |
| 1 | 1 | //@ compile-flags: -Copt-level=3 -Cno-prepopulate-passes |
| 2 | 2 | //@ 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 | |
| 6 | 3 | #![feature(custom_mir, core_intrinsics, unboxed_closures)] |
| 7 | 4 | #![crate_type = "lib"] |
| 8 | 5 | extern crate core; |
| ... | ... | @@ -37,15 +34,13 @@ pub fn mutate(mut b: Big) { |
| 37 | 34 | black_box(&b); |
| 38 | 35 | } |
| 39 | 36 | |
| 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) | |
| 42 | 38 | #[unsafe(no_mangle)] |
| 43 | 39 | pub fn deref_mut(c: (BigCell, &mut usize)) { |
| 44 | 40 | *c.1 = 42; |
| 45 | 41 | } |
| 46 | 42 | |
| 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){{.*}}) | |
| 49 | 44 | #[unsafe(no_mangle)] |
| 50 | 45 | #[custom_mir(dialect = "runtime", phase = "optimized")] |
| 51 | 46 | pub fn call_copy_arg(a: Big) { |
| ... | ... | @@ -61,7 +56,7 @@ pub fn call_copy_arg(a: Big) { |
| 61 | 56 | |
| 62 | 57 | // CHECK-LABEL: @call_move_arg( |
| 63 | 58 | // CHECK-NOT: readonly |
| 64 | // LLVM21-SAME: captures(address) | |
| 59 | // CHECK-SAME: captures(address) | |
| 65 | 60 | // CHECK-SAME: ) |
| 66 | 61 | #[unsafe(no_mangle)] |
| 67 | 62 | #[custom_mir(dialect = "runtime", phase = "optimized")] |
| ... | ... | @@ -84,8 +79,7 @@ fn shared_borrow<T>(a: T) { |
| 84 | 79 | // |
| 85 | 80 | // CHECK-LABEL: ; deduced_param_attrs::shared_borrow::<deduced_param_attrs::Big> |
| 86 | 81 | // CHECK-NEXT: ; |
| 87 | // LLVM21-NEXT: (ptr {{.*}}readonly {{.*}}captures(address) {{.*}}%a) | |
| 88 | // LLVM20-NEXT: (ptr {{.*}}readonly {{.*}}%a) | |
| 82 | // CHECK-NEXT: (ptr {{.*}}readonly {{.*}}captures(address) {{.*}}%a) | |
| 89 | 83 | pub static A0: fn(Big) = shared_borrow; |
| 90 | 84 | |
| 91 | 85 | // !Freeze parameter can be mutated through a shared borrow. |
| ... | ... | @@ -113,16 +107,14 @@ fn consume<T>(_: T) {} |
| 113 | 107 | // |
| 114 | 108 | // CHECK-LABEL: ; deduced_param_attrs::consume::<deduced_param_attrs::BigCell> |
| 115 | 109 | // CHECK-NEXT: ; |
| 116 | // LLVM21-NEXT: (ptr {{.*}}readonly {{.*}}captures(none) {{.*}}) | |
| 117 | // LLVM20-NEXT: (ptr {{.*}}readonly {{.*}}) | |
| 110 | // CHECK-NEXT: (ptr {{.*}}readonly {{.*}}captures(none) {{.*}}) | |
| 118 | 111 | pub static B0: fn(BigCell) = consume; |
| 119 | 112 | |
| 120 | 113 | // The parameter needs to be dropped. |
| 121 | 114 | // |
| 122 | 115 | // CHECK-LABEL: ; deduced_param_attrs::consume::<deduced_param_attrs::BigDrop> |
| 123 | 116 | // CHECK-NEXT: ; |
| 124 | // LLVM21-NEXT: (ptr {{.*}}captures(address) {{.*}}) | |
| 125 | // LLVM20-NEXT: (ptr {{.*}}) | |
| 117 | // CHECK-NEXT: (ptr {{.*}}captures(address) {{.*}}) | |
| 126 | 118 | pub static B1: fn(BigDrop) = consume; |
| 127 | 119 | |
| 128 | 120 | fn consume_parts<T>(t: (T, T)) { |
| ... | ... | @@ -160,13 +152,13 @@ pub fn never_returns() -> [u8; 80] { |
| 160 | 152 | loop {} |
| 161 | 153 | } |
| 162 | 154 | |
| 163 | // LLVM21-LABEL: @not_captured_return_place(ptr{{.*}} captures(none) {{.*}}%_0) | |
| 155 | // CHECK-LABEL: @not_captured_return_place(ptr{{.*}} captures(none) {{.*}}%_0) | |
| 164 | 156 | #[unsafe(no_mangle)] |
| 165 | 157 | pub fn not_captured_return_place() -> [u8; 80] { |
| 166 | 158 | [0u8; 80] |
| 167 | 159 | } |
| 168 | 160 | |
| 169 | // LLVM21-LABEL: @captured_return_place(ptr{{.*}} captures(address) {{.*}}%_0) | |
| 161 | // CHECK-LABEL: @captured_return_place(ptr{{.*}} captures(address) {{.*}}%_0) | |
| 170 | 162 | #[unsafe(no_mangle)] |
| 171 | 163 | pub fn captured_return_place() -> [u8; 80] { |
| 172 | 164 | black_box([0u8; 80]) |
tests/codegen-llvm/enum/enum-discriminant-eq.rs+11-33| ... | ... | @@ -1,8 +1,5 @@ |
| 1 | 1 | //@ compile-flags: -Copt-level=3 -Zmerge-functions=disabled |
| 2 | 2 | //@ only-64bit |
| 3 | //@ revisions: LLVM20 LLVM21 | |
| 4 | //@ [LLVM21] min-llvm-version: 21 | |
| 5 | //@ [LLVM20] max-llvm-major-version: 20 | |
| 6 | 3 | |
| 7 | 4 | // The `derive(PartialEq)` on enums with field-less variants compares discriminants, |
| 8 | 5 | // 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 { |
| 92 | 89 | |
| 93 | 90 | // CHECK: %[[A_NOT_HOLE:.+]] = icmp ne i8 %a, 3 |
| 94 | 91 | // CHECK: tail call void @llvm.assume(i1 %[[A_NOT_HOLE]]) |
| 95 | // LLVM20: %[[A_REL_DISCR:.+]] = add nsw i8 %a, -2 | |
| 96 | 92 | // 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 | |
| 98 | 93 | |
| 99 | 94 | // CHECK: %[[B_NOT_HOLE:.+]] = icmp ne i8 %b, 3 |
| 100 | 95 | // CHECK: tail call void @llvm.assume(i1 %[[B_NOT_HOLE]]) |
| 101 | // LLVM20: %[[B_REL_DISCR:.+]] = add nsw i8 %b, -2 | |
| 102 | 96 | // 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 | |
| 104 | 97 | |
| 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 | |
| 107 | 100 | |
| 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]] | |
| 110 | 102 | // CHECK: ret i1 %[[R]] |
| 111 | 103 | discriminant_value(&a) == discriminant_value(&b) |
| 112 | 104 | } |
| ... | ... | @@ -117,21 +109,16 @@ pub fn mid_ord_eq_discr(a: Mid<Ordering>, b: Mid<Ordering>) -> bool { |
| 117 | 109 | |
| 118 | 110 | // CHECK: %[[A_NOT_HOLE:.+]] = icmp ne i8 %a, 3 |
| 119 | 111 | // CHECK: tail call void @llvm.assume(i1 %[[A_NOT_HOLE]]) |
| 120 | // LLVM20: %[[A_REL_DISCR:.+]] = add nsw i8 %a, -2 | |
| 121 | 112 | // CHECK: %[[A_IS_NICHE:.+]] = icmp sgt i8 %a, 1 |
| 122 | // LLVM20: %[[A_DISCR:.+]] = select i1 %[[A_IS_NICHE]], i8 %[[A_REL_DISCR]], i8 1 | |
| 123 | 113 | |
| 124 | 114 | // CHECK: %[[B_NOT_HOLE:.+]] = icmp ne i8 %b, 3 |
| 125 | 115 | // CHECK: tail call void @llvm.assume(i1 %[[B_NOT_HOLE]]) |
| 126 | // LLVM20: %[[B_REL_DISCR:.+]] = add nsw i8 %b, -2 | |
| 127 | 116 | // CHECK: %[[B_IS_NICHE:.+]] = icmp sgt i8 %b, 1 |
| 128 | // LLVM20: %[[B_DISCR:.+]] = select i1 %[[B_IS_NICHE]], i8 %[[B_REL_DISCR]], i8 1 | |
| 129 | 117 | |
| 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 | |
| 132 | 120 | |
| 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]] | |
| 135 | 122 | // CHECK: ret i1 %[[R]] |
| 136 | 123 | discriminant_value(&a) == discriminant_value(&b) |
| 137 | 124 | } |
| ... | ... | @@ -150,18 +137,14 @@ pub fn mid_ac_eq_discr(a: Mid<AC>, b: Mid<AC>) -> bool { |
| 150 | 137 | |
| 151 | 138 | // CHECK: %[[A_NOT_HOLE:.+]] = icmp ne i8 %a, -127 |
| 152 | 139 | // CHECK: tail call void @llvm.assume(i1 %[[A_NOT_HOLE]]) |
| 153 | // LLVM20: %[[A_REL_DISCR:.+]] = xor i8 %a, -128 | |
| 154 | 140 | // CHECK: %[[A_IS_NICHE:.+]] = icmp slt i8 %a, 0 |
| 155 | // LLVM20: %[[A_DISCR:.+]] = select i1 %[[A_IS_NICHE]], i8 %[[A_REL_DISCR]], i8 1 | |
| 156 | 141 | |
| 157 | 142 | // CHECK: %[[B_NOT_HOLE:.+]] = icmp ne i8 %b, -127 |
| 158 | 143 | // CHECK: tail call void @llvm.assume(i1 %[[B_NOT_HOLE]]) |
| 159 | // LLVM20: %[[B_REL_DISCR:.+]] = xor i8 %b, -128 | |
| 160 | 144 | // CHECK: %[[B_IS_NICHE:.+]] = icmp slt i8 %b, 0 |
| 161 | // LLVM20: %[[B_DISCR:.+]] = select i1 %[[B_IS_NICHE]], i8 %[[B_REL_DISCR]], i8 1 | |
| 162 | 145 | |
| 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 | |
| 165 | 148 | |
| 166 | 149 | // CHECK: %[[R:.+]] = icmp eq i8 %[[A_DISCR]], %[[B_DISCR]] |
| 167 | 150 | // CHECK: ret i1 %[[R]] |
| ... | ... | @@ -177,22 +160,17 @@ pub fn mid_giant_eq_discr(a: Mid<Giant>, b: Mid<Giant>) -> bool { |
| 177 | 160 | // CHECK: %[[A_NOT_HOLE:.+]] = icmp ne i128 %a, 6 |
| 178 | 161 | // CHECK: tail call void @llvm.assume(i1 %[[A_NOT_HOLE]]) |
| 179 | 162 | // CHECK: %[[A_TRUNC:.+]] = trunc nuw nsw i128 %a to i64 |
| 180 | // LLVM20: %[[A_REL_DISCR:.+]] = add nsw i64 %[[A_TRUNC]], -5 | |
| 181 | 163 | // 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 | |
| 183 | 164 | |
| 184 | 165 | // CHECK: %[[B_NOT_HOLE:.+]] = icmp ne i128 %b, 6 |
| 185 | 166 | // CHECK: tail call void @llvm.assume(i1 %[[B_NOT_HOLE]]) |
| 186 | 167 | // CHECK: %[[B_TRUNC:.+]] = trunc nuw nsw i128 %b to i64 |
| 187 | // LLVM20: %[[B_REL_DISCR:.+]] = add nsw i64 %[[B_TRUNC]], -5 | |
| 188 | 168 | // 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 | |
| 190 | 169 | |
| 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]] | |
| 194 | 173 | |
| 195 | // LLVM20: %[[R:.+]] = icmp eq i64 %[[A_DISCR]], %[[B_DISCR]] | |
| 196 | 174 | // CHECK: ret i1 %[[R]] |
| 197 | 175 | discriminant_value(&a) == discriminant_value(&b) |
| 198 | 176 | } |
tests/codegen-llvm/issues/issue-101082.rs-1| ... | ... | @@ -11,7 +11,6 @@ |
| 11 | 11 | // at the time still sometimes fails, so only verify it for the power-of-two size |
| 12 | 12 | // - https://github.com/llvm/llvm-project/issues/134735 |
| 13 | 13 | //@[x86-64-v3] only-x86_64 |
| 14 | //@[x86-64-v3] min-llvm-version: 21 | |
| 15 | 14 | //@[x86-64-v3] compile-flags: -Ctarget-cpu=x86-64-v3 |
| 16 | 15 | |
| 17 | 16 | #![crate_type = "lib"] |
tests/codegen-llvm/issues/issue-122734-match-eq.rs-1| ... | ... | @@ -1,4 +1,3 @@ |
| 1 | //@ min-llvm-version: 21 | |
| 2 | 1 | //@ compile-flags: -Copt-level=3 -Zmerge-functions=disabled |
| 3 | 2 | //! Tests that matching + eq on `Option<FieldlessEnum>` produces a simple compare with no branching |
| 4 | 3 |
tests/codegen-llvm/issues/issue-138497-nonzero-remove-trailing-zeroes.rs-1| ... | ... | @@ -1,7 +1,6 @@ |
| 1 | 1 | //! This test checks that removing trailing zeroes from a `NonZero`, |
| 2 | 2 | //! then creating a new `NonZero` from the result does not panic. |
| 3 | 3 | |
| 4 | //@ min-llvm-version: 21 | |
| 5 | 4 | //@ compile-flags: -O -Zmerge-functions=disabled |
| 6 | 5 | #![crate_type = "lib"] |
| 7 | 6 |
tests/codegen-llvm/issues/saturating-sub-index-139759.rs-1| ... | ... | @@ -2,7 +2,6 @@ |
| 2 | 2 | // index doesn't generate another bounds check. |
| 3 | 3 | |
| 4 | 4 | //@ compile-flags: -Copt-level=3 |
| 5 | //@ min-llvm-version: 21 | |
| 6 | 5 | |
| 7 | 6 | #![crate_type = "lib"] |
| 8 | 7 |
tests/codegen-llvm/lib-optimizations/append-elements.rs-1| ... | ... | @@ -1,6 +1,5 @@ |
| 1 | 1 | //@ compile-flags: -O -Zmerge-functions=disabled |
| 2 | 2 | //@ needs-deterministic-layouts |
| 3 | //@ min-llvm-version: 21 | |
| 4 | 3 | //@ ignore-std-debug-assertions (causes different value naming) |
| 5 | 4 | #![crate_type = "lib"] |
| 6 | 5 |
tests/codegen-llvm/option-niche-eq.rs+4-6| ... | ... | @@ -1,6 +1,4 @@ |
| 1 | //@ revisions: REGULAR LLVM21 | |
| 2 | 1 | //@ compile-flags: -Copt-level=3 -Zmerge-functions=disabled |
| 3 | //@ [LLVM21] min-llvm-version: 21 | |
| 4 | 2 | #![crate_type = "lib"] |
| 5 | 3 | |
| 6 | 4 | extern crate core; |
| ... | ... | @@ -76,11 +74,11 @@ pub fn niche_eq(l: Option<EnumWithNiche>, r: Option<EnumWithNiche>) -> bool { |
| 76 | 74 | l == r |
| 77 | 75 | } |
| 78 | 76 | |
| 79 | // LLVM21-LABEL: @bool_eq | |
| 77 | // CHECK-LABEL: @bool_eq | |
| 80 | 78 | #[no_mangle] |
| 81 | 79 | pub 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 | |
| 85 | 83 | l == r |
| 86 | 84 | } |
tests/codegen-llvm/read-only-capture-opt.rs-1| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | //@ compile-flags: -C opt-level=3 -Z mir-opt-level=0 |
| 2 | //@ min-llvm-version: 21 | |
| 3 | 2 | |
| 4 | 3 | #![crate_type = "lib"] |
| 5 | 4 |
tests/codegen-llvm/riscv-abi/call-llvm-intrinsics.rs-1| ... | ... | @@ -5,7 +5,6 @@ |
| 5 | 5 | //@ [riscv32gc] needs-llvm-components: riscv |
| 6 | 6 | //@ [riscv64gc] compile-flags: --target riscv64gc-unknown-linux-gnu |
| 7 | 7 | //@ [riscv64gc] needs-llvm-components: riscv |
| 8 | //@ min-llvm-version: 21 | |
| 9 | 8 | |
| 10 | 9 | #![feature(link_llvm_intrinsics)] |
| 11 | 10 | #![feature(no_core, lang_items)] |
tests/codegen-llvm/sanitizer/kcfi/add-kcfi-arity-flag.rs-1| ... | ... | @@ -5,7 +5,6 @@ |
| 5 | 5 | //@ [x86_64] compile-flags: --target x86_64-unknown-none |
| 6 | 6 | //@ [x86_64] needs-llvm-components: x86 |
| 7 | 7 | //@ compile-flags: -Ctarget-feature=-crt-static -Cpanic=abort -Zsanitizer=kcfi -Zsanitizer-kcfi-arity |
| 8 | //@ min-llvm-version: 21.0.0 | |
| 9 | 8 | |
| 10 | 9 | #![feature(no_core, lang_items)] |
| 11 | 10 | #![crate_type = "lib"] |
tests/codegen-llvm/slice-range-indexing.rs-1| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | //@ compile-flags: -Copt-level=3 |
| 2 | //@ min-llvm-version: 21 | |
| 3 | 2 | |
| 4 | 3 | #![crate_type = "lib"] |
| 5 | 4 |
tests/codegen-llvm/str-range-indexing.rs-1| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | //@ compile-flags: -Copt-level=3 |
| 2 | //@ min-llvm-version: 21 | |
| 3 | 2 | |
| 4 | 3 | #![crate_type = "lib"] |
| 5 | 4 |
tests/codegen-llvm/vec-calloc.rs+9-12| ... | ... | @@ -1,6 +1,4 @@ |
| 1 | //@ revisions: normal llvm21 | |
| 2 | 1 | //@ compile-flags: -Copt-level=3 -Z merge-functions=disabled |
| 3 | //@ [llvm21] min-llvm-version: 21 | |
| 4 | 2 | //@ only-x86_64 |
| 5 | 3 | |
| 6 | 4 | #![crate_type = "lib"] |
| ... | ... | @@ -178,21 +176,20 @@ pub fn vec_option_i32(n: usize) -> Vec<Option<i32>> { |
| 178 | 176 | vec![None; n] |
| 179 | 177 | } |
| 180 | 178 | |
| 181 | // LLVM21-LABEL: @vec_array | |
| 182 | #[cfg(llvm21)] | |
| 179 | // CHECK-LABEL: @vec_array | |
| 183 | 180 | #[no_mangle] |
| 184 | 181 | pub 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( | |
| 188 | 185 | |
| 189 | // LLVM21: call {{.*}}__rust_alloc_zeroed( | |
| 186 | // CHECK: call {{.*}}__rust_alloc_zeroed( | |
| 190 | 187 | |
| 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( | |
| 194 | 191 | |
| 195 | // LLVM21: ret void | |
| 192 | // CHECK: ret void | |
| 196 | 193 | vec![[0; 1_000_000]; 3] |
| 197 | 194 | } |
| 198 | 195 |
tests/run-make/repr128-dwarf/main.rs+1-7| ... | ... | @@ -17,7 +17,6 @@ pub enum I128Enum { |
| 17 | 17 | I128D = i128::MAX.to_le(), |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | #[cfg(not(old_llvm))] | |
| 21 | 20 | #[repr(u128)] |
| 22 | 21 | pub enum U128VariantEnum { |
| 23 | 22 | VariantU128A(u8) = 0_u128.to_le(), |
| ... | ... | @@ -26,7 +25,6 @@ pub enum U128VariantEnum { |
| 26 | 25 | VariantU128D = u128::MAX.to_le(), |
| 27 | 26 | } |
| 28 | 27 | |
| 29 | #[cfg(not(old_llvm))] | |
| 30 | 28 | #[repr(i128)] |
| 31 | 29 | pub enum I128VariantEnum { |
| 32 | 30 | VariantI128A(u8) = 0_i128.to_le(), |
| ... | ... | @@ -37,13 +35,9 @@ pub enum I128VariantEnum { |
| 37 | 35 | |
| 38 | 36 | pub fn f(_: U128Enum, _: I128Enum) {} |
| 39 | 37 | |
| 40 | #[cfg(not(old_llvm))] | |
| 41 | 38 | pub fn g(_: U128VariantEnum, _: I128VariantEnum) {} |
| 42 | 39 | |
| 43 | 40 | fn main() { |
| 44 | 41 | 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)); | |
| 49 | 43 | } |
tests/run-make/repr128-dwarf/rmake.rs+2-19| ... | ... | @@ -13,25 +13,8 @@ use object::{Object, ObjectSection}; |
| 13 | 13 | use run_make_support::{gimli, object, rfs, rustc}; |
| 14 | 14 | |
| 15 | 15 | fn 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 | ||
| 30 | 16 | let output = PathBuf::from("repr128"); |
| 31 | 17 | let mut rustc = rustc(); |
| 32 | if is_old_llvm { | |
| 33 | rustc.cfg("old_llvm"); | |
| 34 | } | |
| 35 | 18 | rustc.input("main.rs").output(&output).arg("-Cdebuginfo=2").run(); |
| 36 | 19 | // Mach-O uses packed debug info |
| 37 | 20 | let dsym_location = output |
| ... | ... | @@ -88,7 +71,7 @@ fn main() { |
| 88 | 71 | |
| 89 | 72 | while let Some((_, entry)) = cursor.next_dfs().unwrap() { |
| 90 | 73 | match entry.tag() { |
| 91 | gimli::constants::DW_TAG_variant if !is_old_llvm => { | |
| 74 | gimli::constants::DW_TAG_variant => { | |
| 92 | 75 | let Some(value) = entry.attr(gimli::constants::DW_AT_discr_value).unwrap() |
| 93 | 76 | else { |
| 94 | 77 | // `std` enums might have variants without `DW_AT_discr_value`. |
| ... | ... | @@ -143,7 +126,7 @@ fn main() { |
| 143 | 126 | if !enumerators_to_find.is_empty() { |
| 144 | 127 | panic!("Didn't find debug enumerator entries for {enumerators_to_find:?}"); |
| 145 | 128 | } |
| 146 | if !is_old_llvm && !variants_to_find.is_empty() { | |
| 129 | if !variants_to_find.is_empty() { | |
| 147 | 130 | panic!("Didn't find debug variant entries for {variants_to_find:?}"); |
| 148 | 131 | } |
| 149 | 132 | } |
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 @@ |
| 1 | error: `-Zsanitizer-kcfi-arity` requires LLVM 21.0.0 or later | |
| 2 | ||
| 3 | error: aborting due to 1 previous error | |
| 4 |