Skip to content

Commit 4ff90c7

Browse files
committed
bump minimum LLVM version to 5.0
1 parent ec039c7 commit 4ff90c7

30 files changed

+17
-268
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ matrix:
1212
fast_finish: true
1313
include:
1414
# Images used in testing PR and try-build should be run first.
15-
- env: IMAGE=x86_64-gnu-llvm-3.9 RUST_BACKTRACE=1
15+
- env: IMAGE=x86_64-gnu-llvm-5.0 RUST_BACKTRACE=1
1616
if: type = pull_request OR branch = auto
1717

1818
- env: IMAGE=dist-x86_64-linux DEPLOY=1

src/bootstrap/native.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,12 +256,12 @@ fn check_llvm_version(builder: &Builder, llvm_config: &Path) {
256256
let version = output(cmd.arg("--version"));
257257
let mut parts = version.split('.').take(2)
258258
.filter_map(|s| s.parse::<u32>().ok());
259-
if let (Some(major), Some(minor)) = (parts.next(), parts.next()) {
260-
if major > 3 || (major == 3 && minor >= 9) {
259+
if let (Some(major), Some(_minor)) = (parts.next(), parts.next()) {
260+
if major >= 5 {
261261
return
262262
}
263263
}
264-
panic!("\n\nbad LLVM version: {}, need >=3.9\n\n", version)
264+
panic!("\n\nbad LLVM version: {}, need >=5.0\n\n", version)
265265
}
266266

267267
fn configure_cmake(builder: &Builder,

src/ci/docker/x86_64-gnu-llvm-3.9/Dockerfile renamed to src/ci/docker/x86_64-gnu-llvm-5.0/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
1111
cmake \
1212
sudo \
1313
gdb \
14-
llvm-3.9-tools \
14+
llvm-5.0-tools \
1515
libedit-dev \
1616
zlib1g-dev \
1717
xz-utils
@@ -22,6 +22,6 @@ RUN sh /scripts/sccache.sh
2222
# using llvm-link-shared due to libffi issues -- see #34486
2323
ENV RUST_CONFIGURE_ARGS \
2424
--build=x86_64-unknown-linux-gnu \
25-
--llvm-root=/usr/lib/llvm-3.9 \
25+
--llvm-root=/usr/lib/llvm-5.0 \
2626
--enable-llvm-link-shared
2727
ENV RUST_CHECK_TARGET check

src/librustc_codegen_llvm/abi.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -666,11 +666,7 @@ impl<'a, 'tcx> FnTypeExt<'a, 'tcx> for FnType<'tcx, Ty<'tcx>> {
666666
layout::Int(..) if !scalar.is_bool() => {
667667
let range = scalar.valid_range_exclusive(bx.cx);
668668
if range.start != range.end {
669-
// FIXME(nox): This causes very weird type errors about
670-
// SHL operators in constants in stage 2 with LLVM 3.9.
671-
if unsafe { llvm::LLVMRustVersionMajor() >= 4 } {
672-
bx.range_metadata(callsite, range);
673-
}
669+
bx.range_metadata(callsite, range);
674670
}
675671
}
676672
_ => {}

src/librustc_codegen_llvm/mir/mod.rs

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use builder::Builder;
2222
use common::{CodegenCx, Funclet};
2323
use debuginfo::{self, declare_local, VariableAccess, VariableKind, FunctionDebugContext};
2424
use monomorphize::Instance;
25-
use abi::{ArgAttribute, ArgTypeExt, FnType, FnTypeExt, PassMode};
25+
use abi::{ArgTypeExt, FnType, FnTypeExt, PassMode};
2626
use type_::Type;
2727

2828
use syntax_pos::{DUMMY_SP, NO_EXPANSION, BytePos, Span};
@@ -430,10 +430,6 @@ fn arg_local_refs<'a, 'tcx>(bx: &Builder<'a, 'tcx>,
430430
None
431431
};
432432

433-
let deref_op = unsafe {
434-
[llvm::LLVMRustDIBuilderCreateOpDeref()]
435-
};
436-
437433
mir.args_iter().enumerate().map(|(arg_index, local)| {
438434
let arg_decl = &mir.local_decls[local];
439435

@@ -543,21 +539,11 @@ fn arg_local_refs<'a, 'tcx>(bx: &Builder<'a, 'tcx>,
543539
if arg_index > 0 || mir.upvar_decls.is_empty() {
544540
// The Rust ABI passes indirect variables using a pointer and a manual copy, so we
545541
// need to insert a deref here, but the C ABI uses a pointer and a copy using the
546-
// byval attribute, for which LLVM does the deref itself, so we must not add it.
547-
// Starting with D31439 in LLVM 5, it *always* does the deref itself.
548-
let mut variable_access = VariableAccess::DirectVariable {
542+
// byval attribute, for which LLVM always does the deref itself,
543+
// so we must not add it.
544+
let variable_access = VariableAccess::DirectVariable {
549545
alloca: place.llval
550546
};
551-
if unsafe { llvm::LLVMRustVersionMajor() < 5 } {
552-
if let PassMode::Indirect(ref attrs) = arg.mode {
553-
if !attrs.contains(ArgAttribute::ByVal) {
554-
variable_access = VariableAccess::IndirectVariable {
555-
alloca: place.llval,
556-
address_operations: &deref_op,
557-
};
558-
}
559-
}
560-
}
561547

562548
declare_local(
563549
bx,

0 commit comments

Comments
 (0)