Skip to content

Commit 7d872f5

Browse files
committedMar 22, 2021
Update the minimum external LLVM to 10
1 parent d04c3aa commit 7d872f5

File tree

14 files changed

+15
-116
lines changed

14 files changed

+15
-116
lines changed
 

‎.github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
- name: mingw-check
4444
os: ubuntu-latest-xl
4545
env: {}
46-
- name: x86_64-gnu-llvm-9
46+
- name: x86_64-gnu-llvm-10
4747
os: ubuntu-latest-xl
4848
env: {}
4949
- name: x86_64-gnu-tools
@@ -265,7 +265,7 @@ jobs:
265265
- name: x86_64-gnu-distcheck
266266
os: ubuntu-latest-xl
267267
env: {}
268-
- name: x86_64-gnu-llvm-9
268+
- name: x86_64-gnu-llvm-10
269269
env:
270270
RUST_BACKTRACE: 1
271271
os: ubuntu-latest-xl

‎compiler/rustc_codegen_llvm/src/context.rs

-9
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,6 @@ fn to_llvm_tls_model(tls_model: TlsModel) -> llvm::ThreadLocalMode {
101101
}
102102
}
103103

104-
fn strip_x86_address_spaces(data_layout: String) -> String {
105-
data_layout.replace("-p270:32:32-p271:32:32-p272:64:64-", "-")
106-
}
107-
108104
fn strip_powerpc64_vectors(data_layout: String) -> String {
109105
data_layout.replace("-v256:256:256-v512:512:512", "")
110106
}
@@ -119,11 +115,6 @@ pub unsafe fn create_module(
119115
let llmod = llvm::LLVMModuleCreateWithNameInContext(mod_name.as_ptr(), llcx);
120116

121117
let mut target_data_layout = sess.target.data_layout.clone();
122-
if llvm_util::get_version() < (10, 0, 0)
123-
&& (sess.target.arch == "x86" || sess.target.arch == "x86_64")
124-
{
125-
target_data_layout = strip_x86_address_spaces(target_data_layout);
126-
}
127118
if llvm_util::get_version() < (12, 0, 0) && sess.target.arch == "powerpc64" {
128119
target_data_layout = strip_powerpc64_vectors(target_data_layout);
129120
}

‎compiler/rustc_llvm/llvm-wrapper/ArchiveWrapper.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,7 @@ extern "C" void LLVMRustDestroyArchive(LLVMRustArchiveRef RustArchive) {
9191
extern "C" LLVMRustArchiveIteratorRef
9292
LLVMRustArchiveIteratorNew(LLVMRustArchiveRef RustArchive) {
9393
Archive *Archive = RustArchive->getBinary();
94-
#if LLVM_VERSION_GE(10, 0)
9594
std::unique_ptr<Error> Err = std::make_unique<Error>(Error::success());
96-
#else
97-
std::unique_ptr<Error> Err = llvm::make_unique<Error>(Error::success());
98-
#endif
9995
auto Cur = Archive->child_begin(*Err);
10096
if (*Err) {
10197
LLVMRustSetLastError(toString(std::move(*Err)).c_str());

‎compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp

-41
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,9 @@ extern "C" void LLVMInitializePasses() {
6565
}
6666

6767
extern "C" void LLVMTimeTraceProfilerInitialize() {
68-
#if LLVM_VERSION_GE(10, 0)
6968
timeTraceProfilerInitialize(
7069
/* TimeTraceGranularity */ 0,
7170
/* ProcName */ "rustc");
72-
#else
73-
timeTraceProfilerInitialize();
74-
#endif
7571
}
7672

7773
extern "C" void LLVMTimeTraceProfilerFinish(const char* FileName) {
@@ -596,7 +592,6 @@ enum class LLVMRustFileType {
596592
ObjectFile,
597593
};
598594

599-
#if LLVM_VERSION_GE(10, 0)
600595
static CodeGenFileType fromRust(LLVMRustFileType Type) {
601596
switch (Type) {
602597
case LLVMRustFileType::AssemblyFile:
@@ -607,18 +602,6 @@ static CodeGenFileType fromRust(LLVMRustFileType Type) {
607602
report_fatal_error("Bad FileType.");
608603
}
609604
}
610-
#else
611-
static TargetMachine::CodeGenFileType fromRust(LLVMRustFileType Type) {
612-
switch (Type) {
613-
case LLVMRustFileType::AssemblyFile:
614-
return TargetMachine::CGFT_AssemblyFile;
615-
case LLVMRustFileType::ObjectFile:
616-
return TargetMachine::CGFT_ObjectFile;
617-
default:
618-
report_fatal_error("Bad FileType.");
619-
}
620-
}
621-
#endif
622605

623606
extern "C" LLVMRustResult
624607
LLVMRustWriteOutputFile(LLVMTargetMachineRef Target, LLVMPassManagerRef PMR,
@@ -868,13 +851,11 @@ LLVMRustOptimizeWithNewPassManager(
868851
}
869852
);
870853
#else
871-
#if LLVM_VERSION_GE(10, 0)
872854
PipelineStartEPCallbacks.push_back(
873855
[Options](ModulePassManager &MPM, PassBuilder::OptimizationLevel Level) {
874856
MPM.addPass(MemorySanitizerPass(Options));
875857
}
876858
);
877-
#endif
878859
OptimizerLastEPCallbacks.push_back(
879860
[Options](FunctionPassManager &FPM, PassBuilder::OptimizationLevel Level) {
880861
FPM.addPass(MemorySanitizerPass(Options));
@@ -892,13 +873,11 @@ LLVMRustOptimizeWithNewPassManager(
892873
}
893874
);
894875
#else
895-
#if LLVM_VERSION_GE(10, 0)
896876
PipelineStartEPCallbacks.push_back(
897877
[](ModulePassManager &MPM, PassBuilder::OptimizationLevel Level) {
898878
MPM.addPass(ThreadSanitizerPass());
899879
}
900880
);
901-
#endif
902881
OptimizerLastEPCallbacks.push_back(
903882
[](FunctionPassManager &FPM, PassBuilder::OptimizationLevel Level) {
904883
FPM.addPass(ThreadSanitizerPass());
@@ -989,13 +968,11 @@ LLVMRustOptimizeWithNewPassManager(
989968

990969
MPM.addPass(AlwaysInlinerPass(EmitLifetimeMarkers));
991970

992-
# if LLVM_VERSION_GE(10, 0)
993971
if (PGOOpt) {
994972
PB.addPGOInstrPassesForO0(
995973
MPM, DebugPassManager, PGOOpt->Action == PGOOptions::IRInstr,
996974
/*IsCS=*/false, PGOOpt->ProfileFile, PGOOpt->ProfileRemappingFile);
997975
}
998-
# endif
999976
#endif
1000977
} else {
1001978
#if LLVM_VERSION_GE(12, 0)
@@ -1366,11 +1343,7 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules,
13661343
int num_modules,
13671344
const char **preserved_symbols,
13681345
int num_symbols) {
1369-
#if LLVM_VERSION_GE(10, 0)
13701346
auto Ret = std::make_unique<LLVMRustThinLTOData>();
1371-
#else
1372-
auto Ret = llvm::make_unique<LLVMRustThinLTOData>();
1373-
#endif
13741347

13751348
// Load each module's summary and merge it into one combined index
13761349
for (int i = 0; i < num_modules; i++) {
@@ -1455,23 +1428,13 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules,
14551428
ExportedGUIDs.insert(GUID);
14561429
}
14571430
}
1458-
#if LLVM_VERSION_GE(10, 0)
14591431
auto isExported = [&](StringRef ModuleIdentifier, ValueInfo VI) {
14601432
const auto &ExportList = Ret->ExportLists.find(ModuleIdentifier);
14611433
return (ExportList != Ret->ExportLists.end() &&
14621434
ExportList->second.count(VI)) ||
14631435
ExportedGUIDs.count(VI.getGUID());
14641436
};
14651437
thinLTOInternalizeAndPromoteInIndex(Ret->Index, isExported, isPrevailing);
1466-
#else
1467-
auto isExported = [&](StringRef ModuleIdentifier, GlobalValue::GUID GUID) {
1468-
const auto &ExportList = Ret->ExportLists.find(ModuleIdentifier);
1469-
return (ExportList != Ret->ExportLists.end() &&
1470-
ExportList->second.count(GUID)) ||
1471-
ExportedGUIDs.count(GUID);
1472-
};
1473-
thinLTOInternalizeAndPromoteInIndex(Ret->Index, isExported);
1474-
#endif
14751438

14761439
return Ret.release();
14771440
}
@@ -1628,11 +1591,7 @@ struct LLVMRustThinLTOBuffer {
16281591

16291592
extern "C" LLVMRustThinLTOBuffer*
16301593
LLVMRustThinLTOBufferCreate(LLVMModuleRef M) {
1631-
#if LLVM_VERSION_GE(10, 0)
16321594
auto Ret = std::make_unique<LLVMRustThinLTOBuffer>();
1633-
#else
1634-
auto Ret = llvm::make_unique<LLVMRustThinLTOBuffer>();
1635-
#endif
16361595
{
16371596
raw_string_ostream OS(Ret->data);
16381597
{

‎compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp

-38
Original file line numberDiff line numberDiff line change
@@ -532,11 +532,6 @@ static DINode::DIFlags fromRust(LLVMRustDIFlags Flags) {
532532
if (isSet(Flags & LLVMRustDIFlags::FlagAppleBlock)) {
533533
Result |= DINode::DIFlags::FlagAppleBlock;
534534
}
535-
#if LLVM_VERSION_LT(10, 0)
536-
if (isSet(Flags & LLVMRustDIFlags::FlagBlockByrefStruct)) {
537-
Result |= DINode::DIFlags::FlagBlockByrefStruct;
538-
}
539-
#endif
540535
if (isSet(Flags & LLVMRustDIFlags::FlagVirtual)) {
541536
Result |= DINode::DIFlags::FlagVirtual;
542537
}
@@ -901,9 +896,7 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateStaticVariable(
901896
unwrapDI<DIDescriptor>(Context), StringRef(Name, NameLen),
902897
StringRef(LinkageName, LinkageNameLen),
903898
unwrapDI<DIFile>(File), LineNo, unwrapDI<DIType>(Ty), IsLocalToUnit,
904-
#if LLVM_VERSION_GE(10, 0)
905899
/* isDefined */ true,
906-
#endif
907900
InitExpr, unwrapDIPtr<MDNode>(Decl),
908901
/* templateParams */ nullptr,
909902
AlignInBits);
@@ -1090,19 +1083,11 @@ inline section_iterator *unwrap(LLVMSectionIteratorRef SI) {
10901083

10911084
extern "C" size_t LLVMRustGetSectionName(LLVMSectionIteratorRef SI,
10921085
const char **Ptr) {
1093-
#if LLVM_VERSION_GE(10, 0)
10941086
auto NameOrErr = (*unwrap(SI))->getName();
10951087
if (!NameOrErr)
10961088
report_fatal_error(NameOrErr.takeError());
10971089
*Ptr = NameOrErr->data();
10981090
return NameOrErr->size();
1099-
#else
1100-
StringRef Ret;
1101-
if (std::error_code EC = (*unwrap(SI))->getName(Ret))
1102-
report_fatal_error(EC.message());
1103-
*Ptr = Ret.data();
1104-
return Ret.size();
1105-
#endif
11061091
}
11071092

11081093
// LLVMArrayType function does not support 64-bit ElementCount
@@ -1441,47 +1426,28 @@ extern "C" LLVMValueRef LLVMRustBuildMemCpy(LLVMBuilderRef B,
14411426
LLVMValueRef Dst, unsigned DstAlign,
14421427
LLVMValueRef Src, unsigned SrcAlign,
14431428
LLVMValueRef Size, bool IsVolatile) {
1444-
#if LLVM_VERSION_GE(10, 0)
14451429
return wrap(unwrap(B)->CreateMemCpy(
14461430
unwrap(Dst), MaybeAlign(DstAlign),
14471431
unwrap(Src), MaybeAlign(SrcAlign),
14481432
unwrap(Size), IsVolatile));
1449-
#else
1450-
return wrap(unwrap(B)->CreateMemCpy(
1451-
unwrap(Dst), DstAlign,
1452-
unwrap(Src), SrcAlign,
1453-
unwrap(Size), IsVolatile));
1454-
#endif
14551433
}
14561434

14571435
extern "C" LLVMValueRef LLVMRustBuildMemMove(LLVMBuilderRef B,
14581436
LLVMValueRef Dst, unsigned DstAlign,
14591437
LLVMValueRef Src, unsigned SrcAlign,
14601438
LLVMValueRef Size, bool IsVolatile) {
1461-
#if LLVM_VERSION_GE(10, 0)
14621439
return wrap(unwrap(B)->CreateMemMove(
14631440
unwrap(Dst), MaybeAlign(DstAlign),
14641441
unwrap(Src), MaybeAlign(SrcAlign),
14651442
unwrap(Size), IsVolatile));
1466-
#else
1467-
return wrap(unwrap(B)->CreateMemMove(
1468-
unwrap(Dst), DstAlign,
1469-
unwrap(Src), SrcAlign,
1470-
unwrap(Size), IsVolatile));
1471-
#endif
14721443
}
14731444

14741445
extern "C" LLVMValueRef LLVMRustBuildMemSet(LLVMBuilderRef B,
14751446
LLVMValueRef Dst, unsigned DstAlign,
14761447
LLVMValueRef Val,
14771448
LLVMValueRef Size, bool IsVolatile) {
1478-
#if LLVM_VERSION_GE(10, 0)
14791449
return wrap(unwrap(B)->CreateMemSet(
14801450
unwrap(Dst), unwrap(Val), unwrap(Size), MaybeAlign(DstAlign), IsVolatile));
1481-
#else
1482-
return wrap(unwrap(B)->CreateMemSet(
1483-
unwrap(Dst), unwrap(Val), unwrap(Size), DstAlign, IsVolatile));
1484-
#endif
14851451
}
14861452

14871453
extern "C" LLVMValueRef
@@ -1667,11 +1633,7 @@ struct LLVMRustModuleBuffer {
16671633

16681634
extern "C" LLVMRustModuleBuffer*
16691635
LLVMRustModuleBufferCreate(LLVMModuleRef M) {
1670-
#if LLVM_VERSION_GE(10, 0)
16711636
auto Ret = std::make_unique<LLVMRustModuleBuffer>();
1672-
#else
1673-
auto Ret = llvm::make_unique<LLVMRustModuleBuffer>();
1674-
#endif
16751637
{
16761638
raw_string_ostream OS(Ret->data);
16771639
{

‎library/core/src/num/dec2flt/algorithm.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ mod fpu_precision {
6464
asm!(
6565
"fldcw ({})",
6666
in(reg) &cw,
67-
// FIXME: We are using ATT syntax to support LLVM 8 and LLVM 9.
68-
options(att_syntax, nostack),
67+
options(nostack),
6968
)
7069
}
7170
}
@@ -89,8 +88,7 @@ mod fpu_precision {
8988
asm!(
9089
"fnstcw ({})",
9190
in(reg) &mut cw,
92-
// FIXME: We are using ATT syntax to support LLVM 8 and LLVM 9.
93-
options(att_syntax, nostack),
91+
options(nostack),
9492
)
9593
}
9694

‎library/profiler_builtins/build.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,11 @@ fn main() {
2424
"InstrProfilingPlatformLinux.c",
2525
"InstrProfilingPlatformOther.c",
2626
"InstrProfilingPlatformWindows.c",
27+
"InstrProfilingRuntime.cpp",
2728
"InstrProfilingUtil.c",
2829
"InstrProfilingValue.c",
2930
"InstrProfilingVersionVar.c",
3031
"InstrProfilingWriter.c",
31-
// This file was renamed in LLVM 10.
32-
"InstrProfilingRuntime.cc",
33-
"InstrProfilingRuntime.cpp",
3432
// These files were added in LLVM 11.
3533
"InstrProfilingInternal.c",
3634
"InstrProfilingBiasVar.c",

‎library/std/src/sys/sgx/abi/mem.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ pub fn image_base() -> u64 {
3838
asm!(
3939
"lea IMAGE_BASE(%rip), {}",
4040
lateout(reg) base,
41-
// NOTE(#76738): ATT syntax is used to support LLVM 8 and 9.
42-
options(att_syntax, nostack, preserves_flags, nomem, pure),
41+
options(nostack, preserves_flags, nomem, pure),
4342
)
4443
};
4544
base

‎library/std/src/sys/sgx/ext/arch.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ pub fn egetkey(request: &Align512<[u8; 512]>) -> Result<Align16<[u8; 16]>, u32>
3636
inlateout("eax") ENCLU_EGETKEY => error,
3737
in("rbx") request,
3838
in("rcx") out.as_mut_ptr(),
39-
// NOTE(#76738): ATT syntax is used to support LLVM 8 and 9.
40-
options(att_syntax, nostack),
39+
options(nostack),
4140
);
4241

4342
match error {
@@ -66,8 +65,7 @@ pub fn ereport(
6665
in("rbx") targetinfo,
6766
in("rcx") reportdata,
6867
in("rdx") report.as_mut_ptr(),
69-
// NOTE(#76738): ATT syntax is used to support LLVM 8 and 9.
70-
options(att_syntax, preserves_flags, nostack),
68+
options(preserves_flags, nostack),
7169
);
7270

7371
report.assume_init()

‎src/bootstrap/native.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -347,11 +347,11 @@ fn check_llvm_version(builder: &Builder<'_>, llvm_config: &Path) {
347347
let version = output(cmd.arg("--version"));
348348
let mut parts = version.split('.').take(2).filter_map(|s| s.parse::<u32>().ok());
349349
if let (Some(major), Some(_minor)) = (parts.next(), parts.next()) {
350-
if major >= 9 {
350+
if major >= 10 {
351351
return;
352352
}
353353
}
354-
panic!("\n\nbad LLVM version: {}, need >=9.0\n\n", version)
354+
panic!("\n\nbad LLVM version: {}, need >=10.0\n\n", version)
355355
}
356356

357357
fn configure_cmake(

‎src/ci/docker/host-x86_64/x86_64-gnu-llvm-9/Dockerfile ‎src/ci/docker/host-x86_64/x86_64-gnu-llvm-10/Dockerfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
1313
cmake \
1414
sudo \
1515
gdb \
16-
llvm-9-tools \
17-
llvm-9-dev \
16+
llvm-10-tools \
17+
llvm-10-dev \
1818
libedit-dev \
1919
libssl-dev \
2020
pkg-config \
@@ -28,7 +28,7 @@ RUN sh /scripts/sccache.sh
2828
# using llvm-link-shared due to libffi issues -- see #34486
2929
ENV RUST_CONFIGURE_ARGS \
3030
--build=x86_64-unknown-linux-gnu \
31-
--llvm-root=/usr/lib/llvm-9 \
31+
--llvm-root=/usr/lib/llvm-10 \
3232
--enable-llvm-link-shared \
3333
--set rust.thin-lto-import-instr-limit=10
3434

‎src/ci/github-actions/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ jobs:
280280
- name: mingw-check
281281
<<: *job-linux-xl
282282

283-
- name: x86_64-gnu-llvm-9
283+
- name: x86_64-gnu-llvm-10
284284
<<: *job-linux-xl
285285

286286
- name: x86_64-gnu-tools
@@ -412,7 +412,7 @@ jobs:
412412
- name: x86_64-gnu-distcheck
413413
<<: *job-linux-xl
414414

415-
- name: x86_64-gnu-llvm-9
415+
- name: x86_64-gnu-llvm-10
416416
env:
417417
RUST_BACKTRACE: 1
418418
<<: *job-linux-xl

‎src/test/codegen/simd-intrinsic/simd-intrinsic-transmute-array.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// ignore-tidy-linelength
22
// compile-flags: -C no-prepopulate-passes
3-
// min-llvm-version 8.0
43

54
#![crate_type = "lib"]
65

‎src/test/ui/simd/simd-intrinsic-generic-reduction.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#![allow(non_camel_case_types)]
33

44
// ignore-emscripten
5-
// min-system-llvm-version: 9.0
65

76
// Test that the simd_reduce_{op} intrinsics produce the correct results.
87

0 commit comments

Comments
 (0)
Please sign in to comment.