Skip to content

Commit 706e67b

Browse files
committed
Bump minimum required LLVM version to 6.0
1 parent b7da2c6 commit 706e67b

19 files changed

+14
-65
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ matrix:
1616
fast_finish: true
1717
include:
1818
# Images used in testing PR and try-build should be run first.
19-
- env: IMAGE=x86_64-gnu-llvm-5.0 RUST_BACKTRACE=1
19+
- env: IMAGE=x86_64-gnu-llvm-6.0 RUST_BACKTRACE=1
2020
if: type = pull_request OR branch = auto
2121

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

src/bootstrap/native.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -278,11 +278,11 @@ fn check_llvm_version(builder: &Builder, llvm_config: &Path) {
278278
let mut parts = version.split('.').take(2)
279279
.filter_map(|s| s.parse::<u32>().ok());
280280
if let (Some(major), Some(_minor)) = (parts.next(), parts.next()) {
281-
if major >= 5 {
281+
if major >= 6 {
282282
return
283283
}
284284
}
285-
panic!("\n\nbad LLVM version: {}, need >=5.0\n\n", version)
285+
panic!("\n\nbad LLVM version: {}, need >=6.0\n\n", version)
286286
}
287287

288288
fn configure_cmake(builder: &Builder,

src/ci/docker/x86_64-gnu-llvm-5.0/Dockerfile src/ci/docker/x86_64-gnu-llvm-6.0/Dockerfile

+2-2
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-5.0-tools \
14+
llvm-6.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-5.0 \
25+
--llvm-root=/usr/lib/llvm-6.0 \
2626
--enable-llvm-link-shared
2727
ENV RUST_CHECK_TARGET check

src/librustc_codegen_llvm/builder.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -1024,17 +1024,11 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
10241024

10251025
fn minnum(&mut self, lhs: &'ll Value, rhs: &'ll Value) -> &'ll Value {
10261026
self.count_insn("minnum");
1027-
unsafe {
1028-
let instr = llvm::LLVMRustBuildMinNum(self.llbuilder, lhs, rhs);
1029-
instr.expect("LLVMRustBuildMinNum is not available in LLVM version < 6.0")
1030-
}
1027+
unsafe { llvm::LLVMRustBuildMinNum(self.llbuilder, lhs, rhs) }
10311028
}
10321029
fn maxnum(&mut self, lhs: &'ll Value, rhs: &'ll Value) -> &'ll Value {
10331030
self.count_insn("maxnum");
1034-
unsafe {
1035-
let instr = llvm::LLVMRustBuildMaxNum(self.llbuilder, lhs, rhs);
1036-
instr.expect("LLVMRustBuildMaxNum is not available in LLVM version < 6.0")
1037-
}
1031+
unsafe { llvm::LLVMRustBuildMaxNum(self.llbuilder, lhs, rhs) }
10381032
}
10391033

10401034
fn select(

src/librustc_codegen_llvm/llvm/ffi.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1222,12 +1222,12 @@ extern "C" {
12221222
B: &Builder<'a>,
12231223
LHS: &'a Value,
12241224
LHS: &'a Value,
1225-
) -> Option<&'a Value>;
1225+
) -> &'a Value;
12261226
pub fn LLVMRustBuildMaxNum(
12271227
B: &Builder<'a>,
12281228
LHS: &'a Value,
12291229
LHS: &'a Value,
1230-
) -> Option<&'a Value>;
1230+
) -> &'a Value;
12311231

12321232
// Atomic Operations
12331233
pub fn LLVMRustBuildAtomicLoad(B: &Builder<'a>,

src/rustllvm/ArchiveWrapper.cpp

+1-6
Original file line numberDiff line numberDiff line change
@@ -216,16 +216,11 @@ LLVMRustWriteArchive(char *Dst, size_t NumMembers,
216216
Members.push_back(std::move(*MOrErr));
217217
}
218218
}
219+
219220
auto Result = writeArchive(Dst, Members, WriteSymbtab, Kind, true, false);
220-
#if LLVM_VERSION_GE(6, 0)
221221
if (!Result)
222222
return LLVMRustResult::Success;
223223
LLVMRustSetLastError(toString(std::move(Result)).c_str());
224-
#else
225-
if (!Result.second)
226-
return LLVMRustResult::Success;
227-
LLVMRustSetLastError(Result.second.message().c_str());
228-
#endif
229224

230225
return LLVMRustResult::Failure;
231226
}

src/rustllvm/PassWrapper.cpp

+2-16
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,15 @@
1717

1818
#include "llvm/Analysis/TargetLibraryInfo.h"
1919
#include "llvm/Analysis/TargetTransformInfo.h"
20+
#include "llvm/CodeGen/TargetSubtargetInfo.h"
2021
#include "llvm/IR/AutoUpgrade.h"
2122
#include "llvm/IR/AssemblyAnnotationWriter.h"
23+
#include "llvm/IR/IntrinsicInst.h"
2224
#include "llvm/Support/CBindingWrapping.h"
2325
#include "llvm/Support/FileSystem.h"
2426
#include "llvm/Support/Host.h"
2527
#include "llvm/Target/TargetMachine.h"
2628
#include "llvm/Transforms/IPO/PassManagerBuilder.h"
27-
28-
#if LLVM_VERSION_GE(6, 0)
29-
#include "llvm/CodeGen/TargetSubtargetInfo.h"
30-
#include "llvm/IR/IntrinsicInst.h"
31-
#else
32-
#include "llvm/Target/TargetSubtargetInfo.h"
33-
#endif
34-
3529
#include "llvm/Transforms/IPO/AlwaysInliner.h"
3630
#include "llvm/Transforms/IPO/FunctionImport.h"
3731
#include "llvm/Transforms/Utils/FunctionImportUtils.h"
@@ -198,13 +192,9 @@ GEN_SUBTARGETS
198192

199193
extern "C" bool LLVMRustHasFeature(LLVMTargetMachineRef TM,
200194
const char *Feature) {
201-
#if LLVM_VERSION_GE(6, 0)
202195
TargetMachine *Target = unwrap(TM);
203196
const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo();
204197
return MCInfo->checkFeatures(std::string("+") + Feature);
205-
#else
206-
return false;
207-
#endif
208198
}
209199

210200
enum class LLVMRustCodeModel {
@@ -392,13 +382,9 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
392382
Options.ThreadModel = ThreadModel::Single;
393383
}
394384

395-
#if LLVM_VERSION_GE(6, 0)
396385
Options.EmitStackSizeSection = EmitStackSizeSection;
397386

398387
Optional<CodeModel::Model> CM;
399-
#else
400-
CodeModel::Model CM = CodeModel::Model::Default;
401-
#endif
402388
if (RustCM != LLVMRustCodeModel::None)
403389
CM = fromRust(RustCM);
404390
TargetMachine *TM = TheTarget->createTargetMachine(

src/rustllvm/RustWrapper.cpp

-15
Original file line numberDiff line numberDiff line change
@@ -297,11 +297,7 @@ extern "C" void LLVMRustRemoveFunctionAttributes(LLVMValueRef Fn,
297297
// enable fpmath flag UnsafeAlgebra
298298
extern "C" void LLVMRustSetHasUnsafeAlgebra(LLVMValueRef V) {
299299
if (auto I = dyn_cast<Instruction>(unwrap<Value>(V))) {
300-
#if LLVM_VERSION_GE(6, 0)
301300
I->setFast(true);
302-
#else
303-
I->setHasUnsafeAlgebra(true);
304-
#endif
305301
}
306302
}
307303

@@ -1437,7 +1433,6 @@ LLVMRustBuildVectorReduceFMax(LLVMBuilderRef B, LLVMValueRef Src, bool NoNaN) {
14371433
return wrap(unwrap(B)->CreateFPMaxReduce(unwrap(Src), NoNaN));
14381434
}
14391435

1440-
#if LLVM_VERSION_GE(6, 0)
14411436
extern "C" LLVMValueRef
14421437
LLVMRustBuildMinNum(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS) {
14431438
return wrap(unwrap(B)->CreateMinNum(unwrap(LHS),unwrap(RHS)));
@@ -1446,13 +1441,3 @@ extern "C" LLVMValueRef
14461441
LLVMRustBuildMaxNum(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS) {
14471442
return wrap(unwrap(B)->CreateMaxNum(unwrap(LHS),unwrap(RHS)));
14481443
}
1449-
#else
1450-
extern "C" LLVMValueRef
1451-
LLVMRustBuildMinNum(LLVMBuilderRef, LLVMValueRef, LLVMValueRef) {
1452-
return nullptr;
1453-
}
1454-
extern "C" LLVMValueRef
1455-
LLVMRustBuildMaxNum(LLVMBuilderRef, LLVMValueRef, LLVMValueRef) {
1456-
return nullptr;
1457-
}
1458-
#endif

src/test/codegen/function-arguments.rs

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
// compile-flags: -C no-prepopulate-passes
1212
// ignore-tidy-linelength
13-
// min-llvm-version 6.0
1413

1514
#![crate_type = "lib"]
1615
#![feature(custom_attribute)]

src/test/codegen/issue-44056-macos-tls-align.rs

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
// ignore-tidy-linelength
1212
// only-macos
1313
// no-system-llvm
14-
// min-llvm-version 6.0
1514
// compile-flags: -O
1615

1716
#![crate_type = "rlib"]

src/test/codegen/issue-45222.rs

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
// except according to those terms.
1010

1111
// compile-flags: -O
12-
// min-llvm-version 6.0
1312

1413
#![crate_type = "lib"]
1514

src/test/codegen/issue-45466.rs

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
// except according to those terms.
1010

1111
// compile-flags: -O
12-
// min-llvm-version 6.0
1312

1413
#![crate_type="rlib"]
1514

src/test/codegen/simd-intrinsic-generic-gather.rs

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
// ignore-emscripten
1212
// ignore-tidy-linelength
13-
// min-llvm-version 6.0
1413

1514
// compile-flags: -C no-prepopulate-passes
1615

src/test/codegen/simd-intrinsic-generic-scatter.rs

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
// ignore-emscripten
1212
// ignore-tidy-linelength
13-
// min-llvm-version 6.0
1413

1514
// compile-flags: -C no-prepopulate-passes
1615

src/test/codegen/vtabletype.rs

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
// ignore-tidy-linelength
1515
// ignore-windows
1616
// ignore-macos
17-
// min-llvm-version 6.0
1817

1918
// compile-flags: -g -C no-prepopulate-passes
2019

src/test/run-pass/simd/simd-intrinsic-generic-gather.rs

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
// run-pass
1212
// ignore-emscripten
13-
// min-llvm-version 6.0
1413

1514
// Test that the simd_{gather,scatter} intrinsics produce the correct results.
1615

src/test/run-pass/sse2.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![allow(stable_features)]
12-
// min-llvm-version 6.0
13-
// ^ needs MCSubtargetInfo::checkFeatures()
1411
// ignore-cloudabi no std::env
1512

13+
#![allow(stable_features)]
1614
#![feature(cfg_target_feature)]
1715

1816
use std::env;

src/test/ui/target-feature-gate.rs

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
// gate-test-mips_target_feature
2525
// gate-test-mmx_target_feature
2626
// gate-test-wasm_target_feature
27-
// min-llvm-version 6.0
2827

2928
#[target_feature(enable = "avx512bw")]
3029
//~^ ERROR: currently unstable

src/test/ui/target-feature-gate.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0658]: the target feature `avx512bw` is currently unstable (see issue #44839)
2-
--> $DIR/target-feature-gate.rs:29:18
2+
--> $DIR/target-feature-gate.rs:28:18
33
|
44
LL | #[target_feature(enable = "avx512bw")]
55
| ^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)