mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Update the minimum external LLVM to 12
This commit is contained in:
parent
8b0e7095a0
commit
e9f545b9a9
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@ -43,7 +43,7 @@ jobs:
|
||||
- name: mingw-check
|
||||
os: ubuntu-latest-xl
|
||||
env: {}
|
||||
- name: x86_64-gnu-llvm-11
|
||||
- name: x86_64-gnu-llvm-12
|
||||
os: ubuntu-latest-xl
|
||||
env: {}
|
||||
- name: x86_64-gnu-tools
|
||||
@ -274,7 +274,7 @@ jobs:
|
||||
- name: x86_64-gnu-distcheck
|
||||
os: ubuntu-latest-xl
|
||||
env: {}
|
||||
- name: x86_64-gnu-llvm-11
|
||||
- name: x86_64-gnu-llvm-12
|
||||
env:
|
||||
RUST_BACKTRACE: 1
|
||||
os: ubuntu-latest-xl
|
||||
|
@ -681,7 +681,6 @@ void LLVMSelfProfileInitializeCallbacks(
|
||||
PassInstrumentationCallbacks& PIC, void* LlvmSelfProfiler,
|
||||
LLVMRustSelfProfileBeforePassCallback BeforePassCallback,
|
||||
LLVMRustSelfProfileAfterPassCallback AfterPassCallback) {
|
||||
#if LLVM_VERSION_GE(12, 0)
|
||||
PIC.registerBeforeNonSkippedPassCallback([LlvmSelfProfiler, BeforePassCallback](
|
||||
StringRef Pass, llvm::Any Ir) {
|
||||
std::string PassName = Pass.str();
|
||||
@ -699,25 +698,6 @@ void LLVMSelfProfileInitializeCallbacks(
|
||||
[LlvmSelfProfiler, AfterPassCallback](StringRef Pass, const PreservedAnalyses &Preserved) {
|
||||
AfterPassCallback(LlvmSelfProfiler);
|
||||
});
|
||||
#else
|
||||
PIC.registerBeforePassCallback([LlvmSelfProfiler, BeforePassCallback](
|
||||
StringRef Pass, llvm::Any Ir) {
|
||||
std::string PassName = Pass.str();
|
||||
std::string IrName = LLVMRustwrappedIrGetName(Ir);
|
||||
BeforePassCallback(LlvmSelfProfiler, PassName.c_str(), IrName.c_str());
|
||||
return true;
|
||||
});
|
||||
|
||||
PIC.registerAfterPassCallback(
|
||||
[LlvmSelfProfiler, AfterPassCallback](StringRef Pass, llvm::Any Ir) {
|
||||
AfterPassCallback(LlvmSelfProfiler);
|
||||
});
|
||||
|
||||
PIC.registerAfterPassInvalidatedCallback(
|
||||
[LlvmSelfProfiler, AfterPassCallback](StringRef Pass) {
|
||||
AfterPassCallback(LlvmSelfProfiler);
|
||||
});
|
||||
#endif
|
||||
|
||||
PIC.registerBeforeAnalysisCallback([LlvmSelfProfiler, BeforePassCallback](
|
||||
StringRef Pass, llvm::Any Ir) {
|
||||
@ -778,22 +758,13 @@ LLVMRustOptimizeWithNewPassManager(
|
||||
PTO.LoopInterleaving = UnrollLoops;
|
||||
PTO.LoopVectorization = LoopVectorize;
|
||||
PTO.SLPVectorization = SLPVectorize;
|
||||
#if LLVM_VERSION_GE(12, 0)
|
||||
PTO.MergeFunctions = MergeFunctions;
|
||||
#else
|
||||
// MergeFunctions is not supported by NewPM in older LLVM versions.
|
||||
(void) MergeFunctions;
|
||||
#endif
|
||||
|
||||
// FIXME: We may want to expose this as an option.
|
||||
bool DebugPassManager = false;
|
||||
|
||||
PassInstrumentationCallbacks PIC;
|
||||
#if LLVM_VERSION_GE(12, 0)
|
||||
StandardInstrumentations SI(DebugPassManager);
|
||||
#else
|
||||
StandardInstrumentations SI;
|
||||
#endif
|
||||
SI.registerCallbacks(PIC);
|
||||
|
||||
if (LlvmSelfProfiler){
|
||||
@ -817,18 +788,14 @@ LLVMRustOptimizeWithNewPassManager(
|
||||
PGOOptions::NoCSAction, DebugInfoForProfiling);
|
||||
}
|
||||
|
||||
#if LLVM_VERSION_GE(12, 0) && !LLVM_VERSION_GE(13,0)
|
||||
PassBuilder PB(DebugPassManager, TM, PTO, PGOOpt, &PIC);
|
||||
#else
|
||||
PassBuilder PB(TM, PTO, PGOOpt, &PIC);
|
||||
#endif
|
||||
|
||||
#if LLVM_VERSION_GE(13, 0)
|
||||
PassBuilder PB(TM, PTO, PGOOpt, &PIC);
|
||||
LoopAnalysisManager LAM;
|
||||
FunctionAnalysisManager FAM;
|
||||
CGSCCAnalysisManager CGAM;
|
||||
ModuleAnalysisManager MAM;
|
||||
#else
|
||||
PassBuilder PB(DebugPassManager, TM, PTO, PGOOpt, &PIC);
|
||||
LoopAnalysisManager LAM(DebugPassManager);
|
||||
FunctionAnalysisManager FAM(DebugPassManager);
|
||||
CGSCCAnalysisManager CGAM(DebugPassManager);
|
||||
@ -960,7 +927,6 @@ LLVMRustOptimizeWithNewPassManager(
|
||||
// At the same time, the LTO pipelines do support O0 and using them is required.
|
||||
bool IsLTO = OptStage == LLVMRustOptStage::ThinLTO || OptStage == LLVMRustOptStage::FatLTO;
|
||||
if (OptLevel == OptimizationLevel::O0 && !IsLTO) {
|
||||
#if LLVM_VERSION_GE(12, 0)
|
||||
for (const auto &C : PipelineStartEPCallbacks)
|
||||
PB.registerPipelineStartEPCallback(C);
|
||||
for (const auto &C : OptimizerLastEPCallbacks)
|
||||
@ -968,31 +934,9 @@ LLVMRustOptimizeWithNewPassManager(
|
||||
|
||||
// Pass false as we manually schedule ThinLTOBufferPasses below.
|
||||
MPM = PB.buildO0DefaultPipeline(OptLevel, /* PreLinkLTO */ false);
|
||||
#else
|
||||
for (const auto &C : PipelineStartEPCallbacks)
|
||||
C(MPM, OptLevel);
|
||||
|
||||
for (const auto &C : OptimizerLastEPCallbacks)
|
||||
C(MPM, OptLevel);
|
||||
|
||||
MPM.addPass(AlwaysInlinerPass(EmitLifetimeMarkers));
|
||||
|
||||
if (PGOOpt) {
|
||||
PB.addPGOInstrPassesForO0(
|
||||
MPM, DebugPassManager, PGOOpt->Action == PGOOptions::IRInstr,
|
||||
/*IsCS=*/false, PGOOpt->ProfileFile, PGOOpt->ProfileRemappingFile);
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
#if LLVM_VERSION_GE(12, 0)
|
||||
for (const auto &C : PipelineStartEPCallbacks)
|
||||
PB.registerPipelineStartEPCallback(C);
|
||||
#else
|
||||
for (const auto &C : PipelineStartEPCallbacks)
|
||||
PB.registerPipelineStartEPCallback([C, OptLevel](ModulePassManager &MPM) {
|
||||
C(MPM, OptLevel);
|
||||
});
|
||||
#endif
|
||||
if (OptStage != LLVMRustOptStage::PreLinkThinLTO) {
|
||||
for (const auto &C : OptimizerLastEPCallbacks)
|
||||
PB.registerOptimizerLastEPCallback(C);
|
||||
@ -1003,7 +947,6 @@ LLVMRustOptimizeWithNewPassManager(
|
||||
MPM = PB.buildPerModuleDefaultPipeline(OptLevel, DebugPassManager);
|
||||
break;
|
||||
case LLVMRustOptStage::PreLinkThinLTO:
|
||||
#if LLVM_VERSION_GE(12, 0)
|
||||
MPM = PB.buildThinLTOPreLinkDefaultPipeline(OptLevel);
|
||||
// The ThinLTOPreLink pipeline already includes ThinLTOBuffer passes. However, callback
|
||||
// passes may still run afterwards. This means we need to run the buffer passes again.
|
||||
@ -1011,35 +954,20 @@ LLVMRustOptimizeWithNewPassManager(
|
||||
// before the RequiredLTOPreLinkPasses, in which case we can remove these hacks.
|
||||
if (OptimizerLastEPCallbacks.empty())
|
||||
NeedThinLTOBufferPasses = false;
|
||||
#else
|
||||
MPM = PB.buildThinLTOPreLinkDefaultPipeline(OptLevel, DebugPassManager);
|
||||
#endif
|
||||
for (const auto &C : OptimizerLastEPCallbacks)
|
||||
C(MPM, OptLevel);
|
||||
break;
|
||||
case LLVMRustOptStage::PreLinkFatLTO:
|
||||
#if LLVM_VERSION_GE(12, 0)
|
||||
MPM = PB.buildLTOPreLinkDefaultPipeline(OptLevel);
|
||||
NeedThinLTOBufferPasses = false;
|
||||
#else
|
||||
MPM = PB.buildLTOPreLinkDefaultPipeline(OptLevel, DebugPassManager);
|
||||
#endif
|
||||
break;
|
||||
case LLVMRustOptStage::ThinLTO:
|
||||
// FIXME: Does it make sense to pass the ModuleSummaryIndex?
|
||||
// It only seems to be needed for C++ specific optimizations.
|
||||
#if LLVM_VERSION_GE(12, 0)
|
||||
MPM = PB.buildThinLTODefaultPipeline(OptLevel, nullptr);
|
||||
#else
|
||||
MPM = PB.buildThinLTODefaultPipeline(OptLevel, DebugPassManager, nullptr);
|
||||
#endif
|
||||
break;
|
||||
case LLVMRustOptStage::FatLTO:
|
||||
#if LLVM_VERSION_GE(12, 0)
|
||||
MPM = PB.buildLTODefaultPipeline(OptLevel, nullptr);
|
||||
#else
|
||||
MPM = PB.buildLTODefaultPipeline(OptLevel, DebugPassManager, nullptr);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -263,11 +263,7 @@ extern "C" void LLVMRustAddByValCallSiteAttr(LLVMValueRef Instr, unsigned Index,
|
||||
extern "C" void LLVMRustAddStructRetCallSiteAttr(LLVMValueRef Instr, unsigned Index,
|
||||
LLVMTypeRef Ty) {
|
||||
CallBase *Call = unwrap<CallBase>(Instr);
|
||||
#if LLVM_VERSION_GE(12, 0)
|
||||
Attribute Attr = Attribute::getWithStructRetType(Call->getContext(), unwrap(Ty));
|
||||
#else
|
||||
Attribute Attr = Attribute::get(Call->getContext(), Attribute::StructRet);
|
||||
#endif
|
||||
AddAttribute(Call, Index, Attr);
|
||||
}
|
||||
|
||||
@ -311,11 +307,7 @@ extern "C" void LLVMRustAddByValAttr(LLVMValueRef Fn, unsigned Index,
|
||||
extern "C" void LLVMRustAddStructRetAttr(LLVMValueRef Fn, unsigned Index,
|
||||
LLVMTypeRef Ty) {
|
||||
Function *F = unwrap<Function>(Fn);
|
||||
#if LLVM_VERSION_GE(12, 0)
|
||||
Attribute Attr = Attribute::getWithStructRetType(F->getContext(), unwrap(Ty));
|
||||
#else
|
||||
Attribute Attr = Attribute::get(F->getContext(), Attribute::StructRet);
|
||||
#endif
|
||||
AddAttribute(F, Index, Attr);
|
||||
}
|
||||
|
||||
@ -1024,17 +1016,11 @@ extern "C" LLVMMetadataRef
|
||||
LLVMRustDIBuilderCreateDebugLocation(unsigned Line, unsigned Column,
|
||||
LLVMMetadataRef ScopeRef,
|
||||
LLVMMetadataRef InlinedAt) {
|
||||
#if LLVM_VERSION_GE(12, 0)
|
||||
MDNode *Scope = unwrapDIPtr<MDNode>(ScopeRef);
|
||||
DILocation *Loc = DILocation::get(
|
||||
Scope->getContext(), Line, Column, Scope,
|
||||
unwrapDIPtr<MDNode>(InlinedAt));
|
||||
return wrap(Loc);
|
||||
#else
|
||||
DebugLoc debug_loc = DebugLoc::get(Line, Column, unwrapDIPtr<MDNode>(ScopeRef),
|
||||
unwrapDIPtr<MDNode>(InlinedAt));
|
||||
return wrap(debug_loc.getAsMDNode());
|
||||
#endif
|
||||
}
|
||||
|
||||
extern "C" int64_t LLVMRustDIBuilderCreateOpDeref() {
|
||||
@ -1249,10 +1235,8 @@ extern "C" LLVMTypeKind LLVMRustGetTypeKind(LLVMTypeRef Ty) {
|
||||
return LLVMScalableVectorTypeKind;
|
||||
case Type::BFloatTyID:
|
||||
return LLVMBFloatTypeKind;
|
||||
#if LLVM_VERSION_GE(12, 0)
|
||||
case Type::X86_AMXTyID:
|
||||
return LLVMX86_AMXTypeKind;
|
||||
#endif
|
||||
}
|
||||
report_fatal_error("Unhandled TypeID.");
|
||||
}
|
||||
@ -1710,23 +1694,15 @@ LLVMRustBuildVectorReduceMax(LLVMBuilderRef B, LLVMValueRef Src, bool IsSigned)
|
||||
}
|
||||
extern "C" LLVMValueRef
|
||||
LLVMRustBuildVectorReduceFMin(LLVMBuilderRef B, LLVMValueRef Src, bool NoNaN) {
|
||||
#if LLVM_VERSION_GE(12, 0)
|
||||
Instruction *I = unwrap(B)->CreateFPMinReduce(unwrap(Src));
|
||||
I->setHasNoNaNs(NoNaN);
|
||||
return wrap(I);
|
||||
#else
|
||||
return wrap(unwrap(B)->CreateFPMinReduce(unwrap(Src), NoNaN));
|
||||
#endif
|
||||
}
|
||||
extern "C" LLVMValueRef
|
||||
LLVMRustBuildVectorReduceFMax(LLVMBuilderRef B, LLVMValueRef Src, bool NoNaN) {
|
||||
#if LLVM_VERSION_GE(12, 0)
|
||||
Instruction *I = unwrap(B)->CreateFPMaxReduce(unwrap(Src));
|
||||
I->setHasNoNaNs(NoNaN);
|
||||
return wrap(I);
|
||||
#else
|
||||
return wrap(unwrap(B)->CreateFPMaxReduce(unwrap(Src), NoNaN));
|
||||
#endif
|
||||
}
|
||||
|
||||
extern "C" LLVMValueRef
|
||||
|
@ -378,11 +378,11 @@ fn check_llvm_version(builder: &Builder<'_>, llvm_config: &Path) {
|
||||
let version = output(cmd.arg("--version"));
|
||||
let mut parts = version.split('.').take(2).filter_map(|s| s.parse::<u32>().ok());
|
||||
if let (Some(major), Some(_minor)) = (parts.next(), parts.next()) {
|
||||
if major >= 11 {
|
||||
if major >= 12 {
|
||||
return;
|
||||
}
|
||||
}
|
||||
panic!("\n\nbad LLVM version: {}, need >=11.0\n\n", version)
|
||||
panic!("\n\nbad LLVM version: {}, need >=12.0\n\n", version)
|
||||
}
|
||||
|
||||
fn configure_cmake(
|
||||
|
@ -14,8 +14,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
cmake \
|
||||
sudo \
|
||||
gdb \
|
||||
llvm-11-tools \
|
||||
llvm-11-dev \
|
||||
llvm-12-tools \
|
||||
llvm-12-dev \
|
||||
libedit-dev \
|
||||
libssl-dev \
|
||||
pkg-config \
|
||||
@ -29,7 +29,7 @@ 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-11 \
|
||||
--llvm-root=/usr/lib/llvm-12 \
|
||||
--enable-llvm-link-shared \
|
||||
--set rust.thin-lto-import-instr-limit=10
|
||||
|
@ -284,7 +284,7 @@ jobs:
|
||||
- name: mingw-check
|
||||
<<: *job-linux-xl
|
||||
|
||||
- name: x86_64-gnu-llvm-11
|
||||
- name: x86_64-gnu-llvm-12
|
||||
<<: *job-linux-xl
|
||||
|
||||
- name: x86_64-gnu-tools
|
||||
@ -431,7 +431,7 @@ jobs:
|
||||
- name: x86_64-gnu-distcheck
|
||||
<<: *job-linux-xl
|
||||
|
||||
- name: x86_64-gnu-llvm-11
|
||||
- name: x86_64-gnu-llvm-12
|
||||
env:
|
||||
RUST_BACKTRACE: 1
|
||||
<<: *job-linux-xl
|
||||
|
@ -1,4 +1,3 @@
|
||||
// min-llvm-version: 12.0
|
||||
// assembly-output: emit-asm
|
||||
// compile-flags: -O
|
||||
// compile-flags: --target aarch64-unknown-linux-gnu
|
||||
|
@ -1,4 +1,4 @@
|
||||
// min-llvm-version: 12.0.0
|
||||
// min-llvm-version: 12.0.1
|
||||
// revisions: powerpc powerpc64
|
||||
// assembly-output: emit-asm
|
||||
//[powerpc] compile-flags: --target powerpc-unknown-linux-gnu
|
||||
|
@ -5,7 +5,6 @@
|
||||
//[riscv32] compile-flags: --target riscv32imac-unknown-none-elf
|
||||
//[riscv32] needs-llvm-components: riscv
|
||||
// compile-flags: -C target-feature=+d
|
||||
// min-system-llvm-version: 12.0
|
||||
|
||||
#![feature(no_core, lang_items, rustc_attrs)]
|
||||
#![crate_type = "rlib"]
|
||||
|
@ -1,4 +1,3 @@
|
||||
// min-llvm-version: 12.0.0
|
||||
// assembly-output: emit-asm
|
||||
// compile-flags: --target wasm32-unknown-unknown
|
||||
// compile-flags: --crate-type cdylib
|
||||
|
@ -1,4 +1,3 @@
|
||||
// min-llvm-version: 12.0.0
|
||||
// revisions: x64 A64 ppc64le
|
||||
// assembly-output: emit-asm
|
||||
// [x64] compile-flags: --target x86_64-unknown-linux-gnu -Crelocation-model=static
|
||||
|
@ -1,6 +1,4 @@
|
||||
// compile-flags: -O -C no-prepopulate-passes
|
||||
//
|
||||
// min-system-llvm-version: 12.0
|
||||
|
||||
#![crate_type = "lib"]
|
||||
#![feature(rustc_attrs)]
|
||||
|
@ -1,4 +1,3 @@
|
||||
// min-llvm-version: 12.0.0
|
||||
// compile-flags: -O
|
||||
#![crate_type = "lib"]
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
// Regression test for #75525, verifies that no bounds checks are generated.
|
||||
|
||||
// min-llvm-version: 12.0.0
|
||||
// compile-flags: -O
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
@ -1,4 +1,3 @@
|
||||
// min-llvm-version: 12.0.0
|
||||
// compile-flags: -O
|
||||
#![crate_type = "lib"]
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
// min-llvm-version: 12.0.0
|
||||
// compile-flags: -O
|
||||
#![crate_type = "lib"]
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
// min-llvm-version: 12.0
|
||||
// compile-flags: -C opt-level=3
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
@ -1,4 +1,3 @@
|
||||
// min-llvm-version: 12.0
|
||||
// compile-flags: -C opt-level=3
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
@ -1,4 +1,3 @@
|
||||
// min-llvm-version: 12.0
|
||||
// compile-flags: -C opt-level=3
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
@ -1,4 +1,3 @@
|
||||
// min-llvm-version: 12.0
|
||||
// compile-flags: -C opt-level=3
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
@ -1,7 +1,6 @@
|
||||
// compile-flags: -C no-prepopulate-passes
|
||||
//
|
||||
|
||||
// min-system-llvm-version: 12.0
|
||||
// ignore-arm
|
||||
// ignore-aarch64
|
||||
// ignore-mips
|
||||
|
@ -1,7 +1,6 @@
|
||||
// compile-flags: -C no-prepopulate-passes
|
||||
//
|
||||
|
||||
// min-system-llvm-version: 12.0
|
||||
// ignore-aarch64
|
||||
// ignore-emscripten
|
||||
// ignore-mips64
|
||||
|
@ -1,7 +1,6 @@
|
||||
// compile-flags: -C no-prepopulate-passes
|
||||
//
|
||||
|
||||
// min-system-llvm-version: 12.0
|
||||
// only-mips64
|
||||
// See repr-transparent.rs
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
// only-wasm32
|
||||
// compile-flags: -C target-feature=-nontrapping-fptoint
|
||||
// min-llvm-version: 12.0
|
||||
#![crate_type = "lib"]
|
||||
|
||||
// CHECK-LABEL: @cast_f64_i64
|
||||
|
@ -1,10 +1,5 @@
|
||||
-include ../tools.mk
|
||||
|
||||
# Needs commit 6ffcb2937c96bd0d7a55b984b5eb8f381b68e322,
|
||||
# "[llvm-dwp] Join dwo paths correctly when DWOPath is absolute",
|
||||
# backported to 12.x in b1106a5b3bc94f6da11682007d101823f81bad30.
|
||||
# min-llvm-version: 12.0
|
||||
|
||||
all: off packed unpacked
|
||||
|
||||
ifeq ($(UNAME),Darwin)
|
||||
|
@ -2,11 +2,6 @@
|
||||
|
||||
# only-linux
|
||||
|
||||
# Needs commit 6ffcb2937c96bd0d7a55b984b5eb8f381b68e322,
|
||||
# "[llvm-dwp] Join dwo paths correctly when DWOPath is absolute",
|
||||
# backported to 12.x in b1106a5b3bc94f6da11682007d101823f81bad30.
|
||||
# min-llvm-version: 12.0
|
||||
|
||||
all:
|
||||
$(RUSTC) -Z unstable-options -C split-debuginfo=packed -C debuginfo=2 foo.rs -g
|
||||
rm $(TMPDIR)/foo.dwp
|
||||
|
@ -1,4 +1,4 @@
|
||||
// min-llvm-version: 12.0.0
|
||||
// min-llvm-version: 12.0.1
|
||||
// only-x86_64
|
||||
// only-linux
|
||||
// run-pass
|
||||
|
@ -1,7 +1,6 @@
|
||||
// build-fail
|
||||
// compile-flags: --target thumbv8m.main-none-eabi --crate-type lib
|
||||
// needs-llvm-components: arm
|
||||
// min-llvm-version: 12.0
|
||||
#![feature(cmse_nonsecure_entry, no_core, lang_items)]
|
||||
#![no_core]
|
||||
#[lang="sized"]
|
||||
|
@ -1,4 +1,3 @@
|
||||
// min-llvm-version: 12.0
|
||||
// compile-flags: -C opt-level=3
|
||||
// run-pass
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user