diff --git a/.gitmodules b/.gitmodules index 40e6fc2c19db0..8618f61f04acd 100644 --- a/.gitmodules +++ b/.gitmodules @@ -37,7 +37,7 @@ [submodule "src/llvm-project"] path = src/llvm-project url = https://github.com/rust-lang/llvm-project.git - branch = rustc/11.0-2021-01-05 + branch = rustc/12.0-2021-02-03 [submodule "src/doc/embedded-book"] path = src/doc/embedded-book url = https://github.com/rust-embedded/book.git diff --git a/compiler/rustc_codegen_llvm/src/abi.rs b/compiler/rustc_codegen_llvm/src/abi.rs index d714ff1fe9b4a..d9393ffe534ac 100644 --- a/compiler/rustc_codegen_llvm/src/abi.rs +++ b/compiler/rustc_codegen_llvm/src/abi.rs @@ -430,7 +430,13 @@ impl<'tcx> FnAbiLlvmExt<'tcx> for FnAbi<'tcx, Ty<'tcx>> { PassMode::Indirect { ref attrs, extra_attrs: _, on_stack } => { assert!(!on_stack); let i = apply(attrs); - llvm::Attribute::StructRet.apply_llfn(llvm::AttributePlace::Argument(i), llfn); + unsafe { + llvm::LLVMRustAddStructRetAttr( + llfn, + llvm::AttributePlace::Argument(i).as_uint(), + self.ret.layout.llvm_type(cx), + ); + } } _ => {} } @@ -486,8 +492,13 @@ impl<'tcx> FnAbiLlvmExt<'tcx> for FnAbi<'tcx, Ty<'tcx>> { PassMode::Indirect { ref attrs, extra_attrs: _, on_stack } => { assert!(!on_stack); let i = apply(attrs); - llvm::Attribute::StructRet - .apply_callsite(llvm::AttributePlace::Argument(i), callsite); + unsafe { + llvm::LLVMRustAddStructRetCallSiteAttr( + callsite, + llvm::AttributePlace::Argument(i).as_uint(), + self.ret.layout.llvm_type(bx), + ); + } } _ => {} } diff --git a/compiler/rustc_codegen_llvm/src/asm.rs b/compiler/rustc_codegen_llvm/src/asm.rs index 26815de403fd2..38c8ae711a4cb 100644 --- a/compiler/rustc_codegen_llvm/src/asm.rs +++ b/compiler/rustc_codegen_llvm/src/asm.rs @@ -304,6 +304,7 @@ impl AsmBuilderMethods<'tcx> for Builder<'a, 'll, 'tcx> { } else if options.contains(InlineAsmOptions::READONLY) { llvm::Attribute::ReadOnly.apply_callsite(llvm::AttributePlace::Function, result); } + llvm::Attribute::WillReturn.apply_callsite(llvm::AttributePlace::Function, result); } else if options.contains(InlineAsmOptions::NOMEM) { llvm::Attribute::InaccessibleMemOnly .apply_callsite(llvm::AttributePlace::Function, result); diff --git a/compiler/rustc_codegen_llvm/src/context.rs b/compiler/rustc_codegen_llvm/src/context.rs index 3ddc742420202..9f6a2ae3ca1b7 100644 --- a/compiler/rustc_codegen_llvm/src/context.rs +++ b/compiler/rustc_codegen_llvm/src/context.rs @@ -104,6 +104,10 @@ fn strip_x86_address_spaces(data_layout: String) -> String { data_layout.replace("-p270:32:32-p271:32:32-p272:64:64-", "-") } +fn strip_powerpc64_vectors(data_layout: String) -> String { + data_layout.replace("-v256:256:256-v512:512:512", "") +} + pub unsafe fn create_module( tcx: TyCtxt<'_>, llcx: &'ll llvm::Context, @@ -119,6 +123,9 @@ pub unsafe fn create_module( { target_data_layout = strip_x86_address_spaces(target_data_layout); } + if llvm_util::get_version() < (12, 0, 0) && sess.target.arch == "powerpc64" { + target_data_layout = strip_powerpc64_vectors(target_data_layout); + } // Ensure the data-layout values hardcoded remain the defaults. if sess.target.is_builtin { diff --git a/compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs b/compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs index e777f363eb084..e47b8fde40fee 100644 --- a/compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs +++ b/compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs @@ -162,7 +162,7 @@ pub(crate) fn write_filenames_section_to_buffer<'a>( pub(crate) fn write_mapping_to_buffer( virtual_file_mapping: Vec, expressions: Vec, - mut mapping_regions: Vec, + mapping_regions: Vec, buffer: &RustString, ) { unsafe { @@ -171,7 +171,7 @@ pub(crate) fn write_mapping_to_buffer( virtual_file_mapping.len() as c_uint, expressions.as_ptr(), expressions.len() as c_uint, - mapping_regions.as_mut_ptr(), + mapping_regions.as_ptr(), mapping_regions.len() as c_uint, buffer, ); diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs index 8c1740d8f25f0..e6d60044c84b4 100644 --- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs +++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs @@ -132,6 +132,7 @@ pub enum Attribute { ReadNone = 26, InaccessibleMemOnly = 27, SanitizeHWAddress = 28, + WillReturn = 29, } /// LLVMIntPredicate @@ -239,6 +240,7 @@ pub enum TypeKind { Token = 16, ScalableVector = 17, BFloat = 18, + X86_AMX = 19, } impl TypeKind { @@ -263,6 +265,7 @@ impl TypeKind { TypeKind::Token => rustc_codegen_ssa::common::TypeKind::Token, TypeKind::ScalableVector => rustc_codegen_ssa::common::TypeKind::ScalableVector, TypeKind::BFloat => rustc_codegen_ssa::common::TypeKind::BFloat, + TypeKind::X86_AMX => rustc_codegen_ssa::common::TypeKind::X86_AMX, } } } @@ -674,9 +677,7 @@ pub mod coverageinfo { /// array", encoded separately), and source location (start and end positions of the represented /// code region). /// - /// Aligns with [llvm::coverage::CounterMappingRegion](https://github.com/rust-lang/llvm-project/blob/rustc/11.0-2020-10-12/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h#L224-L227) - /// Important: The Rust struct layout (order and types of fields) must match its C++ - /// counterpart. + /// Matches LLVMRustCounterMappingRegion. #[derive(Copy, Clone, Debug)] #[repr(C)] pub struct CounterMappingRegion { @@ -1073,6 +1074,7 @@ extern "C" { pub fn LLVMRustAddDereferenceableAttr(Fn: &Value, index: c_uint, bytes: u64); pub fn LLVMRustAddDereferenceableOrNullAttr(Fn: &Value, index: c_uint, bytes: u64); pub fn LLVMRustAddByValAttr(Fn: &Value, index: c_uint, ty: &Type); + pub fn LLVMRustAddStructRetAttr(Fn: &Value, index: c_uint, ty: &Type); pub fn LLVMRustAddFunctionAttribute(Fn: &Value, index: c_uint, attr: Attribute); pub fn LLVMRustAddFunctionAttrStringValue( Fn: &Value, @@ -1108,6 +1110,7 @@ extern "C" { pub fn LLVMRustAddDereferenceableCallSiteAttr(Instr: &Value, index: c_uint, bytes: u64); pub fn LLVMRustAddDereferenceableOrNullCallSiteAttr(Instr: &Value, index: c_uint, bytes: u64); pub fn LLVMRustAddByValCallSiteAttr(Instr: &Value, index: c_uint, ty: &Type); + pub fn LLVMRustAddStructRetCallSiteAttr(Instr: &Value, index: c_uint, ty: &Type); // Operations on load/store instructions (only) pub fn LLVMSetVolatile(MemoryAccessInst: &Value, volatile: Bool); @@ -1792,7 +1795,7 @@ extern "C" { NumVirtualFileMappingIDs: c_uint, Expressions: *const coverage_map::CounterExpression, NumExpressions: c_uint, - MappingRegions: *mut coverageinfo::CounterMappingRegion, + MappingRegions: *const coverageinfo::CounterMappingRegion, NumMappingRegions: c_uint, BufferOut: &RustString, ); diff --git a/compiler/rustc_codegen_ssa/src/common.rs b/compiler/rustc_codegen_ssa/src/common.rs index 780b1d2cd9433..afd83bfcb5692 100644 --- a/compiler/rustc_codegen_ssa/src/common.rs +++ b/compiler/rustc_codegen_ssa/src/common.rs @@ -95,6 +95,7 @@ pub enum TypeKind { Token, ScalableVector, BFloat, + X86_AMX, } // FIXME(mw): Anything that is produced via DepGraph::with_task() must implement diff --git a/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp index 25badc3f4e17b..e97d96e3a4eab 100644 --- a/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp @@ -8,6 +8,17 @@ using namespace llvm; +struct LLVMRustCounterMappingRegion { + coverage::Counter Count; + uint32_t FileID; + uint32_t ExpandedFileID; + uint32_t LineStart; + uint32_t ColumnStart; + uint32_t LineEnd; + uint32_t ColumnEnd; + coverage::CounterMappingRegion::RegionKind Kind; +}; + extern "C" void LLVMRustCoverageWriteFilenamesSectionToBuffer( const char* const Filenames[], size_t FilenamesLen, @@ -27,13 +38,22 @@ extern "C" void LLVMRustCoverageWriteMappingToBuffer( unsigned NumVirtualFileMappingIDs, const coverage::CounterExpression *Expressions, unsigned NumExpressions, - coverage::CounterMappingRegion *MappingRegions, + LLVMRustCounterMappingRegion *RustMappingRegions, unsigned NumMappingRegions, RustStringRef BufferOut) { + // Convert from FFI representation to LLVM representation. + SmallVector MappingRegions; + MappingRegions.reserve(NumMappingRegions); + for (const auto &Region : makeArrayRef(RustMappingRegions, NumMappingRegions)) { + MappingRegions.emplace_back( + Region.Count, Region.FileID, Region.ExpandedFileID, + Region.LineStart, Region.ColumnStart, Region.LineEnd, Region.ColumnEnd, + Region.Kind); + } auto CoverageMappingWriter = coverage::CoverageMappingWriter( makeArrayRef(VirtualFileMappingIDs, NumVirtualFileMappingIDs), makeArrayRef(Expressions, NumExpressions), - makeMutableArrayRef(MappingRegions, NumMappingRegions)); + MappingRegions); RawRustStringOstream OS(BufferOut); CoverageMappingWriter.write(OS); } diff --git a/compiler/rustc_llvm/llvm-wrapper/LLVMWrapper.h b/compiler/rustc_llvm/llvm-wrapper/LLVMWrapper.h index 0e3bf5615af7b..f67e06706ea57 100644 --- a/compiler/rustc_llvm/llvm-wrapper/LLVMWrapper.h +++ b/compiler/rustc_llvm/llvm-wrapper/LLVMWrapper.h @@ -86,6 +86,7 @@ enum LLVMRustAttribute { ReadNone = 26, InaccessibleMemOnly = 27, SanitizeHWAddress = 28, + WillReturn = 29, }; typedef struct OpaqueRustString *RustStringRef; diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp index 5263d5dcf3e8f..2f28162f908ac 100644 --- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp @@ -5,6 +5,7 @@ #include "LLVMWrapper.h" +#include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/TargetLibraryInfo.h" #include "llvm/Analysis/TargetTransformInfo.h" #include "llvm/CodeGen/TargetSubtargetInfo.h" @@ -683,6 +684,25 @@ void LLVMSelfProfileInitializeCallbacks( PassInstrumentationCallbacks& PIC, void* LlvmSelfProfiler, LLVMRustSelfProfileBeforePassCallback BeforePassCallback, LLVMRustSelfProfileAfterPassCallback AfterPassCallback) { +#if LLVM_VERSION_GE(12, 0) + PIC.registerBeforeNonSkippedPassCallback([LlvmSelfProfiler, BeforePassCallback]( + StringRef Pass, llvm::Any Ir) { + std::string PassName = Pass.str(); + std::string IrName = LLVMRustwrappedIrGetName(Ir); + BeforePassCallback(LlvmSelfProfiler, PassName.c_str(), IrName.c_str()); + }); + + PIC.registerAfterPassCallback( + [LlvmSelfProfiler, AfterPassCallback](StringRef Pass, llvm::Any IR, + const PreservedAnalyses &Preserved) { + AfterPassCallback(LlvmSelfProfiler); + }); + + PIC.registerAfterPassInvalidatedCallback( + [LlvmSelfProfiler, AfterPassCallback](StringRef Pass, const PreservedAnalyses &Preserved) { + AfterPassCallback(LlvmSelfProfiler); + }); +#else PIC.registerBeforePassCallback([LlvmSelfProfiler, BeforePassCallback]( StringRef Pass, llvm::Any Ir) { std::string PassName = Pass.str(); @@ -700,6 +720,7 @@ void LLVMSelfProfileInitializeCallbacks( [LlvmSelfProfiler, AfterPassCallback](StringRef Pass) { AfterPassCallback(LlvmSelfProfiler); }); +#endif PIC.registerBeforeAnalysisCallback([LlvmSelfProfiler, BeforePassCallback]( StringRef Pass, llvm::Any Ir) { @@ -760,8 +781,15 @@ LLVMRustOptimizeWithNewPassManager( PTO.LoopVectorization = LoopVectorize; PTO.SLPVectorization = SLPVectorize; + // FIXME: We may want to expose this as an option. + bool DebugPassManager = false; + PassInstrumentationCallbacks PIC; +#if LLVM_VERSION_GE(12, 0) + StandardInstrumentations SI(DebugPassManager); +#else StandardInstrumentations SI; +#endif SI.registerCallbacks(PIC); if (LlvmSelfProfiler){ @@ -777,10 +805,12 @@ LLVMRustOptimizeWithNewPassManager( PGOOpt = PGOOptions(PGOUsePath, "", "", PGOOptions::IRUse); } +#if LLVM_VERSION_GE(12, 0) + PassBuilder PB(DebugPassManager, TM, PTO, PGOOpt, &PIC); +#else PassBuilder PB(TM, PTO, PGOOpt, &PIC); +#endif - // FIXME: We may want to expose this as an option. - bool DebugPassManager = false; LoopAnalysisManager LAM(DebugPassManager); FunctionAnalysisManager FAM(DebugPassManager); CGSCCAnalysisManager CGAM(DebugPassManager); @@ -802,7 +832,8 @@ LLVMRustOptimizeWithNewPassManager( // We manually collect pipeline callbacks so we can apply them at O0, where the // PassBuilder does not create a pipeline. - std::vector> PipelineStartEPCallbacks; + std::vector> + PipelineStartEPCallbacks; #if LLVM_VERSION_GE(11, 0) std::vector> OptimizerLastEPCallbacks; @@ -812,9 +843,11 @@ LLVMRustOptimizeWithNewPassManager( #endif if (VerifyIR) { - PipelineStartEPCallbacks.push_back([VerifyIR](ModulePassManager &MPM) { + PipelineStartEPCallbacks.push_back( + [VerifyIR](ModulePassManager &MPM, PassBuilder::OptimizationLevel Level) { MPM.addPass(VerifierPass()); - }); + } + ); } if (SanitizerOptions) { @@ -832,9 +865,11 @@ LLVMRustOptimizeWithNewPassManager( ); #else #if LLVM_VERSION_GE(10, 0) - PipelineStartEPCallbacks.push_back([Options](ModulePassManager &MPM) { - MPM.addPass(MemorySanitizerPass(Options)); - }); + PipelineStartEPCallbacks.push_back( + [Options](ModulePassManager &MPM, PassBuilder::OptimizationLevel Level) { + MPM.addPass(MemorySanitizerPass(Options)); + } + ); #endif OptimizerLastEPCallbacks.push_back( [Options](FunctionPassManager &FPM, PassBuilder::OptimizationLevel Level) { @@ -854,9 +889,11 @@ LLVMRustOptimizeWithNewPassManager( ); #else #if LLVM_VERSION_GE(10, 0) - PipelineStartEPCallbacks.push_back([](ModulePassManager &MPM) { - MPM.addPass(ThreadSanitizerPass()); - }); + PipelineStartEPCallbacks.push_back( + [](ModulePassManager &MPM, PassBuilder::OptimizationLevel Level) { + MPM.addPass(ThreadSanitizerPass()); + } + ); #endif OptimizerLastEPCallbacks.push_back( [](FunctionPassManager &FPM, PassBuilder::OptimizationLevel Level) { @@ -879,9 +916,11 @@ LLVMRustOptimizeWithNewPassManager( } ); #else - PipelineStartEPCallbacks.push_back([&](ModulePassManager &MPM) { - MPM.addPass(RequireAnalysisPass()); - }); + PipelineStartEPCallbacks.push_back( + [&](ModulePassManager &MPM, PassBuilder::OptimizationLevel Level) { + MPM.addPass(RequireAnalysisPass()); + } + ); OptimizerLastEPCallbacks.push_back( [SanitizerOptions](FunctionPassManager &FPM, PassBuilder::OptimizationLevel Level) { FPM.addPass(AddressSanitizerPass( @@ -890,7 +929,7 @@ LLVMRustOptimizeWithNewPassManager( } ); PipelineStartEPCallbacks.push_back( - [SanitizerOptions](ModulePassManager &MPM) { + [SanitizerOptions](ModulePassManager &MPM, PassBuilder::OptimizationLevel Level) { MPM.addPass(ModuleAddressSanitizerPass( /*CompileKernel=*/false, SanitizerOptions->SanitizeAddressRecover)); } @@ -907,7 +946,7 @@ LLVMRustOptimizeWithNewPassManager( ); #else PipelineStartEPCallbacks.push_back( - [SanitizerOptions](ModulePassManager &MPM) { + [SanitizerOptions](ModulePassManager &MPM, PassBuilder::OptimizationLevel Level) { MPM.addPass(HWAddressSanitizerPass( /*CompileKernel=*/false, SanitizerOptions->SanitizeHWAddressRecover)); } @@ -917,35 +956,53 @@ LLVMRustOptimizeWithNewPassManager( } ModulePassManager MPM(DebugPassManager); + bool NeedThinLTOBufferPasses = UseThinLTOBuffers; if (!NoPrepopulatePasses) { if (OptLevel == PassBuilder::OptimizationLevel::O0) { +#if LLVM_VERSION_GE(12, 0) for (const auto &C : PipelineStartEPCallbacks) - C(MPM); + PB.registerPipelineStartEPCallback(C); + for (const auto &C : OptimizerLastEPCallbacks) + PB.registerOptimizerLastEPCallback(C); -#if LLVM_VERSION_GE(11, 0) + // Pass false as we manually schedule ThinLTOBufferPasses below. + MPM = PB.buildO0DefaultPipeline(OptLevel, /* PreLinkLTO */ false); +#else + for (const auto &C : PipelineStartEPCallbacks) + C(MPM, OptLevel); + +# if LLVM_VERSION_GE(11, 0) for (const auto &C : OptimizerLastEPCallbacks) C(MPM, OptLevel); -#else +# else if (!OptimizerLastEPCallbacks.empty()) { FunctionPassManager FPM(DebugPassManager); for (const auto &C : OptimizerLastEPCallbacks) C(FPM, OptLevel); MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM))); } -#endif +# endif MPM.addPass(AlwaysInlinerPass(EmitLifetimeMarkers)); -#if LLVM_VERSION_GE(10, 0) +# if LLVM_VERSION_GE(10, 0) if (PGOOpt) { PB.addPGOInstrPassesForO0( MPM, DebugPassManager, PGOOpt->Action == PGOOptions::IRInstr, /*IsCS=*/false, PGOOpt->ProfileFile, PGOOpt->ProfileRemappingFile); } +# endif #endif } else { +#if LLVM_VERSION_GE(12, 0) for (const auto &C : PipelineStartEPCallbacks) PB.registerPipelineStartEPCallback(C); +#else + for (const auto &C : PipelineStartEPCallbacks) + PB.registerPipelineStartEPCallback([C, OptLevel](ModulePassManager &MPM) { + C(MPM, OptLevel); + }); +#endif if (OptStage != LLVMRustOptStage::PreLinkThinLTO) { for (const auto &C : OptimizerLastEPCallbacks) PB.registerOptimizerLastEPCallback(C); @@ -956,7 +1013,17 @@ LLVMRustOptimizeWithNewPassManager( MPM = PB.buildPerModuleDefaultPipeline(OptLevel, DebugPassManager); break; case LLVMRustOptStage::PreLinkThinLTO: +#if LLVM_VERSION_GE(12, 0) + MPM = PB.buildThinLTOPreLinkDefaultPipeline(OptLevel); + // The ThinLTOPreLink pipeline already includes ThinLTOBuffer passes. However, callback + // passes may still run afterwards. This means we need to run the buffer passes again. + // FIXME: In LLVM 13, the ThinLTOPreLink pipeline also runs OptimizerLastEPCallbacks + // before the RequiredLTOPreLinkPasses, in which case we can remove these hacks. + if (OptimizerLastEPCallbacks.empty()) + NeedThinLTOBufferPasses = false; +#else MPM = PB.buildThinLTOPreLinkDefaultPipeline(OptLevel, DebugPassManager); +#endif #if LLVM_VERSION_GE(11, 0) for (const auto &C : OptimizerLastEPCallbacks) C(MPM, OptLevel); @@ -970,21 +1037,34 @@ LLVMRustOptimizeWithNewPassManager( #endif break; case LLVMRustOptStage::PreLinkFatLTO: +#if LLVM_VERSION_GE(12, 0) + MPM = PB.buildLTOPreLinkDefaultPipeline(OptLevel); + NeedThinLTOBufferPasses = false; +#else MPM = PB.buildLTOPreLinkDefaultPipeline(OptLevel, DebugPassManager); +#endif break; case LLVMRustOptStage::ThinLTO: // FIXME: Does it make sense to pass the ModuleSummaryIndex? // It only seems to be needed for C++ specific optimizations. +#if LLVM_VERSION_GE(12, 0) + MPM = PB.buildThinLTODefaultPipeline(OptLevel, nullptr); +#else MPM = PB.buildThinLTODefaultPipeline(OptLevel, DebugPassManager, nullptr); +#endif break; case LLVMRustOptStage::FatLTO: +#if LLVM_VERSION_GE(12, 0) + MPM = PB.buildLTODefaultPipeline(OptLevel, nullptr); +#else MPM = PB.buildLTODefaultPipeline(OptLevel, DebugPassManager, nullptr); +#endif break; } } } - if (UseThinLTOBuffers) { + if (NeedThinLTOBufferPasses) { MPM.addPass(CanonicalizeAliasesPass()); MPM.addPass(NameAnonGlobalPass()); } diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp index 45835990cecbb..a853659540442 100644 --- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp @@ -207,6 +207,8 @@ static Attribute::AttrKind fromRust(LLVMRustAttribute Kind) { return Attribute::InaccessibleMemOnly; case SanitizeHWAddress: return Attribute::SanitizeHWAddress; + case WillReturn: + return Attribute::WillReturn; } report_fatal_error("bad AttributeKind"); } @@ -263,6 +265,17 @@ extern "C" void LLVMRustAddByValCallSiteAttr(LLVMValueRef Instr, unsigned Index, Call->addAttribute(Index, Attr); } +extern "C" void LLVMRustAddStructRetCallSiteAttr(LLVMValueRef Instr, unsigned Index, + LLVMTypeRef Ty) { + CallBase *Call = unwrap(Instr); +#if LLVM_VERSION_GE(12, 0) + Attribute Attr = Attribute::getWithStructRetType(Call->getContext(), unwrap(Ty)); +#else + Attribute Attr = Attribute::get(Call->getContext(), Attribute::StructRet); +#endif + Call->addAttribute(Index, Attr); +} + extern "C" void LLVMRustAddFunctionAttribute(LLVMValueRef Fn, unsigned Index, LLVMRustAttribute RustAttr) { Function *A = unwrap(Fn); @@ -304,6 +317,17 @@ extern "C" void LLVMRustAddByValAttr(LLVMValueRef Fn, unsigned Index, F->addAttribute(Index, Attr); } +extern "C" void LLVMRustAddStructRetAttr(LLVMValueRef Fn, unsigned Index, + LLVMTypeRef Ty) { + Function *F = unwrap(Fn); +#if LLVM_VERSION_GE(12, 0) + Attribute Attr = Attribute::getWithStructRetType(F->getContext(), unwrap(Ty)); +#else + Attribute Attr = Attribute::get(F->getContext(), Attribute::StructRet); +#endif + F->addAttribute(Index, Attr); +} + extern "C" void LLVMRustAddFunctionAttrStringValue(LLVMValueRef Fn, unsigned Index, const char *Name, @@ -1007,12 +1031,19 @@ LLVMRustDICompositeTypeReplaceArrays(LLVMRustDIBuilderRef Builder, extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateDebugLocation(unsigned Line, unsigned Column, - LLVMMetadataRef Scope, + LLVMMetadataRef ScopeRef, LLVMMetadataRef InlinedAt) { - DebugLoc debug_loc = DebugLoc::get(Line, Column, unwrapDIPtr(Scope), +#if LLVM_VERSION_GE(12, 0) + MDNode *Scope = unwrapDIPtr(ScopeRef); + DILocation *Loc = DILocation::get( + Scope->getContext(), Line, Column, Scope, + unwrapDIPtr(InlinedAt)); + return wrap(Loc); +#else + DebugLoc debug_loc = DebugLoc::get(Line, Column, unwrapDIPtr(ScopeRef), unwrapDIPtr(InlinedAt)); - return wrap(debug_loc.getAsMDNode()); +#endif } extern "C" int64_t LLVMRustDIBuilderCreateOpDeref() { @@ -1262,6 +1293,10 @@ extern "C" LLVMTypeKind LLVMRustGetTypeKind(LLVMTypeRef Ty) { return LLVMScalableVectorTypeKind; case Type::BFloatTyID: return LLVMBFloatTypeKind; +#endif +#if LLVM_VERSION_GE(12, 0) + case Type::X86_AMXTyID: + return LLVMX86_AMXTypeKind; #endif } report_fatal_error("Unhandled TypeID."); @@ -1708,11 +1743,23 @@ LLVMRustBuildVectorReduceMax(LLVMBuilderRef B, LLVMValueRef Src, bool IsSigned) } extern "C" LLVMValueRef LLVMRustBuildVectorReduceFMin(LLVMBuilderRef B, LLVMValueRef Src, bool NoNaN) { - return wrap(unwrap(B)->CreateFPMinReduce(unwrap(Src), NoNaN)); +#if LLVM_VERSION_GE(12, 0) + Instruction *I = unwrap(B)->CreateFPMinReduce(unwrap(Src)); + I->setHasNoNaNs(NoNaN); + return wrap(I); +#else + return wrap(unwrap(B)->CreateFPMinReduce(unwrap(Src), NoNaN)); +#endif } extern "C" LLVMValueRef LLVMRustBuildVectorReduceFMax(LLVMBuilderRef B, LLVMValueRef Src, bool NoNaN) { +#if LLVM_VERSION_GE(12, 0) + Instruction *I = unwrap(B)->CreateFPMaxReduce(unwrap(Src)); + I->setHasNoNaNs(NoNaN); + return wrap(I); +#else return wrap(unwrap(B)->CreateFPMaxReduce(unwrap(Src), NoNaN)); +#endif } extern "C" LLVMValueRef diff --git a/compiler/rustc_target/src/abi/call/mod.rs b/compiler/rustc_target/src/abi/call/mod.rs index 9c49922c286eb..0deb1186b0fd6 100644 --- a/compiler/rustc_target/src/abi/call/mod.rs +++ b/compiler/rustc_target/src/abi/call/mod.rs @@ -603,6 +603,13 @@ impl<'a, Ty> FnAbi<'a, Ty> { Ty: TyAndLayoutMethods<'a, C> + Copy, C: LayoutOf> + HasDataLayout + HasTargetSpec, { + if abi == spec::abi::Abi::X86Interrupt { + if let Some(arg) = self.args.first_mut() { + arg.make_indirect_byval(); + } + return Ok(()); + } + match &cx.target_spec().arch[..] { "x86" => { let flavor = if abi == spec::abi::Abi::Fastcall { diff --git a/compiler/rustc_target/src/spec/powerpc64_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/powerpc64_unknown_linux_gnu.rs index 751022c124baa..9db880b0e53ca 100644 --- a/compiler/rustc_target/src/spec/powerpc64_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/powerpc64_unknown_linux_gnu.rs @@ -14,7 +14,7 @@ pub fn target() -> Target { Target { llvm_target: "powerpc64-unknown-linux-gnu".to_string(), pointer_width: 64, - data_layout: "E-m:e-i64:64-n32:64".to_string(), + data_layout: "E-m:e-i64:64-n32:64-v256:256:256-v512:512:512".to_string(), arch: "powerpc64".to_string(), options: TargetOptions { endian: Endian::Big, mcount: "_mcount".to_string(), ..base }, } diff --git a/compiler/rustc_target/src/spec/powerpc64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/powerpc64_unknown_linux_musl.rs index 546dfbab6c701..8767f86b00bb4 100644 --- a/compiler/rustc_target/src/spec/powerpc64_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/powerpc64_unknown_linux_musl.rs @@ -10,7 +10,7 @@ pub fn target() -> Target { Target { llvm_target: "powerpc64-unknown-linux-musl".to_string(), pointer_width: 64, - data_layout: "E-m:e-i64:64-n32:64".to_string(), + data_layout: "E-m:e-i64:64-n32:64-v256:256:256-v512:512:512".to_string(), arch: "powerpc64".to_string(), options: TargetOptions { endian: Endian::Big, mcount: "_mcount".to_string(), ..base }, } diff --git a/compiler/rustc_target/src/spec/powerpc64_wrs_vxworks.rs b/compiler/rustc_target/src/spec/powerpc64_wrs_vxworks.rs index bb55872109c33..2f28a8562472d 100644 --- a/compiler/rustc_target/src/spec/powerpc64_wrs_vxworks.rs +++ b/compiler/rustc_target/src/spec/powerpc64_wrs_vxworks.rs @@ -10,7 +10,7 @@ pub fn target() -> Target { Target { llvm_target: "powerpc64-unknown-linux-gnu".to_string(), pointer_width: 64, - data_layout: "E-m:e-i64:64-n32:64".to_string(), + data_layout: "E-m:e-i64:64-n32:64-v256:256:256-v512:512:512".to_string(), arch: "powerpc64".to_string(), options: TargetOptions { endian: Endian::Big, ..base }, } diff --git a/compiler/rustc_target/src/spec/powerpc64le_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/powerpc64le_unknown_linux_gnu.rs index 07e0bf81bc72f..4cbd99765088f 100644 --- a/compiler/rustc_target/src/spec/powerpc64le_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/powerpc64le_unknown_linux_gnu.rs @@ -9,7 +9,7 @@ pub fn target() -> Target { Target { llvm_target: "powerpc64le-unknown-linux-gnu".to_string(), pointer_width: 64, - data_layout: "e-m:e-i64:64-n32:64".to_string(), + data_layout: "e-m:e-i64:64-n32:64-v256:256:256-v512:512:512".to_string(), arch: "powerpc64".to_string(), options: TargetOptions { mcount: "_mcount".to_string(), ..base }, } diff --git a/compiler/rustc_target/src/spec/powerpc64le_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/powerpc64le_unknown_linux_musl.rs index 41c78a5f27633..efdc9ad7517d1 100644 --- a/compiler/rustc_target/src/spec/powerpc64le_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/powerpc64le_unknown_linux_musl.rs @@ -9,7 +9,7 @@ pub fn target() -> Target { Target { llvm_target: "powerpc64le-unknown-linux-musl".to_string(), pointer_width: 64, - data_layout: "e-m:e-i64:64-n32:64".to_string(), + data_layout: "e-m:e-i64:64-n32:64-v256:256:256-v512:512:512".to_string(), arch: "powerpc64".to_string(), options: TargetOptions { mcount: "_mcount".to_string(), ..base }, } diff --git a/library/profiler_builtins/build.rs b/library/profiler_builtins/build.rs index 7d5c601df535b..2de6db762b2fb 100644 --- a/library/profiler_builtins/build.rs +++ b/library/profiler_builtins/build.rs @@ -26,6 +26,7 @@ fn main() { "InstrProfilingPlatformWindows.c", "InstrProfilingUtil.c", "InstrProfilingValue.c", + "InstrProfilingVersionVar.c", "InstrProfilingWriter.c", // This file was renamed in LLVM 10. "InstrProfilingRuntime.cc", diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index b5a8b694c9420..fb5127bac54df 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -383,6 +383,8 @@ fn configure_cmake( cfg.define("CMAKE_SYSTEM_NAME", "Windows"); } else if target.contains("haiku") { cfg.define("CMAKE_SYSTEM_NAME", "Haiku"); + } else if target.contains("solaris") || target.contains("illumos") { + cfg.define("CMAKE_SYSTEM_NAME", "SunOS"); } // When cross-compiling we should also set CMAKE_SYSTEM_VERSION, but in // that case like CMake we cannot easily determine system version either. diff --git a/src/ci/docker/host-x86_64/arm-android/Dockerfile b/src/ci/docker/host-x86_64/arm-android/Dockerfile index f675252fb169d..43cdbbe92e3ac 100644 --- a/src/ci/docker/host-x86_64/arm-android/Dockerfile +++ b/src/ci/docker/host-x86_64/arm-android/Dockerfile @@ -36,5 +36,8 @@ ENV SCRIPT python3 ../x.py --stage 2 test --host='' --target $TARGETS COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh +COPY scripts/cmake.sh /scripts/ +RUN /scripts/cmake.sh + COPY scripts/android-start-emulator.sh /scripts/ ENTRYPOINT ["/scripts/android-start-emulator.sh"] diff --git a/src/ci/docker/host-x86_64/dist-aarch64-linux/Dockerfile b/src/ci/docker/host-x86_64/dist-aarch64-linux/Dockerfile index 95c54ca1abc06..e6b6b6e53b99d 100644 --- a/src/ci/docker/host-x86_64/dist-aarch64-linux/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-aarch64-linux/Dockerfile @@ -24,6 +24,9 @@ USER root COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh +COPY scripts/cmake.sh /scripts/ +RUN /scripts/cmake.sh + ENV PATH=$PATH:/x-tools/aarch64-unknown-linux-gnueabi/bin ENV CC_aarch64_unknown_linux_gnu=aarch64-unknown-linux-gnueabi-gcc \ diff --git a/src/ci/docker/host-x86_64/dist-android/Dockerfile b/src/ci/docker/host-x86_64/dist-android/Dockerfile index 258dcea06e6dc..ee727359f3961 100644 --- a/src/ci/docker/host-x86_64/dist-android/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-android/Dockerfile @@ -36,3 +36,6 @@ ENV SCRIPT python3 ../x.py dist --host='' --target $TARGETS COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh + +COPY scripts/cmake.sh /scripts/ +RUN /scripts/cmake.sh diff --git a/src/ci/docker/host-x86_64/dist-arm-linux/Dockerfile b/src/ci/docker/host-x86_64/dist-arm-linux/Dockerfile index 88b13eab2d08c..1be3fecd88fff 100644 --- a/src/ci/docker/host-x86_64/dist-arm-linux/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-arm-linux/Dockerfile @@ -27,6 +27,9 @@ USER root COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh +COPY scripts/cmake.sh /scripts/ +RUN /scripts/cmake.sh + ENV PATH=$PATH:/x-tools/arm-unknown-linux-gnueabi/bin ENV CC_arm_unknown_linux_gnueabi=arm-unknown-linux-gnueabi-gcc \ diff --git a/src/ci/docker/host-x86_64/dist-armhf-linux/Dockerfile b/src/ci/docker/host-x86_64/dist-armhf-linux/Dockerfile index 977ef08c27478..66eb4137a87ca 100644 --- a/src/ci/docker/host-x86_64/dist-armhf-linux/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-armhf-linux/Dockerfile @@ -19,6 +19,9 @@ USER root COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh +COPY scripts/cmake.sh /scripts/ +RUN /scripts/cmake.sh + ENV PATH=$PATH:/x-tools/arm-unknown-linux-gnueabihf/bin ENV CC_arm_unknown_linux_gnueabihf=arm-unknown-linux-gnueabihf-gcc \ diff --git a/src/ci/docker/host-x86_64/dist-armv7-linux/Dockerfile b/src/ci/docker/host-x86_64/dist-armv7-linux/Dockerfile index 65d713359d99e..c13f63911f8fa 100644 --- a/src/ci/docker/host-x86_64/dist-armv7-linux/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-armv7-linux/Dockerfile @@ -19,6 +19,9 @@ USER root COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh +COPY scripts/cmake.sh /scripts/ +RUN /scripts/cmake.sh + ENV PATH=$PATH:/x-tools/armv7-unknown-linux-gnueabihf/bin ENV CC_armv7_unknown_linux_gnueabihf=armv7-unknown-linux-gnueabihf-gcc \ diff --git a/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/Dockerfile b/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/Dockerfile index c734202eef642..c98fc7dcfff3e 100644 --- a/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/Dockerfile @@ -30,6 +30,9 @@ RUN CC=gcc CFLAGS="-m32 -Wa,-mrelax-relocations=no" \ COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh +COPY scripts/cmake.sh /scripts/ +RUN /scripts/cmake.sh + ENV RUST_CONFIGURE_ARGS \ --musl-root-i586=/musl-i586 \ --musl-root-i686=/musl-i686 \ diff --git a/src/ci/docker/host-x86_64/dist-i686-linux/Dockerfile b/src/ci/docker/host-x86_64/dist-i686-linux/Dockerfile index 22d7cbb0d14d8..247b539652b15 100644 --- a/src/ci/docker/host-x86_64/dist-i686-linux/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-i686-linux/Dockerfile @@ -68,11 +68,13 @@ RUN ./build-binutils.sh COPY host-x86_64/dist-x86_64-linux/build-gcc.sh /tmp/ RUN ./build-gcc.sh && apt-get remove -y gcc g++ -# Debian 6 has Python 2.6 by default, but LLVM needs 2.7+ COPY host-x86_64/dist-x86_64-linux/build-python.sh /tmp/ -RUN ./build-python.sh +# Build Python 2.7 needed for Clang 10. +RUN ./build-python.sh 2.7.12 +# Build Python 3 needed for LLVM 12. +RUN ./build-python.sh 3.9.1 -# LLVM needs cmake 3.4.3 or higher, and is planning to raise to 3.13.4. +# LLVM needs cmake 3.13.4 or higher. COPY host-x86_64/dist-x86_64-linux/build-cmake.sh /tmp/ RUN ./build-cmake.sh diff --git a/src/ci/docker/host-x86_64/dist-mips-linux/Dockerfile b/src/ci/docker/host-x86_64/dist-mips-linux/Dockerfile index cb5c17c25ab9f..b0f06569a9c21 100644 --- a/src/ci/docker/host-x86_64/dist-mips-linux/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-mips-linux/Dockerfile @@ -21,6 +21,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh +COPY scripts/cmake.sh /scripts/ +RUN /scripts/cmake.sh + ENV HOSTS=mips-unknown-linux-gnu ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs diff --git a/src/ci/docker/host-x86_64/dist-mips64-linux/Dockerfile b/src/ci/docker/host-x86_64/dist-mips64-linux/Dockerfile index 31146e3ead43e..245c28e1fa341 100644 --- a/src/ci/docker/host-x86_64/dist-mips64-linux/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-mips64-linux/Dockerfile @@ -20,6 +20,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh +COPY scripts/cmake.sh /scripts/ +RUN /scripts/cmake.sh + ENV HOSTS=mips64-unknown-linux-gnuabi64 ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs diff --git a/src/ci/docker/host-x86_64/dist-mips64el-linux/Dockerfile b/src/ci/docker/host-x86_64/dist-mips64el-linux/Dockerfile index dadd50a7e66d9..03998c8880aea 100644 --- a/src/ci/docker/host-x86_64/dist-mips64el-linux/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-mips64el-linux/Dockerfile @@ -21,6 +21,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh +COPY scripts/cmake.sh /scripts/ +RUN /scripts/cmake.sh + ENV HOSTS=mips64el-unknown-linux-gnuabi64 ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs diff --git a/src/ci/docker/host-x86_64/dist-mipsel-linux/Dockerfile b/src/ci/docker/host-x86_64/dist-mipsel-linux/Dockerfile index d2d65565b10f2..5861727062101 100644 --- a/src/ci/docker/host-x86_64/dist-mipsel-linux/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-mipsel-linux/Dockerfile @@ -20,6 +20,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh +COPY scripts/cmake.sh /scripts/ +RUN /scripts/cmake.sh + ENV HOSTS=mipsel-unknown-linux-gnu ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs diff --git a/src/ci/docker/host-x86_64/dist-powerpc-linux/Dockerfile b/src/ci/docker/host-x86_64/dist-powerpc-linux/Dockerfile index 651daac86139d..ecaa495e97aee 100644 --- a/src/ci/docker/host-x86_64/dist-powerpc-linux/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-powerpc-linux/Dockerfile @@ -25,6 +25,9 @@ USER root COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh +COPY scripts/cmake.sh /scripts/ +RUN /scripts/cmake.sh + ENV PATH=$PATH:/x-tools/powerpc-unknown-linux-gnu/bin ENV \ diff --git a/src/ci/docker/host-x86_64/dist-powerpc64-linux/Dockerfile b/src/ci/docker/host-x86_64/dist-powerpc64-linux/Dockerfile index 6ff4d787212a0..a22d9a7553ecf 100644 --- a/src/ci/docker/host-x86_64/dist-powerpc64-linux/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-powerpc64-linux/Dockerfile @@ -26,6 +26,9 @@ USER root COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh +COPY scripts/cmake.sh /scripts/ +RUN /scripts/cmake.sh + ENV PATH=$PATH:/x-tools/powerpc64-unknown-linux-gnu/bin ENV \ diff --git a/src/ci/docker/host-x86_64/dist-powerpc64le-linux/Dockerfile b/src/ci/docker/host-x86_64/dist-powerpc64le-linux/Dockerfile index c1a621ff105b7..5157dd4c79b4c 100644 --- a/src/ci/docker/host-x86_64/dist-powerpc64le-linux/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-powerpc64le-linux/Dockerfile @@ -25,6 +25,9 @@ RUN ./build-powerpc64le-toolchain.sh COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh +COPY scripts/cmake.sh /scripts/ +RUN /scripts/cmake.sh + ENV \ AR_powerpc64le_unknown_linux_gnu=powerpc64le-linux-gnu-ar \ CC_powerpc64le_unknown_linux_gnu=powerpc64le-linux-gnu-gcc \ diff --git a/src/ci/docker/host-x86_64/dist-riscv64-linux/Dockerfile b/src/ci/docker/host-x86_64/dist-riscv64-linux/Dockerfile index dff7c475157a2..80b7793cb7e3c 100644 --- a/src/ci/docker/host-x86_64/dist-riscv64-linux/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-riscv64-linux/Dockerfile @@ -19,6 +19,9 @@ USER root COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh +COPY scripts/cmake.sh /scripts/ +RUN /scripts/cmake.sh + ENV PATH=$PATH:/x-tools/riscv64-unknown-linux-gnu/bin ENV CC_riscv64gc_unknown_linux_gnu=riscv64-unknown-linux-gnu-gcc \ diff --git a/src/ci/docker/host-x86_64/dist-s390x-linux/Dockerfile b/src/ci/docker/host-x86_64/dist-s390x-linux/Dockerfile index 1b261993cfc4f..5e62624395210 100644 --- a/src/ci/docker/host-x86_64/dist-s390x-linux/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-s390x-linux/Dockerfile @@ -25,6 +25,9 @@ USER root COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh +COPY scripts/cmake.sh /scripts/ +RUN /scripts/cmake.sh + ENV PATH=$PATH:/x-tools/s390x-ibm-linux-gnu/bin ENV \ diff --git a/src/ci/docker/host-x86_64/dist-x86_64-freebsd/Dockerfile b/src/ci/docker/host-x86_64/dist-x86_64-freebsd/Dockerfile index 8413d775ac4c4..121dd3f455a9e 100644 --- a/src/ci/docker/host-x86_64/dist-x86_64-freebsd/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-x86_64-freebsd/Dockerfile @@ -23,6 +23,9 @@ RUN /tmp/freebsd-toolchain.sh x86_64 COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh +COPY scripts/cmake.sh /scripts/ +RUN /scripts/cmake.sh + ENV \ AR_x86_64_unknown_freebsd=x86_64-unknown-freebsd11-ar \ CC_x86_64_unknown_freebsd=x86_64-unknown-freebsd11-clang \ diff --git a/src/ci/docker/host-x86_64/dist-x86_64-illumos/Dockerfile b/src/ci/docker/host-x86_64/dist-x86_64-illumos/Dockerfile index 2a0f6a39c5781..c2e44ead51ee4 100644 --- a/src/ci/docker/host-x86_64/dist-x86_64-illumos/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-x86_64-illumos/Dockerfile @@ -22,6 +22,9 @@ RUN bash /tmp/illumos-toolchain.sh x86_64 gcc COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh +COPY scripts/cmake.sh /scripts/ +RUN /scripts/cmake.sh + ENV \ AR_x86_64_unknown_illumos=x86_64-illumos-ar \ CC_x86_64_unknown_illumos=x86_64-illumos-gcc \ diff --git a/src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile b/src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile index d1b4bbf7fffef..4dd4378f19692 100644 --- a/src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile @@ -68,11 +68,13 @@ RUN ./build-binutils.sh COPY host-x86_64/dist-x86_64-linux/build-gcc.sh /tmp/ RUN ./build-gcc.sh && apt-get remove -y gcc g++ -# Debian 6 has Python 2.6 by default, but LLVM needs 2.7+ COPY host-x86_64/dist-x86_64-linux/build-python.sh /tmp/ -RUN ./build-python.sh +# Build Python 2.7 needed for Clang 10. +RUN ./build-python.sh 2.7.12 +# Build Python 3 needed for LLVM 12. +RUN ./build-python.sh 3.9.1 -# LLVM needs cmake 3.4.3 or higher, and is planning to raise to 3.13.4. +# LLVM needs cmake 3.13.4 or higher. COPY host-x86_64/dist-x86_64-linux/build-cmake.sh /tmp/ RUN ./build-cmake.sh diff --git a/src/ci/docker/host-x86_64/dist-x86_64-linux/build-python.sh b/src/ci/docker/host-x86_64/dist-x86_64-linux/build-python.sh index c172b9781120d..970d67b6db3dd 100755 --- a/src/ci/docker/host-x86_64/dist-x86_64-linux/build-python.sh +++ b/src/ci/docker/host-x86_64/dist-x86_64-linux/build-python.sh @@ -3,7 +3,8 @@ set -ex source shared.sh -curl https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tgz | \ +VERSION=$1 +curl https://www.python.org/ftp/python/$VERSION/Python-$VERSION.tgz | \ tar xzf - mkdir python-build @@ -12,10 +13,10 @@ cd python-build # Gotta do some hackery to tell python about our custom OpenSSL build, but other # than that fairly normal. CFLAGS='-I /rustroot/include' LDFLAGS='-L /rustroot/lib -L /rustroot/lib64' \ - hide_output ../Python-2.7.12/configure --prefix=/rustroot + hide_output ../Python-$VERSION/configure --prefix=/rustroot hide_output make -j10 hide_output make install cd .. rm -rf python-build -rm -rf Python-2.7.12 +rm -rf Python-$VERSION diff --git a/src/ci/docker/host-x86_64/dist-x86_64-musl/Dockerfile b/src/ci/docker/host-x86_64/dist-x86_64-musl/Dockerfile index 904ee64db3b7e..08f07eb828406 100644 --- a/src/ci/docker/host-x86_64/dist-x86_64-musl/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-x86_64-musl/Dockerfile @@ -20,6 +20,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ WORKDIR /build/ +# Build cmake before musl toolchain, as we replace the compiler during that step. +COPY scripts/cmake.sh /scripts/ +RUN /scripts/cmake.sh + COPY scripts/musl-toolchain.sh /build/ # We need to mitigate rust-lang/rust#34978 when compiling musl itself as well RUN CFLAGS="-Wa,-mrelax-relocations=no -Wa,--compress-debug-sections=none -Wl,--compress-debug-sections=none" \ diff --git a/src/ci/docker/host-x86_64/dist-x86_64-netbsd/Dockerfile b/src/ci/docker/host-x86_64/dist-x86_64-netbsd/Dockerfile index f3f7255f154dc..92bdc9811fd52 100644 --- a/src/ci/docker/host-x86_64/dist-x86_64-netbsd/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-x86_64-netbsd/Dockerfile @@ -9,6 +9,9 @@ RUN /tmp/build-netbsd-toolchain.sh COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh +COPY scripts/cmake.sh /scripts/ +RUN /scripts/cmake.sh + ENV PATH=$PATH:/x-tools/x86_64-unknown-netbsd/bin ENV \ diff --git a/src/ci/docker/host-x86_64/i686-gnu-nopt/Dockerfile b/src/ci/docker/host-x86_64/i686-gnu-nopt/Dockerfile index 0e28ea9668f07..0182ebb8b597e 100644 --- a/src/ci/docker/host-x86_64/i686-gnu-nopt/Dockerfile +++ b/src/ci/docker/host-x86_64/i686-gnu-nopt/Dockerfile @@ -20,6 +20,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh +COPY scripts/cmake.sh /scripts/ +RUN /scripts/cmake.sh + RUN mkdir -p /config RUN echo "[rust]" > /config/nopt-std-config.toml RUN echo "optimize = false" >> /config/nopt-std-config.toml diff --git a/src/ci/docker/host-x86_64/i686-gnu/Dockerfile b/src/ci/docker/host-x86_64/i686-gnu/Dockerfile index 195601755f303..feaab819bdda3 100644 --- a/src/ci/docker/host-x86_64/i686-gnu/Dockerfile +++ b/src/ci/docker/host-x86_64/i686-gnu/Dockerfile @@ -20,6 +20,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh +COPY scripts/cmake.sh /scripts/ +RUN /scripts/cmake.sh + ENV RUST_CONFIGURE_ARGS --build=i686-unknown-linux-gnu # Exclude some tests that are unlikely to be platform specific, to speed up # this slow job. diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-aux/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-aux/Dockerfile index a5bedadc05b61..00ad7b0a71037 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-aux/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-aux/Dockerfile @@ -42,5 +42,8 @@ RUN npm install browser-ui-test -g --unsafe-perm=true COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh +COPY scripts/cmake.sh /scripts/ +RUN /scripts/cmake.sh + ENV RUST_CONFIGURE_ARGS --build=x86_64-unknown-linux-gnu ENV RUST_CHECK_TARGET check-aux-and-gui diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-distcheck/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-distcheck/Dockerfile index 5faa0ccab568b..09d9cda02bda6 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-distcheck/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-distcheck/Dockerfile @@ -19,6 +19,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh +COPY scripts/cmake.sh /scripts/ +RUN /scripts/cmake.sh + ENV RUST_CONFIGURE_ARGS --build=x86_64-unknown-linux-gnu --set rust.ignore-git=false ENV SCRIPT python3 ../x.py --stage 2 test distcheck ENV DIST_SRC 1 diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile index 89171a6f2153b..d4838c0d6f8e5 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile @@ -18,6 +18,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh +COPY scripts/cmake.sh /scripts/ +RUN /scripts/cmake.sh + COPY host-x86_64/x86_64-gnu-tools/checktools.sh /tmp/ ENV RUST_CONFIGURE_ARGS \ diff --git a/src/ci/docker/scripts/cmake.sh b/src/ci/docker/scripts/cmake.sh new file mode 100755 index 0000000000000..70096173403d7 --- /dev/null +++ b/src/ci/docker/scripts/cmake.sh @@ -0,0 +1,34 @@ +#!/bin/bash +set -ex + +hide_output() { + set +x + on_err=" +echo ERROR: An error was encountered with the build. +cat /tmp/build.log +exit 1 +" + trap "$on_err" ERR + bash -c "while true; do sleep 30; echo \$(date) - building ...; done" & + PING_LOOP_PID=$! + "$@" &> /tmp/build.log + trap - ERR + kill $PING_LOOP_PID + rm /tmp/build.log + set -x +} + +# LLVM 12 requires CMake 3.13.4 or higher. +# This script is not necessary for images using Ubuntu 20.04 or newer. +CMAKE=3.13.4 +curl -L https://github.com/Kitware/CMake/releases/download/v$CMAKE/cmake-$CMAKE.tar.gz | tar xzf - + +mkdir cmake-build +cd cmake-build +hide_output ../cmake-$CMAKE/configure +hide_output make -j$(nproc) +hide_output make install + +cd .. +rm -rf cmake-build +rm -rf cmake-$CMAKE diff --git a/src/llvm-project b/src/llvm-project index 96ae8953e4938..40618a2340ac2 160000 --- a/src/llvm-project +++ b/src/llvm-project @@ -1 +1 @@ -Subproject commit 96ae8953e4938d39c4173dd189f268459fff8c02 +Subproject commit 40618a2340ac2939b3dc320a9fe1133fa5caa345 diff --git a/src/test/assembly/asm/riscv-types.rs b/src/test/assembly/asm/riscv-types.rs index 67dda1024fc24..47518cdcf1671 100644 --- a/src/test/assembly/asm/riscv-types.rs +++ b/src/test/assembly/asm/riscv-types.rs @@ -5,6 +5,7 @@ //[riscv32] compile-flags: --target riscv32imac-unknown-none-elf // compile-flags: -C target-feature=+d // needs-llvm-components: riscv +// min-system-llvm-version: 12.0 #![feature(no_core, lang_items, rustc_attrs)] #![crate_type = "rlib"] @@ -99,45 +100,45 @@ macro_rules! check_reg { // CHECK-LABEL: reg_i8: // CHECK: #APP -// CHECK: add {{[a-z0-9]+}}, zero, {{[a-z0-9]+}} +// CHECK: mv {{[a-z0-9]+}}, {{[a-z0-9]+}} // CHECK: #NO_APP check!(reg_i8 i8 reg "mv"); // CHECK-LABEL: reg_i16: // CHECK: #APP -// CHECK: add {{[a-z0-9]+}}, zero, {{[a-z0-9]+}} +// CHECK: mv {{[a-z0-9]+}}, {{[a-z0-9]+}} // CHECK: #NO_APP check!(reg_i16 i16 reg "mv"); // CHECK-LABEL: reg_i32: // CHECK: #APP -// CHECK: add {{[a-z0-9]+}}, zero, {{[a-z0-9]+}} +// CHECK: mv {{[a-z0-9]+}}, {{[a-z0-9]+}} // CHECK: #NO_APP check!(reg_i32 i32 reg "mv"); // CHECK-LABEL: reg_f32: // CHECK: #APP -// CHECK: add {{[a-z0-9]+}}, zero, {{[a-z0-9]+}} +// CHECK: mv {{[a-z0-9]+}}, {{[a-z0-9]+}} // CHECK: #NO_APP check!(reg_f32 f32 reg "mv"); // riscv64-LABEL: reg_i64: // riscv64: #APP -// riscv64: add {{[a-z0-9]+}}, zero, {{[a-z0-9]+}} +// riscv64: mv {{[a-z0-9]+}}, {{[a-z0-9]+}} // riscv64: #NO_APP #[cfg(riscv64)] check!(reg_i64 i64 reg "mv"); // riscv64-LABEL: reg_f64: // riscv64: #APP -// riscv64: add {{[a-z0-9]+}}, zero, {{[a-z0-9]+}} +// riscv64: mv {{[a-z0-9]+}}, {{[a-z0-9]+}} // riscv64: #NO_APP #[cfg(riscv64)] check!(reg_f64 f64 reg "mv"); // CHECK-LABEL: reg_ptr: // CHECK: #APP -// CHECK: add {{[a-z0-9]+}}, zero, {{[a-z0-9]+}} +// CHECK: mv {{[a-z0-9]+}}, {{[a-z0-9]+}} // CHECK: #NO_APP check!(reg_ptr ptr reg "mv"); @@ -155,45 +156,45 @@ check!(freg_f64 f64 freg "fmv.d"); // CHECK-LABEL: a0_i8: // CHECK: #APP -// CHECK: add a0, zero, a0 +// CHECK: mv a0, a0 // CHECK: #NO_APP check_reg!(a0_i8 i8 "a0" "mv"); // CHECK-LABEL: a0_i16: // CHECK: #APP -// CHECK: add a0, zero, a0 +// CHECK: mv a0, a0 // CHECK: #NO_APP check_reg!(a0_i16 i16 "a0" "mv"); // CHECK-LABEL: a0_i32: // CHECK: #APP -// CHECK: add a0, zero, a0 +// CHECK: mv a0, a0 // CHECK: #NO_APP check_reg!(a0_i32 i32 "a0" "mv"); // CHECK-LABEL: a0_f32: // CHECK: #APP -// CHECK: add a0, zero, a0 +// CHECK: mv a0, a0 // CHECK: #NO_APP check_reg!(a0_f32 f32 "a0" "mv"); // riscv64-LABEL: a0_i64: // riscv64: #APP -// riscv64: add a0, zero, a0 +// riscv64: mv a0, a0 // riscv64: #NO_APP #[cfg(riscv64)] check_reg!(a0_i64 i64 "a0" "mv"); // riscv64-LABEL: a0_f64: // riscv64: #APP -// riscv64: add a0, zero, a0 +// riscv64: mv a0, a0 // riscv64: #NO_APP #[cfg(riscv64)] check_reg!(a0_f64 f64 "a0" "mv"); // CHECK-LABEL: a0_ptr: // CHECK: #APP -// CHECK: add a0, zero, a0 +// CHECK: mv a0, a0 // CHECK: #NO_APP check_reg!(a0_ptr ptr "a0" "mv"); diff --git a/src/test/codegen/function-arguments.rs b/src/test/codegen/function-arguments.rs index 3511c7c5185ee..a1da4faf5d85a 100644 --- a/src/test/codegen/function-arguments.rs +++ b/src/test/codegen/function-arguments.rs @@ -1,5 +1,6 @@ // compile-flags: -C no-prepopulate-passes // ignore-tidy-linelength +// min-system-llvm-version: 12.0 #![crate_type = "lib"] #![feature(rustc_attrs)] @@ -73,7 +74,7 @@ pub fn _box(x: Box) -> Box { x } -// CHECK: @struct_return(%S* noalias nocapture sret dereferenceable(32){{( %0)?}}) +// CHECK: @struct_return(%S* noalias nocapture sret(%S) dereferenceable(32){{( %0)?}}) #[no_mangle] pub fn struct_return() -> S { S { diff --git a/src/test/codegen/packed.rs b/src/test/codegen/packed.rs index f3f5202206ced..c31e8457dcded 100644 --- a/src/test/codegen/packed.rs +++ b/src/test/codegen/packed.rs @@ -52,7 +52,7 @@ pub struct BigPacked2 { #[no_mangle] pub fn call_pkd1(f: fn() -> Array) -> BigPacked1 { // CHECK: [[ALLOCA:%[_a-z0-9]+]] = alloca %Array -// CHECK: call void %{{.*}}(%Array* noalias nocapture sret dereferenceable(32) [[ALLOCA]]) +// CHECK: call void %{{.*}}(%Array* noalias nocapture sret{{.*}} dereferenceable(32) [[ALLOCA]]) // CHECK: call void @llvm.memcpy.{{.*}}(i8* align 1 %{{.*}}, i8* align 4 %{{.*}}, i{{[0-9]+}} 32, i1 false) // check that calls whose destination is a field of a packed struct // go through an alloca rather than calling the function with an @@ -64,7 +64,7 @@ pub fn call_pkd1(f: fn() -> Array) -> BigPacked1 { #[no_mangle] pub fn call_pkd2(f: fn() -> Array) -> BigPacked2 { // CHECK: [[ALLOCA:%[_a-z0-9]+]] = alloca %Array -// CHECK: call void %{{.*}}(%Array* noalias nocapture sret dereferenceable(32) [[ALLOCA]]) +// CHECK: call void %{{.*}}(%Array* noalias nocapture sret{{.*}} dereferenceable(32) [[ALLOCA]]) // CHECK: call void @llvm.memcpy.{{.*}}(i8* align 2 %{{.*}}, i8* align 4 %{{.*}}, i{{[0-9]+}} 32, i1 false) // check that calls whose destination is a field of a packed struct // go through an alloca rather than calling the function with an diff --git a/src/test/codegen/repr-transparent-aggregates-1.rs b/src/test/codegen/repr-transparent-aggregates-1.rs index 2b8d3c8bc1d22..847b94fac78ce 100644 --- a/src/test/codegen/repr-transparent-aggregates-1.rs +++ b/src/test/codegen/repr-transparent-aggregates-1.rs @@ -1,7 +1,7 @@ // compile-flags: -C no-prepopulate-passes // ignore-tidy-linelength -// min-system-llvm-version: 9.0 +// min-system-llvm-version: 12.0 // ignore-arm // ignore-aarch64 // ignore-mips @@ -34,19 +34,19 @@ pub enum TeBigS { Variant(BigS), } -// CHECK: define void @test_BigS(%BigS* [[BIGS_RET_ATTRS:.*]], %BigS* [[BIGS_ARG_ATTRS1:.*]] byval(%BigS) [[BIGS_ARG_ATTRS2:.*]]) +// CHECK: define void @test_BigS(%BigS* [[BIGS_RET_ATTRS1:.*]] sret(%BigS) [[BIGS_RET_ATTRS2:.*]], %BigS* [[BIGS_ARG_ATTRS1:.*]] byval(%BigS) [[BIGS_ARG_ATTRS2:.*]]) #[no_mangle] pub extern "C" fn test_BigS(_: BigS) -> BigS { loop {} } -// CHECK: define void @test_TsBigS(%TsBigS* [[BIGS_RET_ATTRS]], %TsBigS* [[BIGS_ARG_ATTRS1]] byval(%TsBigS) [[BIGS_ARG_ATTRS2:.*]]) +// CHECK: define void @test_TsBigS(%TsBigS* [[BIGS_RET_ATTRS1]] sret(%TsBigS) [[BIGS_RET_ATTRS2]], %TsBigS* [[BIGS_ARG_ATTRS1]] byval(%TsBigS) [[BIGS_ARG_ATTRS2:.*]]) #[no_mangle] pub extern "C" fn test_TsBigS(_: TsBigS) -> TsBigS { loop {} } -// CHECK: define void @test_TuBigS(%TuBigS* [[BIGS_RET_ATTRS]], %TuBigS* [[BIGS_ARG_ATTRS1]] byval(%TuBigS) [[BIGS_ARG_ATTRS2:.*]]) +// CHECK: define void @test_TuBigS(%TuBigS* [[BIGS_RET_ATTRS1]] sret(%TuBigS) [[BIGS_RET_ATTRS2]], %TuBigS* [[BIGS_ARG_ATTRS1]] byval(%TuBigS) [[BIGS_ARG_ATTRS2:.*]]) #[no_mangle] pub extern "C" fn test_TuBigS(_: TuBigS) -> TuBigS { loop {} } -// CHECK: define void @test_TeBigS(%"TeBigS::Variant"* [[BIGS_RET_ATTRS]], %"TeBigS::Variant"* [[BIGS_ARG_ATTRS1]] byval(%"TeBigS::Variant") [[BIGS_ARG_ATTRS2]]) +// CHECK: define void @test_TeBigS(%"TeBigS::Variant"* [[BIGS_RET_ATTRS1]] sret(%"TeBigS::Variant") [[BIGS_RET_ATTRS2]], %"TeBigS::Variant"* [[BIGS_ARG_ATTRS1]] byval(%"TeBigS::Variant") [[BIGS_ARG_ATTRS2]]) #[no_mangle] pub extern "C" fn test_TeBigS(_: TeBigS) -> TeBigS { loop {} } @@ -70,18 +70,18 @@ pub enum TeBigU { Variant(BigU), } -// CHECK: define void @test_BigU(%BigU* [[BIGU_RET_ATTRS:.*]], %BigU* [[BIGU_ARG_ATTRS1:.*]] byval(%BigU) [[BIGU_ARG_ATTRS2:.*]]) +// CHECK: define void @test_BigU(%BigU* [[BIGU_RET_ATTRS1:.*]] sret(%BigU) [[BIGU_RET_ATTRS2:.*]], %BigU* [[BIGU_ARG_ATTRS1:.*]] byval(%BigU) [[BIGU_ARG_ATTRS2:.*]]) #[no_mangle] pub extern "C" fn test_BigU(_: BigU) -> BigU { loop {} } -// CHECK: define void @test_TsBigU(%TsBigU* [[BIGU_RET_ATTRS:.*]], %TsBigU* [[BIGU_ARG_ATTRS1]] byval(%TsBigU) [[BIGU_ARG_ATTRS2]]) +// CHECK: define void @test_TsBigU(%TsBigU* [[BIGU_RET_ATTRS1:.*]] sret(%TsBigU) [[BIGU_RET_ATTRS2:.*]], %TsBigU* [[BIGU_ARG_ATTRS1]] byval(%TsBigU) [[BIGU_ARG_ATTRS2]]) #[no_mangle] pub extern "C" fn test_TsBigU(_: TsBigU) -> TsBigU { loop {} } -// CHECK: define void @test_TuBigU(%TuBigU* [[BIGU_RET_ATTRS]], %TuBigU* [[BIGU_ARG_ATTRS1]] byval(%TuBigU) [[BIGU_ARG_ATTRS2]]) +// CHECK: define void @test_TuBigU(%TuBigU* [[BIGU_RET_ATTRS1]] sret(%TuBigU) [[BIGU_RET_ATTRS2:.*]], %TuBigU* [[BIGU_ARG_ATTRS1]] byval(%TuBigU) [[BIGU_ARG_ATTRS2]]) #[no_mangle] pub extern "C" fn test_TuBigU(_: TuBigU) -> TuBigU { loop {} } -// CHECK: define void @test_TeBigU(%"TeBigU::Variant"* [[BIGU_RET_ATTRS]], %"TeBigU::Variant"* [[BIGU_ARG_ATTRS1]] byval(%"TeBigU::Variant") [[BIGU_ARG_ATTRS2]]) +// CHECK: define void @test_TeBigU(%"TeBigU::Variant"* [[BIGU_RET_ATTRS1]] sret(%"TeBigU::Variant") [[BIGU_RET_ATTRS2:.*]], %"TeBigU::Variant"* [[BIGU_ARG_ATTRS1]] byval(%"TeBigU::Variant") [[BIGU_ARG_ATTRS2]]) #[no_mangle] pub extern "C" fn test_TeBigU(_: TeBigU) -> TeBigU { loop {} } diff --git a/src/test/codegen/repr-transparent-aggregates-2.rs b/src/test/codegen/repr-transparent-aggregates-2.rs index 07e5af11f3577..1fb12d92bd135 100644 --- a/src/test/codegen/repr-transparent-aggregates-2.rs +++ b/src/test/codegen/repr-transparent-aggregates-2.rs @@ -1,5 +1,7 @@ // compile-flags: -C no-prepopulate-passes +// ignore-tidy-linelength +// min-system-llvm-version: 12.0 // ignore-aarch64 // ignore-emscripten // ignore-mips64 @@ -36,19 +38,19 @@ pub enum TeBigS { Variant(BigS), } -// CHECK: define void @test_BigS(%BigS* [[BIGS_RET_ATTRS:.*]], [16 x i32] +// CHECK: define void @test_BigS(%BigS* [[BIGS_RET_ATTRS1:.*]] sret(%BigS) [[BIGS_RET_ATTRS2:.*]], [16 x i32] #[no_mangle] pub extern fn test_BigS(_: BigS) -> BigS { loop {} } -// CHECK: define void @test_TsBigS(%TsBigS* [[BIGS_RET_ATTRS]], [16 x i32] +// CHECK: define void @test_TsBigS(%TsBigS* [[BIGS_RET_ATTRS1]] sret(%TsBigS) [[BIGS_RET_ATTRS2]], [16 x i32] #[no_mangle] pub extern fn test_TsBigS(_: TsBigS) -> TsBigS { loop {} } -// CHECK: define void @test_TuBigS(%TuBigS* [[BIGS_RET_ATTRS]], [16 x i32] +// CHECK: define void @test_TuBigS(%TuBigS* [[BIGS_RET_ATTRS1]] sret(%TuBigS) [[BIGS_RET_ATTRS2]], [16 x i32] #[no_mangle] pub extern fn test_TuBigS(_: TuBigS) -> TuBigS { loop {} } -// CHECK: define void @test_TeBigS(%"TeBigS::Variant"* [[BIGS_RET_ATTRS]], [16 x i32] +// CHECK: define void @test_TeBigS(%"TeBigS::Variant"* [[BIGS_RET_ATTRS1]] sret(%"TeBigS::Variant") [[BIGS_RET_ATTRS2]], [16 x i32] #[no_mangle] pub extern fn test_TeBigS(_: TeBigS) -> TeBigS { loop {} } @@ -72,18 +74,18 @@ pub enum TeBigU { Variant(BigU), } -// CHECK: define void @test_BigU(%BigU* [[BIGU_RET_ATTRS:.*]], [16 x i32] +// CHECK: define void @test_BigU(%BigU* [[BIGU_RET_ATTRS1:.*]] sret(%BigU) [[BIGU_RET_ATTRS2:.*]], [16 x i32] #[no_mangle] pub extern fn test_BigU(_: BigU) -> BigU { loop {} } -// CHECK: define void @test_TsBigU(%TsBigU* [[BIGU_RET_ATTRS:.*]], [16 x i32] +// CHECK: define void @test_TsBigU(%TsBigU* [[BIGU_RET_ATTRS1]] sret(%TsBigU) [[BIGU_RET_ATTRS2]], [16 x i32] #[no_mangle] pub extern fn test_TsBigU(_: TsBigU) -> TsBigU { loop {} } -// CHECK: define void @test_TuBigU(%TuBigU* [[BIGU_RET_ATTRS]], [16 x i32] +// CHECK: define void @test_TuBigU(%TuBigU* [[BIGU_RET_ATTRS1]] sret(%TuBigU) [[BIGU_RET_ATTRS2]], [16 x i32] #[no_mangle] pub extern fn test_TuBigU(_: TuBigU) -> TuBigU { loop {} } -// CHECK: define void @test_TeBigU(%"TeBigU::Variant"* [[BIGU_RET_ATTRS]], [16 x i32] +// CHECK: define void @test_TeBigU(%"TeBigU::Variant"* [[BIGU_RET_ATTRS1]] sret(%"TeBigU::Variant") [[BIGU_RET_ATTRS2]], [16 x i32] #[no_mangle] pub extern fn test_TeBigU(_: TeBigU) -> TeBigU { loop {} } diff --git a/src/test/codegen/repr-transparent-aggregates-3.rs b/src/test/codegen/repr-transparent-aggregates-3.rs index e538be687801e..3381764bfc818 100644 --- a/src/test/codegen/repr-transparent-aggregates-3.rs +++ b/src/test/codegen/repr-transparent-aggregates-3.rs @@ -1,5 +1,7 @@ // compile-flags: -C no-prepopulate-passes +// ignore-tidy-linelength +// min-system-llvm-version: 12.0 // only-mips64 // See repr-transparent.rs @@ -25,19 +27,19 @@ pub enum TeBigS { Variant(BigS), } -// CHECK: define void @test_BigS(%BigS* [[BIGS_RET_ATTRS:.*]], [8 x i64] +// CHECK: define void @test_BigS(%BigS* [[BIGS_RET_ATTRS1:.*]] sret(%BigS) [[BIGS_RET_ATTRS2:.*]], [8 x i64] #[no_mangle] pub extern fn test_BigS(_: BigS) -> BigS { loop {} } -// CHECK: define void @test_TsBigS(%TsBigS* [[BIGS_RET_ATTRS]], [8 x i64] +// CHECK: define void @test_TsBigS(%TsBigS* [[BIGS_RET_ATTRS1]] sret(%TsBigS) [[BIGS_RET_ATTRS2]], [8 x i64] #[no_mangle] pub extern fn test_TsBigS(_: TsBigS) -> TsBigS { loop {} } -// CHECK: define void @test_TuBigS(%TuBigS* [[BIGS_RET_ATTRS]], [8 x i64] +// CHECK: define void @test_TuBigS(%TuBigS* [[BIGS_RET_ATTRS1]] sret(%TuBigS) [[BIGS_RET_ATTRS2]], [8 x i64] #[no_mangle] pub extern fn test_TuBigS(_: TuBigS) -> TuBigS { loop {} } -// CHECK: define void @test_TeBigS(%"TeBigS::Variant"* [[BIGS_RET_ATTRS]], [8 x i64] +// CHECK: define void @test_TeBigS(%"TeBigS::Variant"* [[BIGS_RET_ATTRS1]] sret(%"TeBigS::Variant") [[BIGS_RET_ATTRS2]], [8 x i64] #[no_mangle] pub extern fn test_TeBigS(_: TeBigS) -> TeBigS { loop {} } @@ -61,18 +63,18 @@ pub enum TeBigU { Variant(BigU), } -// CHECK: define void @test_BigU(%BigU* [[BIGU_RET_ATTRS:.*]], [8 x i64] +// CHECK: define void @test_BigU(%BigU* [[BIGU_RET_ATTRS1:.*]] sret(%BigU) [[BIGU_RET_ATTRS2:.*]], [8 x i64] #[no_mangle] pub extern fn test_BigU(_: BigU) -> BigU { loop {} } -// CHECK: define void @test_TsBigU(%TsBigU* [[BIGU_RET_ATTRS:.*]], [8 x i64] +// CHECK: define void @test_TsBigU(%TsBigU* [[BIGU_RET_ATTRS1]] sret(%TsBigU) [[BIGU_RET_ATTRS2]], [8 x i64] #[no_mangle] pub extern fn test_TsBigU(_: TsBigU) -> TsBigU { loop {} } -// CHECK: define void @test_TuBigU(%TuBigU* [[BIGU_RET_ATTRS]], [8 x i64] +// CHECK: define void @test_TuBigU(%TuBigU* [[BIGU_RET_ATTRS1]] sret(%TuBigU) [[BIGU_RET_ATTRS2]], [8 x i64] #[no_mangle] pub extern fn test_TuBigU(_: TuBigU) -> TuBigU { loop {} } -// CHECK: define void @test_TeBigU(%"TeBigU::Variant"* [[BIGU_RET_ATTRS]], [8 x i64] +// CHECK: define void @test_TeBigU(%"TeBigU::Variant"* [[BIGU_RET_ATTRS1]] sret(%"TeBigU::Variant") [[BIGU_RET_ATTRS2]], [8 x i64] #[no_mangle] pub extern fn test_TeBigU(_: TeBigU) -> TeBigU { loop {} } diff --git a/src/test/run-make-fulldeps/pgo-use/Makefile b/src/test/run-make-fulldeps/pgo-use/Makefile index cb5e9e9a45580..01bc211df1616 100644 --- a/src/test/run-make-fulldeps/pgo-use/Makefile +++ b/src/test/run-make-fulldeps/pgo-use/Makefile @@ -12,12 +12,11 @@ # `else` branch. Accordingly, we expect the function that is never called to # be marked as cold. # -# The program is compiled with `-Copt-level=s` because this setting disables -# LLVM's pre-inlining pass (i.e. a pass that does some inlining before it adds -# the profiling instrumentation). Disabling this pass leads to rather -# predictable IR which we need for this test to be stable. +# Disable the pre-inlining pass (i.e. a pass that does some inlining before +# it adds the profiling instrumentation). Disabling this pass leads to +# rather predictable IR which we need for this test to be stable. -COMMON_FLAGS=-Copt-level=s -Ccodegen-units=1 +COMMON_FLAGS=-Copt-level=2 -Ccodegen-units=1 -Cllvm-args=-disable-preinline # LLVM doesn't support instrumenting binaries that use SEH: # https://github.com/rust-lang/rust/issues/61002 diff --git a/src/test/run-make-fulldeps/split-dwarf/Makefile b/src/test/run-make-fulldeps/split-dwarf/Makefile index e89cc1b2ede9b..f56b4168b2d66 100644 --- a/src/test/run-make-fulldeps/split-dwarf/Makefile +++ b/src/test/run-make-fulldeps/split-dwarf/Makefile @@ -4,6 +4,6 @@ # min-llvm-version: 11.0 all: - $(RUSTC) -Z unstable-options -C split-debuginfo=packed foo.rs -g + $(RUSTC) -Z unstable-options -C split-debuginfo=packed -C debuginfo=2 foo.rs -g rm $(TMPDIR)/foo.dwp rm $(TMPDIR)/$(call BIN,foo)