From 4ff90c7e0aa60cfab0d4fd5e52fcc63a7afd81c3 Mon Sep 17 00:00:00 2001 From: gnzlbg Date: Fri, 29 Jun 2018 10:28:51 +0200 Subject: [PATCH] bump minimum LLVM version to 5.0 --- .travis.yml | 2 +- src/bootstrap/native.rs | 6 +- .../Dockerfile | 4 +- src/librustc_codegen_llvm/abi.rs | 6 +- src/librustc_codegen_llvm/mir/mod.rs | 22 +- src/rustllvm/RustWrapper.cpp | 201 +----------------- src/test/codegen/call-metadata.rs | 2 - src/test/codegen/issue-37945.rs | 1 - src/test/codegen/issue-45466.rs | 1 - src/test/codegen/mainsubprogram.rs | 1 - src/test/codegen/mainsubprogramstart.rs | 4 - src/test/codegen/noreturnflag.rs | 1 - src/test/codegen/stack-probes.rs | 1 - src/test/codegen/vtabletype.rs | 2 +- .../simd-intrinsic-generic-reduction.rs | 1 - src/test/mir-opt/lower_128bit_test.rs | 3 - .../run-make-fulldeps/cross-lang-lto/Makefile | 2 - .../llvm-pass/llvm-function-pass.so.cc | 7 +- .../llvm-pass/llvm-module-pass.so.cc | 7 +- src/test/run-pass/issue-40883.rs | 1 - .../simd-intrinsic-generic-reduction.rs | 1 - src/test/run-pass/stack-probes-lto.rs | 1 - src/test/run-pass/stack-probes.rs | 1 - .../run-pass/thin-lto-global-allocator.rs | 1 - src/test/run-pass/thinlto/all-crates.rs | 1 - src/test/run-pass/thinlto/dylib-works.rs | 1 - src/test/run-pass/thinlto/msvc-imp-present.rs | 1 - src/test/run-pass/thinlto/thin-lto-inlines.rs | 1 - .../run-pass/thinlto/thin-lto-inlines2.rs | 1 - src/test/run-pass/thinlto/weak-works.rs | 1 - 30 files changed, 17 insertions(+), 268 deletions(-) rename src/ci/docker/{x86_64-gnu-llvm-3.9 => x86_64-gnu-llvm-5.0}/Dockerfile (89%) diff --git a/.travis.yml b/.travis.yml index ba8a39f355c..2cf10d76098 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ matrix: fast_finish: true include: # Images used in testing PR and try-build should be run first. - - env: IMAGE=x86_64-gnu-llvm-3.9 RUST_BACKTRACE=1 + - env: IMAGE=x86_64-gnu-llvm-5.0 RUST_BACKTRACE=1 if: type = pull_request OR branch = auto - env: IMAGE=dist-x86_64-linux DEPLOY=1 diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index 93b8880a900..264acfacee6 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -256,12 +256,12 @@ fn check_llvm_version(builder: &Builder, llvm_config: &Path) { let version = output(cmd.arg("--version")); let mut parts = version.split('.').take(2) .filter_map(|s| s.parse::().ok()); - if let (Some(major), Some(minor)) = (parts.next(), parts.next()) { - if major > 3 || (major == 3 && minor >= 9) { + if let (Some(major), Some(_minor)) = (parts.next(), parts.next()) { + if major >= 5 { return } } - panic!("\n\nbad LLVM version: {}, need >=3.9\n\n", version) + panic!("\n\nbad LLVM version: {}, need >=5.0\n\n", version) } fn configure_cmake(builder: &Builder, diff --git a/src/ci/docker/x86_64-gnu-llvm-3.9/Dockerfile b/src/ci/docker/x86_64-gnu-llvm-5.0/Dockerfile similarity index 89% rename from src/ci/docker/x86_64-gnu-llvm-3.9/Dockerfile rename to src/ci/docker/x86_64-gnu-llvm-5.0/Dockerfile index 6b818604898..4f90c509726 100644 --- a/src/ci/docker/x86_64-gnu-llvm-3.9/Dockerfile +++ b/src/ci/docker/x86_64-gnu-llvm-5.0/Dockerfile @@ -11,7 +11,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ cmake \ sudo \ gdb \ - llvm-3.9-tools \ + llvm-5.0-tools \ libedit-dev \ zlib1g-dev \ xz-utils @@ -22,6 +22,6 @@ RUN sh /scripts/sccache.sh # using llvm-link-shared due to libffi issues -- see #34486 ENV RUST_CONFIGURE_ARGS \ --build=x86_64-unknown-linux-gnu \ - --llvm-root=/usr/lib/llvm-3.9 \ + --llvm-root=/usr/lib/llvm-5.0 \ --enable-llvm-link-shared ENV RUST_CHECK_TARGET check diff --git a/src/librustc_codegen_llvm/abi.rs b/src/librustc_codegen_llvm/abi.rs index 6b5baa402b4..47c13919e6e 100644 --- a/src/librustc_codegen_llvm/abi.rs +++ b/src/librustc_codegen_llvm/abi.rs @@ -666,11 +666,7 @@ impl<'a, 'tcx> FnTypeExt<'a, 'tcx> for FnType<'tcx, Ty<'tcx>> { layout::Int(..) if !scalar.is_bool() => { let range = scalar.valid_range_exclusive(bx.cx); if range.start != range.end { - // FIXME(nox): This causes very weird type errors about - // SHL operators in constants in stage 2 with LLVM 3.9. - if unsafe { llvm::LLVMRustVersionMajor() >= 4 } { - bx.range_metadata(callsite, range); - } + bx.range_metadata(callsite, range); } } _ => {} diff --git a/src/librustc_codegen_llvm/mir/mod.rs b/src/librustc_codegen_llvm/mir/mod.rs index f9be91b4f3f..608539dd3fa 100644 --- a/src/librustc_codegen_llvm/mir/mod.rs +++ b/src/librustc_codegen_llvm/mir/mod.rs @@ -22,7 +22,7 @@ use builder::Builder; use common::{CodegenCx, Funclet}; use debuginfo::{self, declare_local, VariableAccess, VariableKind, FunctionDebugContext}; use monomorphize::Instance; -use abi::{ArgAttribute, ArgTypeExt, FnType, FnTypeExt, PassMode}; +use abi::{ArgTypeExt, FnType, FnTypeExt, PassMode}; use type_::Type; use syntax_pos::{DUMMY_SP, NO_EXPANSION, BytePos, Span}; @@ -430,10 +430,6 @@ fn arg_local_refs<'a, 'tcx>(bx: &Builder<'a, 'tcx>, None }; - let deref_op = unsafe { - [llvm::LLVMRustDIBuilderCreateOpDeref()] - }; - mir.args_iter().enumerate().map(|(arg_index, local)| { let arg_decl = &mir.local_decls[local]; @@ -543,21 +539,11 @@ fn arg_local_refs<'a, 'tcx>(bx: &Builder<'a, 'tcx>, if arg_index > 0 || mir.upvar_decls.is_empty() { // The Rust ABI passes indirect variables using a pointer and a manual copy, so we // need to insert a deref here, but the C ABI uses a pointer and a copy using the - // byval attribute, for which LLVM does the deref itself, so we must not add it. - // Starting with D31439 in LLVM 5, it *always* does the deref itself. - let mut variable_access = VariableAccess::DirectVariable { + // byval attribute, for which LLVM always does the deref itself, + // so we must not add it. + let variable_access = VariableAccess::DirectVariable { alloca: place.llval }; - if unsafe { llvm::LLVMRustVersionMajor() < 5 } { - if let PassMode::Indirect(ref attrs) = arg.mode { - if !attrs.contains(ArgAttribute::ByVal) { - variable_access = VariableAccess::IndirectVariable { - alloca: place.llval, - address_operations: &deref_op, - }; - } - } - } declare_local( bx, diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp index df8602d0803..2ac7a6a46ba 100644 --- a/src/rustllvm/RustWrapper.cpp +++ b/src/rustllvm/RustWrapper.cpp @@ -16,14 +16,8 @@ #include "llvm/Object/Archive.h" #include "llvm/Object/ObjectFile.h" #include "llvm/Bitcode/BitcodeWriterPass.h" - #include "llvm/IR/CallSite.h" - -#if LLVM_VERSION_GE(5, 0) #include "llvm/ADT/Optional.h" -#else -#include -#endif //===----------------------------------------------------------------------=== // @@ -176,14 +170,7 @@ extern "C" void LLVMRustAddCallSiteAttribute(LLVMValueRef Instr, unsigned Index, LLVMRustAttribute RustAttr) { CallSite Call = CallSite(unwrap(Instr)); Attribute Attr = Attribute::get(Call->getContext(), fromRust(RustAttr)); -#if LLVM_VERSION_GE(5, 0) Call.addAttribute(Index, Attr); -#else - AttrBuilder B(Attr); - Call.setAttributes(Call.getAttributes().addAttributes( - Call->getContext(), Index, - AttributeSet::get(Call->getContext(), Index, B))); -#endif } extern "C" void LLVMRustAddAlignmentCallSiteAttr(LLVMValueRef Instr, @@ -192,14 +179,8 @@ extern "C" void LLVMRustAddAlignmentCallSiteAttr(LLVMValueRef Instr, CallSite Call = CallSite(unwrap(Instr)); AttrBuilder B; B.addAlignmentAttr(Bytes); -#if LLVM_VERSION_GE(5, 0) Call.setAttributes(Call.getAttributes().addAttributes( Call->getContext(), Index, B)); -#else - Call.setAttributes(Call.getAttributes().addAttributes( - Call->getContext(), Index, - AttributeSet::get(Call->getContext(), Index, B))); -#endif } extern "C" void LLVMRustAddDereferenceableCallSiteAttr(LLVMValueRef Instr, @@ -208,14 +189,8 @@ extern "C" void LLVMRustAddDereferenceableCallSiteAttr(LLVMValueRef Instr, CallSite Call = CallSite(unwrap(Instr)); AttrBuilder B; B.addDereferenceableAttr(Bytes); -#if LLVM_VERSION_GE(5, 0) Call.setAttributes(Call.getAttributes().addAttributes( Call->getContext(), Index, B)); -#else - Call.setAttributes(Call.getAttributes().addAttributes( - Call->getContext(), Index, - AttributeSet::get(Call->getContext(), Index, B))); -#endif } extern "C" void LLVMRustAddDereferenceableOrNullCallSiteAttr(LLVMValueRef Instr, @@ -224,14 +199,8 @@ extern "C" void LLVMRustAddDereferenceableOrNullCallSiteAttr(LLVMValueRef Instr, CallSite Call = CallSite(unwrap(Instr)); AttrBuilder B; B.addDereferenceableOrNullAttr(Bytes); -#if LLVM_VERSION_GE(5, 0) Call.setAttributes(Call.getAttributes().addAttributes( Call->getContext(), Index, B)); -#else - Call.setAttributes(Call.getAttributes().addAttributes( - Call->getContext(), Index, - AttributeSet::get(Call->getContext(), Index, B))); -#endif } extern "C" void LLVMRustAddFunctionAttribute(LLVMValueRef Fn, unsigned Index, @@ -239,11 +208,7 @@ extern "C" void LLVMRustAddFunctionAttribute(LLVMValueRef Fn, unsigned Index, Function *A = unwrap(Fn); Attribute Attr = Attribute::get(A->getContext(), fromRust(RustAttr)); AttrBuilder B(Attr); -#if LLVM_VERSION_GE(5, 0) A->addAttributes(Index, B); -#else - A->addAttributes(Index, AttributeSet::get(A->getContext(), Index, B)); -#endif } extern "C" void LLVMRustAddAlignmentAttr(LLVMValueRef Fn, @@ -252,11 +217,7 @@ extern "C" void LLVMRustAddAlignmentAttr(LLVMValueRef Fn, Function *A = unwrap(Fn); AttrBuilder B; B.addAlignmentAttr(Bytes); -#if LLVM_VERSION_GE(5, 0) A->addAttributes(Index, B); -#else - A->addAttributes(Index, AttributeSet::get(A->getContext(), Index, B)); -#endif } extern "C" void LLVMRustAddDereferenceableAttr(LLVMValueRef Fn, unsigned Index, @@ -264,11 +225,7 @@ extern "C" void LLVMRustAddDereferenceableAttr(LLVMValueRef Fn, unsigned Index, Function *A = unwrap(Fn); AttrBuilder B; B.addDereferenceableAttr(Bytes); -#if LLVM_VERSION_GE(5, 0) A->addAttributes(Index, B); -#else - A->addAttributes(Index, AttributeSet::get(A->getContext(), Index, B)); -#endif } extern "C" void LLVMRustAddDereferenceableOrNullAttr(LLVMValueRef Fn, @@ -277,11 +234,7 @@ extern "C" void LLVMRustAddDereferenceableOrNullAttr(LLVMValueRef Fn, Function *A = unwrap(Fn); AttrBuilder B; B.addDereferenceableOrNullAttr(Bytes); -#if LLVM_VERSION_GE(5, 0) A->addAttributes(Index, B); -#else - A->addAttributes(Index, AttributeSet::get(A->getContext(), Index, B)); -#endif } extern "C" void LLVMRustAddFunctionAttrStringValue(LLVMValueRef Fn, @@ -291,11 +244,7 @@ extern "C" void LLVMRustAddFunctionAttrStringValue(LLVMValueRef Fn, Function *F = unwrap(Fn); AttrBuilder B; B.addAttribute(Name, Value); -#if LLVM_VERSION_GE(5, 0) F->addAttributes(Index, B); -#else - F->addAttributes(Index, AttributeSet::get(F->getContext(), Index, B)); -#endif } extern "C" void LLVMRustRemoveFunctionAttributes(LLVMValueRef Fn, @@ -305,12 +254,7 @@ extern "C" void LLVMRustRemoveFunctionAttributes(LLVMValueRef Fn, Attribute Attr = Attribute::get(F->getContext(), fromRust(RustAttr)); AttrBuilder B(Attr); auto PAL = F->getAttributes(); -#if LLVM_VERSION_GE(5, 0) auto PALNew = PAL.removeAttributes(F->getContext(), Index, B); -#else - const AttributeSet PALNew = PAL.removeAttributes( - F->getContext(), Index, AttributeSet::get(F->getContext(), Index, B)); -#endif F->setAttributes(PALNew); } @@ -360,7 +304,6 @@ enum class LLVMRustSynchronizationScope { CrossThread, }; -#if LLVM_VERSION_GE(5, 0) static SyncScope::ID fromRust(LLVMRustSynchronizationScope Scope) { switch (Scope) { case LLVMRustSynchronizationScope::SingleThread: @@ -371,18 +314,6 @@ static SyncScope::ID fromRust(LLVMRustSynchronizationScope Scope) { report_fatal_error("bad SynchronizationScope."); } } -#else -static SynchronizationScope fromRust(LLVMRustSynchronizationScope Scope) { - switch (Scope) { - case LLVMRustSynchronizationScope::SingleThread: - return SingleThread; - case LLVMRustSynchronizationScope::CrossThread: - return CrossThread; - default: - report_fatal_error("bad SynchronizationScope."); - } -} -#endif extern "C" LLVMValueRef LLVMRustBuildAtomicFence(LLVMBuilderRef B, LLVMAtomicOrdering Order, @@ -422,18 +353,6 @@ extern "C" void LLVMRustAppendModuleInlineAsm(LLVMModuleRef M, const char *Asm) typedef DIBuilder *LLVMRustDIBuilderRef; -#if LLVM_VERSION_LT(5, 0) -typedef struct LLVMOpaqueMetadata *LLVMMetadataRef; - -namespace llvm { -DEFINE_ISA_CONVERSION_FUNCTIONS(Metadata, LLVMMetadataRef) - -inline Metadata **unwrap(LLVMMetadataRef *Vals) { - return reinterpret_cast(Vals); -} -} -#endif - template DIT *unwrapDIPtr(LLVMMetadataRef Ref) { return (DIT *)(Ref ? unwrap(Ref) : nullptr); } @@ -492,13 +411,8 @@ inline LLVMRustDIFlags visibility(LLVMRustDIFlags F) { return static_cast(static_cast(F) & 0x3); } -#if LLVM_VERSION_GE(4, 0) static DINode::DIFlags fromRust(LLVMRustDIFlags Flags) { DINode::DIFlags Result = DINode::DIFlags::FlagZero; -#else -static unsigned fromRust(LLVMRustDIFlags Flags) { - unsigned Result = 0; -#endif switch (visibility(Flags)) { case LLVMRustDIFlags::FlagPrivate: @@ -554,25 +468,18 @@ static unsigned fromRust(LLVMRustDIFlags Flags) { if (isSet(Flags & LLVMRustDIFlags::FlagRValueReference)) { Result |= DINode::DIFlags::FlagRValueReference; } -#if LLVM_VERSION_LE(4, 0) - if (isSet(Flags & LLVMRustDIFlags::FlagExternalTypeRef)) { - Result |= DINode::DIFlags::FlagExternalTypeRef; - } -#endif if (isSet(Flags & LLVMRustDIFlags::FlagIntroducedVirtual)) { Result |= DINode::DIFlags::FlagIntroducedVirtual; } if (isSet(Flags & LLVMRustDIFlags::FlagBitField)) { Result |= DINode::DIFlags::FlagBitField; } -#if LLVM_RUSTLLVM || LLVM_VERSION_GE(4, 0) if (isSet(Flags & LLVMRustDIFlags::FlagNoReturn)) { Result |= DINode::DIFlags::FlagNoReturn; } if (isSet(Flags & LLVMRustDIFlags::FlagMainSubprogram)) { Result |= DINode::DIFlags::FlagMainSubprogram; } -#endif return Result; } @@ -612,14 +519,8 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateCompileUnit( unsigned RuntimeVer, const char *SplitName) { auto *File = unwrapDI(FileRef); -#if LLVM_VERSION_GE(4, 0) return wrap(Builder->createCompileUnit(Lang, File, Producer, isOptimized, Flags, RuntimeVer, SplitName)); -#else - return wrap(Builder->createCompileUnit(Lang, File->getFilename(), - File->getDirectory(), Producer, isOptimized, - Flags, RuntimeVer, SplitName)); -#endif } extern "C" LLVMMetadataRef @@ -657,11 +558,7 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateBasicType(LLVMRustDIBuilderRef Builder, const char *Name, uint64_t SizeInBits, uint32_t AlignInBits, unsigned Encoding) { - return wrap(Builder->createBasicType(Name, SizeInBits, -#if LLVM_VERSION_LE(3, 9) - AlignInBits, -#endif - Encoding)); + return wrap(Builder->createBasicType(Name, SizeInBits, Encoding)); } extern "C" LLVMMetadataRef LLVMRustDIBuilderCreatePointerType( @@ -669,9 +566,7 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreatePointerType( uint64_t SizeInBits, uint32_t AlignInBits, const char *Name) { return wrap(Builder->createPointerType(unwrapDI(PointeeTy), SizeInBits, AlignInBits, -#if LLVM_VERSION_GE(5, 0) /* DWARFAddressSpace */ None, -#endif Name)); } @@ -722,7 +617,6 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateStaticVariable( LLVMMetadataRef Decl = nullptr, uint32_t AlignInBits = 0) { llvm::GlobalVariable *InitVal = cast(unwrap(V)); -#if LLVM_VERSION_GE(4, 0) llvm::DIExpression *InitExpr = nullptr; if (llvm::ConstantInt *IntVal = llvm::dyn_cast(InitVal)) { InitExpr = Builder->createConstantValueExpression( @@ -741,12 +635,6 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateStaticVariable( InitVal->setMetadata("dbg", VarExpr); return wrap(VarExpr); -#else - return wrap(Builder->createGlobalVariable( - unwrapDI(Context), Name, LinkageName, - unwrapDI(File), LineNo, unwrapDI(Ty), IsLocalToUnit, - InitVal, unwrapDIPtr(Decl))); -#endif } extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateVariable( @@ -757,12 +645,7 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateVariable( if (Tag == 0x100) { // DW_TAG_auto_variable return wrap(Builder->createAutoVariable( unwrapDI(Scope), Name, unwrapDI(File), LineNo, - unwrapDI(Ty), AlwaysPreserve, fromRust(Flags) -#if LLVM_VERSION_GE(4, 0) - , - AlignInBits -#endif - )); + unwrapDI(Ty), AlwaysPreserve, fromRust(Flags), AlignInBits)); } else { return wrap(Builder->createParameterVariable( unwrapDI(Scope), Name, ArgNo, unwrapDI(File), @@ -854,15 +737,8 @@ LLVMRustDIBuilderCreateNameSpace(LLVMRustDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, LLVMMetadataRef File, unsigned LineNo) { return wrap(Builder->createNameSpace( - unwrapDI(Scope), Name -#if LLVM_VERSION_LT(5, 0) - , - unwrapDI(File), LineNo -#endif -#if LLVM_VERSION_GE(4, 0) - , + unwrapDI(Scope), Name, false // ExportSymbols (only relevant for C++ anonymous namespaces) -#endif )); } @@ -891,12 +767,7 @@ extern "C" int64_t LLVMRustDIBuilderCreateOpDeref() { } extern "C" int64_t LLVMRustDIBuilderCreateOpPlusUconst() { -#if LLVM_VERSION_GE(5, 0) return dwarf::DW_OP_plus_uconst; -#else - // older LLVM used `plus` to behave like `plus_uconst`. - return dwarf::DW_OP_plus; -#endif } extern "C" void LLVMRustWriteTypeToString(LLVMTypeRef Ty, RustStringRef Str) { @@ -968,21 +839,12 @@ extern "C" void LLVMRustUnpackOptimizationDiagnostic( *FunctionOut = wrap(&Opt->getFunction()); RawRustStringOstream FilenameOS(FilenameOut); -#if LLVM_VERSION_GE(5,0) DiagnosticLocation loc = Opt->getLocation(); if (loc.isValid()) { *Line = loc.getLine(); *Column = loc.getColumn(); FilenameOS << loc.getFilename(); } -#else - const DebugLoc &loc = Opt->getDebugLoc(); - if (loc) { - *Line = loc.getLine(); - *Column = loc.getCol(); - FilenameOS << cast(loc.getScope())->getFilename(); - } -#endif RawRustStringOstream MessageOS(MessageOut); MessageOS << Opt->getMsg(); @@ -1402,7 +1264,6 @@ LLVMRustModuleCost(LLVMModuleRef M) { } // Vector reductions: -#if LLVM_VERSION_GE(5, 0) extern "C" LLVMValueRef LLVMRustBuildVectorReduceFAdd(LLVMBuilderRef B, LLVMValueRef Acc, LLVMValueRef Src) { return wrap(unwrap(B)->CreateFAddReduce(unwrap(Acc),unwrap(Src))); @@ -1448,62 +1309,6 @@ LLVMRustBuildVectorReduceFMax(LLVMBuilderRef B, LLVMValueRef Src, bool NoNaN) { return wrap(unwrap(B)->CreateFPMaxReduce(unwrap(Src), NoNaN)); } -#else - -extern "C" LLVMValueRef -LLVMRustBuildVectorReduceFAdd(LLVMBuilderRef, LLVMValueRef, LLVMValueRef) { - return nullptr; -} -extern "C" LLVMValueRef -LLVMRustBuildVectorReduceFMul(LLVMBuilderRef, LLVMValueRef, LLVMValueRef) { - return nullptr; -} -extern "C" LLVMValueRef -LLVMRustBuildVectorReduceAdd(LLVMBuilderRef, LLVMValueRef) { - return nullptr; -} -extern "C" LLVMValueRef -LLVMRustBuildVectorReduceMul(LLVMBuilderRef, LLVMValueRef) { - return nullptr; -} -extern "C" LLVMValueRef -LLVMRustBuildVectorReduceAnd(LLVMBuilderRef, LLVMValueRef) { - return nullptr; -} -extern "C" LLVMValueRef -LLVMRustBuildVectorReduceOr(LLVMBuilderRef, LLVMValueRef) { - return nullptr; -} -extern "C" LLVMValueRef -LLVMRustBuildVectorReduceXor(LLVMBuilderRef, LLVMValueRef) { - return nullptr; -} -extern "C" LLVMValueRef -LLVMRustBuildVectorReduceMin(LLVMBuilderRef, LLVMValueRef, bool) { - return nullptr; -} -extern "C" LLVMValueRef -LLVMRustBuildVectorReduceMax(LLVMBuilderRef, LLVMValueRef, bool) { - return nullptr; -} -extern "C" LLVMValueRef -LLVMRustBuildVectorReduceFMin(LLVMBuilderRef, LLVMValueRef, bool) { - return nullptr; -} -extern "C" LLVMValueRef -LLVMRustBuildVectorReduceFMax(LLVMBuilderRef, LLVMValueRef, bool) { - return nullptr; -} -#endif - -#if LLVM_VERSION_LT(4, 0) -extern "C" LLVMValueRef -LLVMBuildExactUDiv(LLVMBuilderRef B, LLVMValueRef LHS, - LLVMValueRef RHS, const char *Name) { - return wrap(unwrap(B)->CreateExactUDiv(unwrap(LHS), unwrap(RHS), Name)); -} -#endif - #if LLVM_VERSION_GE(6, 0) extern "C" LLVMValueRef LLVMRustBuildMinNum(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS) { diff --git a/src/test/codegen/call-metadata.rs b/src/test/codegen/call-metadata.rs index 20d42ed852d..1b92ff60226 100644 --- a/src/test/codegen/call-metadata.rs +++ b/src/test/codegen/call-metadata.rs @@ -12,8 +12,6 @@ // scalar value. // compile-flags: -C no-prepopulate-passes -// min-llvm-version 4.0 - #![crate_type = "lib"] diff --git a/src/test/codegen/issue-37945.rs b/src/test/codegen/issue-37945.rs index df02426badc..a36a50415ad 100644 --- a/src/test/codegen/issue-37945.rs +++ b/src/test/codegen/issue-37945.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// min-llvm-version 4.0 // compile-flags: -O // ignore-x86 // ignore-arm diff --git a/src/test/codegen/issue-45466.rs b/src/test/codegen/issue-45466.rs index 3702b675389..f916c1a0640 100644 --- a/src/test/codegen/issue-45466.rs +++ b/src/test/codegen/issue-45466.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// min-llvm-version 4.0 // compile-flags: -O #![crate_type="rlib"] diff --git a/src/test/codegen/mainsubprogram.rs b/src/test/codegen/mainsubprogram.rs index f0508bc90f2..2cfc20e30ca 100644 --- a/src/test/codegen/mainsubprogram.rs +++ b/src/test/codegen/mainsubprogram.rs @@ -14,7 +14,6 @@ // ignore-tidy-linelength // ignore-windows // ignore-macos -// min-llvm-version 4.0 // compile-flags: -g -C no-prepopulate-passes diff --git a/src/test/codegen/mainsubprogramstart.rs b/src/test/codegen/mainsubprogramstart.rs index 8325318f9af..62a996316c4 100644 --- a/src/test/codegen/mainsubprogramstart.rs +++ b/src/test/codegen/mainsubprogramstart.rs @@ -8,13 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This test depends on a patch that was committed to upstream LLVM -// before 4.0, formerly backported to the Rust LLVM fork. - // ignore-tidy-linelength // ignore-windows // ignore-macos -// min-llvm-version 4.0 // compile-flags: -g -C no-prepopulate-passes diff --git a/src/test/codegen/noreturnflag.rs b/src/test/codegen/noreturnflag.rs index 7239223ca20..f66369782e5 100644 --- a/src/test/codegen/noreturnflag.rs +++ b/src/test/codegen/noreturnflag.rs @@ -10,7 +10,6 @@ // compile-flags: -g -C no-prepopulate-passes // ignore-tidy-linelength -// min-llvm-version 4.0 #![crate_type = "lib"] diff --git a/src/test/codegen/stack-probes.rs b/src/test/codegen/stack-probes.rs index 6ab71723a1d..b8c2e62abef 100644 --- a/src/test/codegen/stack-probes.rs +++ b/src/test/codegen/stack-probes.rs @@ -21,7 +21,6 @@ // ignore-wasm // ignore-emscripten // ignore-windows -// min-system-llvm-version 5.0 // compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/src/test/codegen/vtabletype.rs b/src/test/codegen/vtabletype.rs index b6466467548..abd1eb3e2cc 100644 --- a/src/test/codegen/vtabletype.rs +++ b/src/test/codegen/vtabletype.rs @@ -14,7 +14,7 @@ // ignore-tidy-linelength // ignore-windows // ignore-macos -// min-system-llvm-version 5.1 +// min-llvm-version 6.0 // compile-flags: -g -C no-prepopulate-passes diff --git a/src/test/compile-fail/simd-intrinsic-generic-reduction.rs b/src/test/compile-fail/simd-intrinsic-generic-reduction.rs index 57e4bb76a6c..725960a866b 100644 --- a/src/test/compile-fail/simd-intrinsic-generic-reduction.rs +++ b/src/test/compile-fail/simd-intrinsic-generic-reduction.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// min-llvm-version 5.0 // ignore-emscripten // Test that the simd_reduce_{op} intrinsics produce ok-ish error diff --git a/src/test/mir-opt/lower_128bit_test.rs b/src/test/mir-opt/lower_128bit_test.rs index 27446d6bd28..b4b54e13a69 100644 --- a/src/test/mir-opt/lower_128bit_test.rs +++ b/src/test/mir-opt/lower_128bit_test.rs @@ -8,9 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// asmjs can't even pass i128 as arguments or return values, so ignore it. -// this will hopefully be fixed by the LLVM 5 upgrade (#43370) -// ignore-asmjs // ignore-emscripten // compile-flags: -Z lower_128bit_ops=yes -C debug_assertions=no diff --git a/src/test/run-make-fulldeps/cross-lang-lto/Makefile b/src/test/run-make-fulldeps/cross-lang-lto/Makefile index cdc429d1f99..efe1b7072ff 100644 --- a/src/test/run-make-fulldeps/cross-lang-lto/Makefile +++ b/src/test/run-make-fulldeps/cross-lang-lto/Makefile @@ -1,5 +1,3 @@ - -# min-llvm-version 4.0 # ignore-msvc -include ../tools.mk diff --git a/src/test/run-make-fulldeps/llvm-pass/llvm-function-pass.so.cc b/src/test/run-make-fulldeps/llvm-pass/llvm-function-pass.so.cc index 880c9bce562..c0a17d920cf 100644 --- a/src/test/run-make-fulldeps/llvm-pass/llvm-function-pass.so.cc +++ b/src/test/run-make-fulldeps/llvm-pass/llvm-function-pass.so.cc @@ -28,12 +28,7 @@ namespace { bool runOnFunction(Function &F) override; -#if LLVM_VERSION_MAJOR >= 4 - StringRef -#else - const char * -#endif - getPassName() const override { + StringRef getPassName() const override { return "Some LLVM pass"; } diff --git a/src/test/run-make-fulldeps/llvm-pass/llvm-module-pass.so.cc b/src/test/run-make-fulldeps/llvm-pass/llvm-module-pass.so.cc index 280eca7e8f0..70051681ab0 100644 --- a/src/test/run-make-fulldeps/llvm-pass/llvm-module-pass.so.cc +++ b/src/test/run-make-fulldeps/llvm-pass/llvm-module-pass.so.cc @@ -27,12 +27,7 @@ namespace { bool runOnModule(Module &M) override; -#if LLVM_VERSION_MAJOR >= 4 - StringRef -#else - const char * -#endif - getPassName() const override { + StringRef getPassName() const override { return "Some LLVM pass"; } diff --git a/src/test/run-pass/issue-40883.rs b/src/test/run-pass/issue-40883.rs index feb4a88a1d1..c1f3b2028aa 100644 --- a/src/test/run-pass/issue-40883.rs +++ b/src/test/run-pass/issue-40883.rs @@ -9,7 +9,6 @@ // except according to those terms. // check that we don't have linear stack usage with multiple calls to `push` -// min-llvm-version 4.0 #![feature(test)] diff --git a/src/test/run-pass/simd-intrinsic-generic-reduction.rs b/src/test/run-pass/simd-intrinsic-generic-reduction.rs index 9a1214d3b35..8e999b7115e 100644 --- a/src/test/run-pass/simd-intrinsic-generic-reduction.rs +++ b/src/test/run-pass/simd-intrinsic-generic-reduction.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// min-llvm-version 5.0 // ignore-emscripten // Test that the simd_reduce_{op} intrinsics produce the correct results. diff --git a/src/test/run-pass/stack-probes-lto.rs b/src/test/run-pass/stack-probes-lto.rs index 3fef19c51bd..ff5413ce06c 100644 --- a/src/test/run-pass/stack-probes-lto.rs +++ b/src/test/run-pass/stack-probes-lto.rs @@ -21,7 +21,6 @@ // ignore-emscripten no processes // ignore-musl FIXME #31506 // ignore-pretty -// min-system-llvm-version 5.0 // compile-flags: -C lto // no-prefer-dynamic diff --git a/src/test/run-pass/stack-probes.rs b/src/test/run-pass/stack-probes.rs index c93dcf01939..1334ab8dc63 100644 --- a/src/test/run-pass/stack-probes.rs +++ b/src/test/run-pass/stack-probes.rs @@ -20,7 +20,6 @@ // ignore-cloudabi no processes // ignore-emscripten no processes // ignore-musl FIXME #31506 -// min-system-llvm-version 5.0 use std::mem; use std::process::Command; diff --git a/src/test/run-pass/thin-lto-global-allocator.rs b/src/test/run-pass/thin-lto-global-allocator.rs index 3a0e2fe01db..257d5bbc306 100644 --- a/src/test/run-pass/thin-lto-global-allocator.rs +++ b/src/test/run-pass/thin-lto-global-allocator.rs @@ -9,7 +9,6 @@ // except according to those terms. // compile-flags: -Z thinlto -C codegen-units=2 -// min-llvm-version 4.0 #[global_allocator] static A: std::alloc::System = std::alloc::System; diff --git a/src/test/run-pass/thinlto/all-crates.rs b/src/test/run-pass/thinlto/all-crates.rs index 772a9ec8293..8d68202d711 100644 --- a/src/test/run-pass/thinlto/all-crates.rs +++ b/src/test/run-pass/thinlto/all-crates.rs @@ -10,7 +10,6 @@ // compile-flags: -Clto=thin // no-prefer-dynamic -// min-llvm-version 4.0 fn main() { println!("hello!"); diff --git a/src/test/run-pass/thinlto/dylib-works.rs b/src/test/run-pass/thinlto/dylib-works.rs index 3f54519d0d8..06df40f6142 100644 --- a/src/test/run-pass/thinlto/dylib-works.rs +++ b/src/test/run-pass/thinlto/dylib-works.rs @@ -9,7 +9,6 @@ // except according to those terms. // aux-build:dylib.rs -// min-llvm-version 4.0 extern crate dylib; diff --git a/src/test/run-pass/thinlto/msvc-imp-present.rs b/src/test/run-pass/thinlto/msvc-imp-present.rs index 8329c7032f1..95cff2a2862 100644 --- a/src/test/run-pass/thinlto/msvc-imp-present.rs +++ b/src/test/run-pass/thinlto/msvc-imp-present.rs @@ -10,7 +10,6 @@ // aux-build:msvc-imp-present.rs // compile-flags: -Z thinlto -C codegen-units=8 -// min-llvm-version: 4.0 // no-prefer-dynamic // On MSVC we have a "hack" where we emit symbols that look like `_imp_$name` diff --git a/src/test/run-pass/thinlto/thin-lto-inlines.rs b/src/test/run-pass/thinlto/thin-lto-inlines.rs index 7a71dd2bc51..41ca983af51 100644 --- a/src/test/run-pass/thinlto/thin-lto-inlines.rs +++ b/src/test/run-pass/thinlto/thin-lto-inlines.rs @@ -9,7 +9,6 @@ // except according to those terms. // compile-flags: -Z thinlto -C codegen-units=8 -O -// min-llvm-version 4.0 // ignore-emscripten can't inspect instructions on emscripten // We want to assert here that ThinLTO will inline across codegen units. There's diff --git a/src/test/run-pass/thinlto/thin-lto-inlines2.rs b/src/test/run-pass/thinlto/thin-lto-inlines2.rs index 6020f72415d..3c0e904662a 100644 --- a/src/test/run-pass/thinlto/thin-lto-inlines2.rs +++ b/src/test/run-pass/thinlto/thin-lto-inlines2.rs @@ -10,7 +10,6 @@ // compile-flags: -C codegen-units=8 -O -C lto=thin // aux-build:thin-lto-inlines-aux.rs -// min-llvm-version 4.0 // no-prefer-dynamic // ignore-emscripten can't inspect instructions on emscripten diff --git a/src/test/run-pass/thinlto/weak-works.rs b/src/test/run-pass/thinlto/weak-works.rs index b9719e04f34..0a1b7307a46 100644 --- a/src/test/run-pass/thinlto/weak-works.rs +++ b/src/test/run-pass/thinlto/weak-works.rs @@ -10,7 +10,6 @@ // compile-flags: -C codegen-units=8 -Z thinlto // ignore-windows -// min-llvm-version 4.0 #![feature(linkage)]