Skip to content

Commit 806563d

Browse files
authored
Rollup merge of rust-lang#90062 - cuviper:min-llvm-11, r=nikic
Update the minimum external LLVM to 11 With this change, we'll have stable support for LLVM 11..=13. For reference, the previous increase to LLVM 10 was rust-lang#83387. r? `@nagisa` `@nikic`
2 parents a2fdf8e + 5a87d1a commit 806563d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+49
-188
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-10
46+
- name: x86_64-gnu-llvm-11
4747
os: ubuntu-latest-xl
4848
env: {}
4949
- name: x86_64-gnu-tools
@@ -274,7 +274,7 @@ jobs:
274274
- name: x86_64-gnu-distcheck
275275
os: ubuntu-latest-xl
276276
env: {}
277-
- name: x86_64-gnu-llvm-10
277+
- name: x86_64-gnu-llvm-11
278278
env:
279279
RUST_BACKTRACE: 1
280280
os: ubuntu-latest-xl

compiler/rustc_codegen_llvm/src/llvm_util.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ unsafe fn configure_llvm(sess: &Session) {
9595
// Ref:
9696
// - https://github.com/rust-lang/rust/issues/85351
9797
// - https://reviews.llvm.org/D103167
98-
let llvm_version = llvm_util::get_version();
99-
if llvm_version >= (11, 0, 0) && llvm_version < (13, 0, 0) {
98+
if llvm_util::get_version() < (13, 0, 0) {
10099
add("-enable-machine-outliner=never", false);
101100
}
102101

compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp

-7
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,7 @@ extern "C" void LLVMRustCoverageWriteMapSectionNameToString(LLVMModuleRef M,
9898

9999
extern "C" void LLVMRustCoverageWriteFuncSectionNameToString(LLVMModuleRef M,
100100
RustStringRef Str) {
101-
#if LLVM_VERSION_GE(11, 0)
102101
WriteSectionNameToString(M, IPSK_covfun, Str);
103-
// else do nothing; the `Version` check will abort codegen on the Rust side
104-
#endif
105102
}
106103

107104
extern "C" void LLVMRustCoverageWriteMappingVarNameToString(RustStringRef Str) {
@@ -111,9 +108,5 @@ extern "C" void LLVMRustCoverageWriteMappingVarNameToString(RustStringRef Str) {
111108
}
112109

113110
extern "C" uint32_t LLVMRustCoverageMappingVersion() {
114-
#if LLVM_VERSION_GE(11, 0)
115111
return coverage::CovMapVersion::Version4;
116-
#else
117-
return coverage::CovMapVersion::Version3;
118-
#endif
119112
}

compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp

-93
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,6 @@ typedef struct LLVMOpaqueTargetMachine *LLVMTargetMachineRef;
5454

5555
DEFINE_STDCXX_CONVERSION_FUNCTIONS(Pass, LLVMPassRef)
5656
DEFINE_STDCXX_CONVERSION_FUNCTIONS(TargetMachine, LLVMTargetMachineRef)
57-
#if LLVM_VERSION_LT(11, 0)
58-
DEFINE_STDCXX_CONVERSION_FUNCTIONS(PassManagerBuilder,
59-
LLVMPassManagerBuilderRef)
60-
#endif
6157

6258
extern "C" void LLVMInitializePasses() {
6359
PassRegistry &Registry = *PassRegistry::getPassRegistry();
@@ -857,13 +853,8 @@ LLVMRustOptimizeWithNewPassManager(
857853
// PassBuilder does not create a pipeline.
858854
std::vector<std::function<void(ModulePassManager &, OptimizationLevel)>>
859855
PipelineStartEPCallbacks;
860-
#if LLVM_VERSION_GE(11, 0)
861856
std::vector<std::function<void(ModulePassManager &, OptimizationLevel)>>
862857
OptimizerLastEPCallbacks;
863-
#else
864-
std::vector<std::function<void(FunctionPassManager &, OptimizationLevel)>>
865-
OptimizerLastEPCallbacks;
866-
#endif
867858

868859
if (VerifyIR) {
869860
PipelineStartEPCallbacks.push_back(
@@ -896,7 +887,6 @@ LLVMRustOptimizeWithNewPassManager(
896887
SanitizerOptions->SanitizeMemoryTrackOrigins,
897888
SanitizerOptions->SanitizeMemoryRecover,
898889
/*CompileKernel=*/false);
899-
#if LLVM_VERSION_GE(11, 0)
900890
OptimizerLastEPCallbacks.push_back(
901891
[Options](ModulePassManager &MPM, OptimizationLevel Level) {
902892
#if LLVM_VERSION_GE(14, 0)
@@ -907,22 +897,9 @@ LLVMRustOptimizeWithNewPassManager(
907897
MPM.addPass(createModuleToFunctionPassAdaptor(MemorySanitizerPass(Options)));
908898
}
909899
);
910-
#else
911-
PipelineStartEPCallbacks.push_back(
912-
[Options](ModulePassManager &MPM, OptimizationLevel Level) {
913-
MPM.addPass(MemorySanitizerPass(Options));
914-
}
915-
);
916-
OptimizerLastEPCallbacks.push_back(
917-
[Options](FunctionPassManager &FPM, OptimizationLevel Level) {
918-
FPM.addPass(MemorySanitizerPass(Options));
919-
}
920-
);
921-
#endif
922900
}
923901

924902
if (SanitizerOptions->SanitizeThread) {
925-
#if LLVM_VERSION_GE(11, 0)
926903
OptimizerLastEPCallbacks.push_back(
927904
[](ModulePassManager &MPM, OptimizationLevel Level) {
928905
#if LLVM_VERSION_GE(14, 0)
@@ -933,22 +910,9 @@ LLVMRustOptimizeWithNewPassManager(
933910
MPM.addPass(createModuleToFunctionPassAdaptor(ThreadSanitizerPass()));
934911
}
935912
);
936-
#else
937-
PipelineStartEPCallbacks.push_back(
938-
[](ModulePassManager &MPM, OptimizationLevel Level) {
939-
MPM.addPass(ThreadSanitizerPass());
940-
}
941-
);
942-
OptimizerLastEPCallbacks.push_back(
943-
[](FunctionPassManager &FPM, OptimizationLevel Level) {
944-
FPM.addPass(ThreadSanitizerPass());
945-
}
946-
);
947-
#endif
948913
}
949914

950915
if (SanitizerOptions->SanitizeAddress) {
951-
#if LLVM_VERSION_GE(11, 0)
952916
OptimizerLastEPCallbacks.push_back(
953917
[SanitizerOptions](ModulePassManager &MPM, OptimizationLevel Level) {
954918
MPM.addPass(RequireAnalysisPass<ASanGlobalsMetadataAnalysis, Module>());
@@ -967,29 +931,8 @@ LLVMRustOptimizeWithNewPassManager(
967931
#endif
968932
}
969933
);
970-
#else
971-
PipelineStartEPCallbacks.push_back(
972-
[&](ModulePassManager &MPM, OptimizationLevel Level) {
973-
MPM.addPass(RequireAnalysisPass<ASanGlobalsMetadataAnalysis, Module>());
974-
}
975-
);
976-
OptimizerLastEPCallbacks.push_back(
977-
[SanitizerOptions](FunctionPassManager &FPM, OptimizationLevel Level) {
978-
FPM.addPass(AddressSanitizerPass(
979-
/*CompileKernel=*/false, SanitizerOptions->SanitizeAddressRecover,
980-
/*UseAfterScope=*/true));
981-
}
982-
);
983-
PipelineStartEPCallbacks.push_back(
984-
[SanitizerOptions](ModulePassManager &MPM, OptimizationLevel Level) {
985-
MPM.addPass(ModuleAddressSanitizerPass(
986-
/*CompileKernel=*/false, SanitizerOptions->SanitizeAddressRecover));
987-
}
988-
);
989-
#endif
990934
}
991935
if (SanitizerOptions->SanitizeHWAddress) {
992-
#if LLVM_VERSION_GE(11, 0)
993936
OptimizerLastEPCallbacks.push_back(
994937
[SanitizerOptions](ModulePassManager &MPM, OptimizationLevel Level) {
995938
#if LLVM_VERSION_GE(14, 0)
@@ -1003,14 +946,6 @@ LLVMRustOptimizeWithNewPassManager(
1003946
#endif
1004947
}
1005948
);
1006-
#else
1007-
PipelineStartEPCallbacks.push_back(
1008-
[SanitizerOptions](ModulePassManager &MPM, OptimizationLevel Level) {
1009-
MPM.addPass(HWAddressSanitizerPass(
1010-
/*CompileKernel=*/false, SanitizerOptions->SanitizeHWAddressRecover));
1011-
}
1012-
);
1013-
#endif
1014949
}
1015950
}
1016951

@@ -1037,17 +972,8 @@ LLVMRustOptimizeWithNewPassManager(
1037972
for (const auto &C : PipelineStartEPCallbacks)
1038973
C(MPM, OptLevel);
1039974

1040-
# if LLVM_VERSION_GE(11, 0)
1041975
for (const auto &C : OptimizerLastEPCallbacks)
1042976
C(MPM, OptLevel);
1043-
# else
1044-
if (!OptimizerLastEPCallbacks.empty()) {
1045-
FunctionPassManager FPM(DebugPassManager);
1046-
for (const auto &C : OptimizerLastEPCallbacks)
1047-
C(FPM, OptLevel);
1048-
MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM)));
1049-
}
1050-
# endif
1051977

1052978
MPM.addPass(AlwaysInlinerPass(EmitLifetimeMarkers));
1053979

@@ -1088,17 +1014,8 @@ LLVMRustOptimizeWithNewPassManager(
10881014
#else
10891015
MPM = PB.buildThinLTOPreLinkDefaultPipeline(OptLevel, DebugPassManager);
10901016
#endif
1091-
#if LLVM_VERSION_GE(11, 0)
10921017
for (const auto &C : OptimizerLastEPCallbacks)
10931018
C(MPM, OptLevel);
1094-
#else
1095-
if (!OptimizerLastEPCallbacks.empty()) {
1096-
FunctionPassManager FPM(DebugPassManager);
1097-
for (const auto &C : OptimizerLastEPCallbacks)
1098-
C(FPM, OptLevel);
1099-
MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM)));
1100-
}
1101-
#endif
11021019
break;
11031020
case LLVMRustOptStage::PreLinkFatLTO:
11041021
#if LLVM_VERSION_GE(12, 0)
@@ -1552,7 +1469,6 @@ LLVMRustFreeThinLTOData(LLVMRustThinLTOData *Data) {
15521469
// `ProcessThinLTOModule` function. Here they're split up into separate steps
15531470
// so rustc can save off the intermediate bytecode between each step.
15541471

1555-
#if LLVM_VERSION_GE(11, 0)
15561472
static bool
15571473
clearDSOLocalOnDeclarations(Module &Mod, TargetMachine &TM) {
15581474
// When linking an ELF shared object, dso_local should be dropped. We
@@ -1563,20 +1479,15 @@ clearDSOLocalOnDeclarations(Module &Mod, TargetMachine &TM) {
15631479
Mod.getPIELevel() == PIELevel::Default;
15641480
return ClearDSOLocalOnDeclarations;
15651481
}
1566-
#endif
15671482

15681483
extern "C" bool
15691484
LLVMRustPrepareThinLTORename(const LLVMRustThinLTOData *Data, LLVMModuleRef M,
15701485
LLVMTargetMachineRef TM) {
15711486
Module &Mod = *unwrap(M);
15721487
TargetMachine &Target = *unwrap(TM);
15731488

1574-
#if LLVM_VERSION_GE(11, 0)
15751489
bool ClearDSOLocal = clearDSOLocalOnDeclarations(Mod, Target);
15761490
bool error = renameModuleForThinLTO(Mod, Data->Index, ClearDSOLocal);
1577-
#else
1578-
bool error = renameModuleForThinLTO(Mod, Data->Index);
1579-
#endif
15801491

15811492
if (error) {
15821493
LLVMRustSetLastError("renameModuleForThinLTO failed");
@@ -1645,12 +1556,8 @@ LLVMRustPrepareThinLTOImport(const LLVMRustThinLTOData *Data, LLVMModuleRef M,
16451556

16461557
return MOrErr;
16471558
};
1648-
#if LLVM_VERSION_GE(11, 0)
16491559
bool ClearDSOLocal = clearDSOLocalOnDeclarations(Mod, Target);
16501560
FunctionImporter Importer(Data->Index, Loader, ClearDSOLocal);
1651-
#else
1652-
FunctionImporter Importer(Data->Index, Loader);
1653-
#endif
16541561
Expected<bool> Result = Importer.importFunctions(Mod, ImportList);
16551562
if (!Result) {
16561563
LLVMRustSetLastError(toString(Result.takeError()).c_str());

compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp

-14
Original file line numberDiff line numberDiff line change
@@ -681,10 +681,8 @@ static Optional<DIFile::ChecksumKind> fromRust(LLVMRustChecksumKind Kind) {
681681
return DIFile::ChecksumKind::CSK_MD5;
682682
case LLVMRustChecksumKind::SHA1:
683683
return DIFile::ChecksumKind::CSK_SHA1;
684-
#if (LLVM_VERSION_MAJOR >= 11)
685684
case LLVMRustChecksumKind::SHA256:
686685
return DIFile::ChecksumKind::CSK_SHA256;
687-
#endif
688686
default:
689687
report_fatal_error("bad ChecksumKind.");
690688
}
@@ -999,14 +997,9 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateUnionType(
999997
extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateTemplateTypeParameter(
1000998
LLVMRustDIBuilderRef Builder, LLVMMetadataRef Scope,
1001999
const char *Name, size_t NameLen, LLVMMetadataRef Ty) {
1002-
#if LLVM_VERSION_GE(11, 0)
10031000
bool IsDefault = false; // FIXME: should we ever set this true?
10041001
return wrap(Builder->createTemplateTypeParameter(
10051002
unwrapDI<DIDescriptor>(Scope), StringRef(Name, NameLen), unwrapDI<DIType>(Ty), IsDefault));
1006-
#else
1007-
return wrap(Builder->createTemplateTypeParameter(
1008-
unwrapDI<DIDescriptor>(Scope), StringRef(Name, NameLen), unwrapDI<DIType>(Ty)));
1009-
#endif
10101003
}
10111004

10121005
extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateNameSpace(
@@ -1246,23 +1239,16 @@ extern "C" LLVMTypeKind LLVMRustGetTypeKind(LLVMTypeRef Ty) {
12461239
return LLVMArrayTypeKind;
12471240
case Type::PointerTyID:
12481241
return LLVMPointerTypeKind;
1249-
#if LLVM_VERSION_GE(11, 0)
12501242
case Type::FixedVectorTyID:
12511243
return LLVMVectorTypeKind;
1252-
#else
1253-
case Type::VectorTyID:
1254-
return LLVMVectorTypeKind;
1255-
#endif
12561244
case Type::X86_MMXTyID:
12571245
return LLVMX86_MMXTypeKind;
12581246
case Type::TokenTyID:
12591247
return LLVMTokenTypeKind;
1260-
#if LLVM_VERSION_GE(11, 0)
12611248
case Type::ScalableVectorTyID:
12621249
return LLVMScalableVectorTypeKind;
12631250
case Type::BFloatTyID:
12641251
return LLVMBFloatTypeKind;
1265-
#endif
12661252
#if LLVM_VERSION_GE(12, 0)
12671253
case Type::X86_AMXTyID:
12681254
return LLVMX86_AMXTypeKind;

src/bootstrap/native.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -378,11 +378,11 @@ fn check_llvm_version(builder: &Builder<'_>, llvm_config: &Path) {
378378
let version = output(cmd.arg("--version"));
379379
let mut parts = version.split('.').take(2).filter_map(|s| s.parse::<u32>().ok());
380380
if let (Some(major), Some(_minor)) = (parts.next(), parts.next()) {
381-
if major >= 10 {
381+
if major >= 11 {
382382
return;
383383
}
384384
}
385-
panic!("\n\nbad LLVM version: {}, need >=10.0\n\n", version)
385+
panic!("\n\nbad LLVM version: {}, need >=11.0\n\n", version)
386386
}
387387

388388
fn configure_cmake(

src/ci/docker/host-x86_64/x86_64-gnu-llvm-10/Dockerfile src/ci/docker/host-x86_64/x86_64-gnu-llvm-11/Dockerfile

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
FROM ubuntu:18.04
1+
FROM ubuntu:20.04
22

3+
ARG DEBIAN_FRONTEND=noninteractive
34
RUN apt-get update && apt-get install -y --no-install-recommends \
45
g++ \
56
gcc-multilib \
@@ -13,8 +14,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
1314
cmake \
1415
sudo \
1516
gdb \
16-
llvm-10-tools \
17-
llvm-10-dev \
17+
llvm-11-tools \
18+
llvm-11-dev \
1819
libedit-dev \
1920
libssl-dev \
2021
pkg-config \
@@ -28,7 +29,7 @@ RUN sh /scripts/sccache.sh
2829
# using llvm-link-shared due to libffi issues -- see #34486
2930
ENV RUST_CONFIGURE_ARGS \
3031
--build=x86_64-unknown-linux-gnu \
31-
--llvm-root=/usr/lib/llvm-10 \
32+
--llvm-root=/usr/lib/llvm-11 \
3233
--enable-llvm-link-shared \
3334
--set rust.thin-lto-import-instr-limit=10
3435

src/ci/github-actions/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ jobs:
284284
- name: mingw-check
285285
<<: *job-linux-xl
286286

287-
- name: x86_64-gnu-llvm-10
287+
- name: x86_64-gnu-llvm-11
288288
<<: *job-linux-xl
289289

290290
- name: x86_64-gnu-tools
@@ -431,7 +431,7 @@ jobs:
431431
- name: x86_64-gnu-distcheck
432432
<<: *job-linux-xl
433433

434-
- name: x86_64-gnu-llvm-10
434+
- name: x86_64-gnu-llvm-11
435435
env:
436436
RUST_BACKTRACE: 1
437437
<<: *job-linux-xl

src/test/assembly/asm/aarch64-modifiers.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// min-llvm-version: 10.0.1
21
// assembly-output: emit-asm
32
// compile-flags: -O
43
// compile-flags: --target aarch64-unknown-linux-gnu

src/test/assembly/asm/aarch64-types.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// min-llvm-version: 10.0.1
21
// assembly-output: emit-asm
32
// compile-flags: --target aarch64-unknown-linux-gnu
43
// needs-llvm-components: aarch64

src/test/assembly/asm/arm-modifiers.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// min-llvm-version: 10.0.1
21
// assembly-output: emit-asm
32
// compile-flags: -O
43
// compile-flags: --target armv7-unknown-linux-gnueabihf

src/test/assembly/asm/arm-types.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// min-llvm-version: 10.0.1
21
// assembly-output: emit-asm
32
// compile-flags: --target armv7-unknown-linux-gnueabihf
43
// compile-flags: -C target-feature=+neon

src/test/assembly/asm/global_asm.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// min-llvm-version: 10.0.1
21
// only-x86_64
32
// assembly-output: emit-asm
43
// compile-flags: -C llvm-args=--x86-asm-syntax=intel

src/test/assembly/asm/hexagon-types.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// min-llvm-version: 10.0.1
21
// assembly-output: emit-asm
32
// compile-flags: --target hexagon-unknown-linux-musl
43
// needs-llvm-components: hexagon

src/test/assembly/asm/mips-types.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// min-llvm-version: 10.0.1
21
// revisions: mips32 mips64
32
// assembly-output: emit-asm
43
//[mips32] compile-flags: --target mips-unknown-linux-gnu

0 commit comments

Comments
 (0)