diff --git a/.travis.yml b/.travis.yml index 3f2e43ab86d90..9e46e6b8ef6b1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ matrix: fast_finish: true include: # Images used in testing PR and try-build should be run first. - - env: IMAGE=x86_64-gnu-llvm-5.0 RUST_BACKTRACE=1 + - env: IMAGE=x86_64-gnu-llvm-6.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 2da800f19c07b..d9f51f6fd3d07 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -278,11 +278,11 @@ fn check_llvm_version(builder: &Builder, llvm_config: &Path) { 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 >= 5 { + if major >= 6 { return } } - panic!("\n\nbad LLVM version: {}, need >=5.0\n\n", version) + panic!("\n\nbad LLVM version: {}, need >=6.0\n\n", version) } fn configure_cmake(builder: &Builder, diff --git a/src/ci/docker/x86_64-gnu-llvm-5.0/Dockerfile b/src/ci/docker/x86_64-gnu-llvm-6.0/Dockerfile similarity index 89% rename from src/ci/docker/x86_64-gnu-llvm-5.0/Dockerfile rename to src/ci/docker/x86_64-gnu-llvm-6.0/Dockerfile index 4f90c5097260c..160b23e0b00d1 100644 --- a/src/ci/docker/x86_64-gnu-llvm-5.0/Dockerfile +++ b/src/ci/docker/x86_64-gnu-llvm-6.0/Dockerfile @@ -11,7 +11,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ cmake \ sudo \ gdb \ - llvm-5.0-tools \ + llvm-6.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-5.0 \ + --llvm-root=/usr/lib/llvm-6.0 \ --enable-llvm-link-shared ENV RUST_CHECK_TARGET check diff --git a/src/librustc_codegen_llvm/builder.rs b/src/librustc_codegen_llvm/builder.rs index a95ddefc86906..01b1387d9cc2f 100644 --- a/src/librustc_codegen_llvm/builder.rs +++ b/src/librustc_codegen_llvm/builder.rs @@ -1024,17 +1024,11 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { fn minnum(&mut self, lhs: &'ll Value, rhs: &'ll Value) -> &'ll Value { self.count_insn("minnum"); - unsafe { - let instr = llvm::LLVMRustBuildMinNum(self.llbuilder, lhs, rhs); - instr.expect("LLVMRustBuildMinNum is not available in LLVM version < 6.0") - } + unsafe { llvm::LLVMRustBuildMinNum(self.llbuilder, lhs, rhs) } } fn maxnum(&mut self, lhs: &'ll Value, rhs: &'ll Value) -> &'ll Value { self.count_insn("maxnum"); - unsafe { - let instr = llvm::LLVMRustBuildMaxNum(self.llbuilder, lhs, rhs); - instr.expect("LLVMRustBuildMaxNum is not available in LLVM version < 6.0") - } + unsafe { llvm::LLVMRustBuildMaxNum(self.llbuilder, lhs, rhs) } } fn select( diff --git a/src/librustc_codegen_llvm/context.rs b/src/librustc_codegen_llvm/context.rs index 0bd6146f5aaa0..b75cd8f68b368 100644 --- a/src/librustc_codegen_llvm/context.rs +++ b/src/librustc_codegen_llvm/context.rs @@ -10,7 +10,6 @@ use attributes; use llvm; -use llvm_util; use rustc::dep_graph::DepGraphSafe; use rustc::hir; use debuginfo; @@ -446,10 +445,6 @@ impl MiscMethods<'tcx> for CodegenCx<'ll, 'tcx> { attributes::apply_target_cpu_attr(self, llfn) } - fn closure_env_needs_indirect_debuginfo(&self) -> bool { - llvm_util::get_major_version() < 6 - } - fn create_used_variable(&self) { let name = const_cstr!("llvm.used"); let section = const_cstr!("llvm.metadata"); diff --git a/src/librustc_codegen_llvm/llvm/ffi.rs b/src/librustc_codegen_llvm/llvm/ffi.rs index 127759a432664..4732db88ec1cb 100644 --- a/src/librustc_codegen_llvm/llvm/ffi.rs +++ b/src/librustc_codegen_llvm/llvm/ffi.rs @@ -1222,12 +1222,12 @@ extern "C" { B: &Builder<'a>, LHS: &'a Value, LHS: &'a Value, - ) -> Option<&'a Value>; + ) -> &'a Value; pub fn LLVMRustBuildMaxNum( B: &Builder<'a>, LHS: &'a Value, LHS: &'a Value, - ) -> Option<&'a Value>; + ) -> &'a Value; // Atomic Operations pub fn LLVMRustBuildAtomicLoad(B: &Builder<'a>, diff --git a/src/librustc_codegen_ssa/mir/mod.rs b/src/librustc_codegen_ssa/mir/mod.rs index 750de1c660cf3..d316b3ec3508c 100644 --- a/src/librustc_codegen_ssa/mir/mod.rs +++ b/src/librustc_codegen_ssa/mir/mod.rs @@ -610,35 +610,13 @@ fn arg_local_refs<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( }; let upvar_tys = upvar_substs.upvar_tys(def_id, tcx); - // Store the pointer to closure data in an alloca for debuginfo - // because that's what the llvm.dbg.declare intrinsic expects. - - // FIXME(eddyb) this shouldn't be necessary but SROA seems to - // mishandle DW_OP_plus not preceded by DW_OP_deref, i.e., it - // doesn't actually strip the offset when splitting the closure - // environment into its components so it ends up out of bounds. - // (cuviper) It seems to be fine without the alloca on LLVM 6 and later. - let env_alloca = !env_ref && bx.closure_env_needs_indirect_debuginfo(); - let env_ptr = if env_alloca { - let scratch = PlaceRef::alloca(bx, - bx.layout_of(tcx.mk_mut_ptr(arg.layout.ty)), - "__debuginfo_env_ptr"); - bx.store(place.llval, scratch.llval, scratch.align); - scratch.llval - } else { - place.llval - }; - for (i, (decl, ty)) in mir.upvar_decls.iter().zip(upvar_tys).enumerate() { let byte_offset_of_var_in_env = closure_layout.fields.offset(i).bytes(); let ops = bx.debuginfo_upvar_decls_ops_sequence(byte_offset_of_var_in_env); // The environment and the capture can each be indirect. - - // FIXME(eddyb) see above why we sometimes have to keep - // a pointer in an alloca for debuginfo atm. - let mut ops = if env_ref || env_alloca { &ops[..] } else { &ops[1..] }; + let mut ops = if env_ref { &ops[..] } else { &ops[1..] }; let ty = if let (true, &ty::Ref(_, ty, _)) = (decl.by_ref, &ty.sty) { ty @@ -648,7 +626,7 @@ fn arg_local_refs<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( }; let variable_access = VariableAccess::IndirectVariable { - alloca: env_ptr, + alloca: place.llval, address_operations: &ops }; bx.declare_local( diff --git a/src/librustc_codegen_ssa/traits/misc.rs b/src/librustc_codegen_ssa/traits/misc.rs index d8871dd3a58ca..57afb800d014c 100644 --- a/src/librustc_codegen_ssa/traits/misc.rs +++ b/src/librustc_codegen_ssa/traits/misc.rs @@ -32,7 +32,6 @@ pub trait MiscMethods<'tcx>: BackendTypes { fn stats(&self) -> &RefCell; fn consume_stats(self) -> RefCell; fn codegen_unit(&self) -> &Arc>; - fn closure_env_needs_indirect_debuginfo(&self) -> bool; fn used_statics(&self) -> &RefCell>; fn set_frame_pointer_elimination(&self, llfn: Self::Value); fn apply_target_cpu_attr(&self, llfn: Self::Value); diff --git a/src/rustllvm/ArchiveWrapper.cpp b/src/rustllvm/ArchiveWrapper.cpp index 1355c0377ce91..2f8dc0d466fb4 100644 --- a/src/rustllvm/ArchiveWrapper.cpp +++ b/src/rustllvm/ArchiveWrapper.cpp @@ -216,16 +216,11 @@ LLVMRustWriteArchive(char *Dst, size_t NumMembers, Members.push_back(std::move(*MOrErr)); } } + auto Result = writeArchive(Dst, Members, WriteSymbtab, Kind, true, false); -#if LLVM_VERSION_GE(6, 0) if (!Result) return LLVMRustResult::Success; LLVMRustSetLastError(toString(std::move(Result)).c_str()); -#else - if (!Result.second) - return LLVMRustResult::Success; - LLVMRustSetLastError(Result.second.message().c_str()); -#endif return LLVMRustResult::Failure; } diff --git a/src/rustllvm/PassWrapper.cpp b/src/rustllvm/PassWrapper.cpp index aa420bf6100c7..4d95368c00f1e 100644 --- a/src/rustllvm/PassWrapper.cpp +++ b/src/rustllvm/PassWrapper.cpp @@ -17,21 +17,15 @@ #include "llvm/Analysis/TargetLibraryInfo.h" #include "llvm/Analysis/TargetTransformInfo.h" +#include "llvm/CodeGen/TargetSubtargetInfo.h" #include "llvm/IR/AutoUpgrade.h" #include "llvm/IR/AssemblyAnnotationWriter.h" +#include "llvm/IR/IntrinsicInst.h" #include "llvm/Support/CBindingWrapping.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/Host.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Transforms/IPO/PassManagerBuilder.h" - -#if LLVM_VERSION_GE(6, 0) -#include "llvm/CodeGen/TargetSubtargetInfo.h" -#include "llvm/IR/IntrinsicInst.h" -#else -#include "llvm/Target/TargetSubtargetInfo.h" -#endif - #include "llvm/Transforms/IPO/AlwaysInliner.h" #include "llvm/Transforms/IPO/FunctionImport.h" #include "llvm/Transforms/Utils/FunctionImportUtils.h" @@ -198,13 +192,9 @@ GEN_SUBTARGETS extern "C" bool LLVMRustHasFeature(LLVMTargetMachineRef TM, const char *Feature) { -#if LLVM_VERSION_GE(6, 0) TargetMachine *Target = unwrap(TM); const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo(); return MCInfo->checkFeatures(std::string("+") + Feature); -#else - return false; -#endif } enum class LLVMRustCodeModel { @@ -392,13 +382,9 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine( Options.ThreadModel = ThreadModel::Single; } -#if LLVM_VERSION_GE(6, 0) Options.EmitStackSizeSection = EmitStackSizeSection; Optional CM; -#else - CodeModel::Model CM = CodeModel::Model::Default; -#endif if (RustCM != LLVMRustCodeModel::None) CM = fromRust(RustCM); TargetMachine *TM = TheTarget->createTargetMachine( diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp index b9a0b435d3e36..86c5dfcfb9827 100644 --- a/src/rustllvm/RustWrapper.cpp +++ b/src/rustllvm/RustWrapper.cpp @@ -297,11 +297,7 @@ extern "C" void LLVMRustRemoveFunctionAttributes(LLVMValueRef Fn, // enable fpmath flag UnsafeAlgebra extern "C" void LLVMRustSetHasUnsafeAlgebra(LLVMValueRef V) { if (auto I = dyn_cast(unwrap(V))) { -#if LLVM_VERSION_GE(6, 0) I->setFast(true); -#else - I->setHasUnsafeAlgebra(true); -#endif } } @@ -1437,7 +1433,6 @@ LLVMRustBuildVectorReduceFMax(LLVMBuilderRef B, LLVMValueRef Src, bool NoNaN) { return wrap(unwrap(B)->CreateFPMaxReduce(unwrap(Src), NoNaN)); } -#if LLVM_VERSION_GE(6, 0) extern "C" LLVMValueRef LLVMRustBuildMinNum(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS) { return wrap(unwrap(B)->CreateMinNum(unwrap(LHS),unwrap(RHS))); @@ -1446,13 +1441,3 @@ extern "C" LLVMValueRef LLVMRustBuildMaxNum(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS) { return wrap(unwrap(B)->CreateMaxNum(unwrap(LHS),unwrap(RHS))); } -#else -extern "C" LLVMValueRef -LLVMRustBuildMinNum(LLVMBuilderRef, LLVMValueRef, LLVMValueRef) { - return nullptr; -} -extern "C" LLVMValueRef -LLVMRustBuildMaxNum(LLVMBuilderRef, LLVMValueRef, LLVMValueRef) { - return nullptr; -} -#endif diff --git a/src/test/codegen/function-arguments.rs b/src/test/codegen/function-arguments.rs index 5061d9a915e2e..52bdb1b103afd 100644 --- a/src/test/codegen/function-arguments.rs +++ b/src/test/codegen/function-arguments.rs @@ -10,7 +10,6 @@ // compile-flags: -C no-prepopulate-passes // ignore-tidy-linelength -// min-llvm-version 6.0 #![crate_type = "lib"] #![feature(custom_attribute)] diff --git a/src/test/codegen/issue-44056-macos-tls-align.rs b/src/test/codegen/issue-44056-macos-tls-align.rs index b146e106aa104..ebd436cc6478b 100644 --- a/src/test/codegen/issue-44056-macos-tls-align.rs +++ b/src/test/codegen/issue-44056-macos-tls-align.rs @@ -11,7 +11,6 @@ // ignore-tidy-linelength // only-macos // no-system-llvm -// min-llvm-version 6.0 // compile-flags: -O #![crate_type = "rlib"] diff --git a/src/test/codegen/issue-45222.rs b/src/test/codegen/issue-45222.rs index 3544786e2e60a..a6e633bf285ac 100644 --- a/src/test/codegen/issue-45222.rs +++ b/src/test/codegen/issue-45222.rs @@ -9,7 +9,6 @@ // except according to those terms. // compile-flags: -O -// min-llvm-version 6.0 #![crate_type = "lib"] diff --git a/src/test/codegen/issue-45466.rs b/src/test/codegen/issue-45466.rs index 149547639440c..f916c1a064093 100644 --- a/src/test/codegen/issue-45466.rs +++ b/src/test/codegen/issue-45466.rs @@ -9,7 +9,6 @@ // except according to those terms. // compile-flags: -O -// min-llvm-version 6.0 #![crate_type="rlib"] diff --git a/src/test/codegen/simd-intrinsic-generic-gather.rs b/src/test/codegen/simd-intrinsic-generic-gather.rs index 6c47bf3e321fb..605a952e8ff05 100644 --- a/src/test/codegen/simd-intrinsic-generic-gather.rs +++ b/src/test/codegen/simd-intrinsic-generic-gather.rs @@ -10,7 +10,6 @@ // ignore-emscripten // ignore-tidy-linelength -// min-llvm-version 6.0 // compile-flags: -C no-prepopulate-passes diff --git a/src/test/codegen/simd-intrinsic-generic-scatter.rs b/src/test/codegen/simd-intrinsic-generic-scatter.rs index 7b5b2e55e2949..6645778468cbe 100644 --- a/src/test/codegen/simd-intrinsic-generic-scatter.rs +++ b/src/test/codegen/simd-intrinsic-generic-scatter.rs @@ -10,7 +10,6 @@ // ignore-emscripten // ignore-tidy-linelength -// min-llvm-version 6.0 // compile-flags: -C no-prepopulate-passes diff --git a/src/test/codegen/vtabletype.rs b/src/test/codegen/vtabletype.rs index abd1eb3e2cc7b..cb96a844341b7 100644 --- a/src/test/codegen/vtabletype.rs +++ b/src/test/codegen/vtabletype.rs @@ -14,7 +14,6 @@ // ignore-tidy-linelength // ignore-windows // ignore-macos -// min-llvm-version 6.0 // compile-flags: -g -C no-prepopulate-passes diff --git a/src/test/run-pass/simd/simd-intrinsic-generic-gather.rs b/src/test/run-pass/simd/simd-intrinsic-generic-gather.rs index 5f6a72a8e1e11..e5ac5775b0cb9 100644 --- a/src/test/run-pass/simd/simd-intrinsic-generic-gather.rs +++ b/src/test/run-pass/simd/simd-intrinsic-generic-gather.rs @@ -10,7 +10,6 @@ // run-pass // ignore-emscripten -// min-llvm-version 6.0 // Test that the simd_{gather,scatter} intrinsics produce the correct results. diff --git a/src/test/run-pass/sse2.rs b/src/test/run-pass/sse2.rs index 041286fe656a0..779c72b8df127 100644 --- a/src/test/run-pass/sse2.rs +++ b/src/test/run-pass/sse2.rs @@ -8,11 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(stable_features)] -// min-llvm-version 6.0 -// ^ needs MCSubtargetInfo::checkFeatures() // ignore-cloudabi no std::env +#![allow(stable_features)] #![feature(cfg_target_feature)] use std::env; diff --git a/src/test/ui/target-feature-gate.rs b/src/test/ui/target-feature-gate.rs index 8a045884cae31..2d0fb78897de1 100644 --- a/src/test/ui/target-feature-gate.rs +++ b/src/test/ui/target-feature-gate.rs @@ -24,7 +24,6 @@ // gate-test-mips_target_feature // gate-test-mmx_target_feature // gate-test-wasm_target_feature -// min-llvm-version 6.0 #[target_feature(enable = "avx512bw")] //~^ ERROR: currently unstable diff --git a/src/test/ui/target-feature-gate.stderr b/src/test/ui/target-feature-gate.stderr index f18bebc0c290d..24141d0064fb0 100644 --- a/src/test/ui/target-feature-gate.stderr +++ b/src/test/ui/target-feature-gate.stderr @@ -1,5 +1,5 @@ error[E0658]: the target feature `avx512bw` is currently unstable (see issue #44839) - --> $DIR/target-feature-gate.rs:29:18 + --> $DIR/target-feature-gate.rs:28:18 | LL | #[target_feature(enable = "avx512bw")] | ^^^^^^^^^^^^^^^^^^^