Auto merge of #83387 - cuviper:min-llvm-10, r=nagisa
Update the minimum external LLVM to 10 r? `@nikic`
This commit is contained in:
commit
6e17a5c5fd
16 changed files with 19 additions and 137 deletions
|
@ -65,13 +65,9 @@ extern "C" void LLVMInitializePasses() {
|
|||
}
|
||||
|
||||
extern "C" void LLVMTimeTraceProfilerInitialize() {
|
||||
#if LLVM_VERSION_GE(10, 0)
|
||||
timeTraceProfilerInitialize(
|
||||
/* TimeTraceGranularity */ 0,
|
||||
/* ProcName */ "rustc");
|
||||
#else
|
||||
timeTraceProfilerInitialize();
|
||||
#endif
|
||||
}
|
||||
|
||||
extern "C" void LLVMTimeTraceProfilerFinish(const char* FileName) {
|
||||
|
@ -596,7 +592,6 @@ enum class LLVMRustFileType {
|
|||
ObjectFile,
|
||||
};
|
||||
|
||||
#if LLVM_VERSION_GE(10, 0)
|
||||
static CodeGenFileType fromRust(LLVMRustFileType Type) {
|
||||
switch (Type) {
|
||||
case LLVMRustFileType::AssemblyFile:
|
||||
|
@ -607,18 +602,6 @@ static CodeGenFileType fromRust(LLVMRustFileType Type) {
|
|||
report_fatal_error("Bad FileType.");
|
||||
}
|
||||
}
|
||||
#else
|
||||
static TargetMachine::CodeGenFileType fromRust(LLVMRustFileType Type) {
|
||||
switch (Type) {
|
||||
case LLVMRustFileType::AssemblyFile:
|
||||
return TargetMachine::CGFT_AssemblyFile;
|
||||
case LLVMRustFileType::ObjectFile:
|
||||
return TargetMachine::CGFT_ObjectFile;
|
||||
default:
|
||||
report_fatal_error("Bad FileType.");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
extern "C" LLVMRustResult
|
||||
LLVMRustWriteOutputFile(LLVMTargetMachineRef Target, LLVMPassManagerRef PMR,
|
||||
|
@ -868,13 +851,11 @@ LLVMRustOptimizeWithNewPassManager(
|
|||
}
|
||||
);
|
||||
#else
|
||||
#if LLVM_VERSION_GE(10, 0)
|
||||
PipelineStartEPCallbacks.push_back(
|
||||
[Options](ModulePassManager &MPM, PassBuilder::OptimizationLevel Level) {
|
||||
MPM.addPass(MemorySanitizerPass(Options));
|
||||
}
|
||||
);
|
||||
#endif
|
||||
OptimizerLastEPCallbacks.push_back(
|
||||
[Options](FunctionPassManager &FPM, PassBuilder::OptimizationLevel Level) {
|
||||
FPM.addPass(MemorySanitizerPass(Options));
|
||||
|
@ -892,13 +873,11 @@ LLVMRustOptimizeWithNewPassManager(
|
|||
}
|
||||
);
|
||||
#else
|
||||
#if LLVM_VERSION_GE(10, 0)
|
||||
PipelineStartEPCallbacks.push_back(
|
||||
[](ModulePassManager &MPM, PassBuilder::OptimizationLevel Level) {
|
||||
MPM.addPass(ThreadSanitizerPass());
|
||||
}
|
||||
);
|
||||
#endif
|
||||
OptimizerLastEPCallbacks.push_back(
|
||||
[](FunctionPassManager &FPM, PassBuilder::OptimizationLevel Level) {
|
||||
FPM.addPass(ThreadSanitizerPass());
|
||||
|
@ -989,13 +968,11 @@ LLVMRustOptimizeWithNewPassManager(
|
|||
|
||||
MPM.addPass(AlwaysInlinerPass(EmitLifetimeMarkers));
|
||||
|
||||
# if LLVM_VERSION_GE(10, 0)
|
||||
if (PGOOpt) {
|
||||
PB.addPGOInstrPassesForO0(
|
||||
MPM, DebugPassManager, PGOOpt->Action == PGOOptions::IRInstr,
|
||||
/*IsCS=*/false, PGOOpt->ProfileFile, PGOOpt->ProfileRemappingFile);
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
} else {
|
||||
#if LLVM_VERSION_GE(12, 0)
|
||||
|
@ -1366,11 +1343,7 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules,
|
|||
int num_modules,
|
||||
const char **preserved_symbols,
|
||||
int num_symbols) {
|
||||
#if LLVM_VERSION_GE(10, 0)
|
||||
auto Ret = std::make_unique<LLVMRustThinLTOData>();
|
||||
#else
|
||||
auto Ret = llvm::make_unique<LLVMRustThinLTOData>();
|
||||
#endif
|
||||
|
||||
// Load each module's summary and merge it into one combined index
|
||||
for (int i = 0; i < num_modules; i++) {
|
||||
|
@ -1463,7 +1436,6 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules,
|
|||
ExportedGUIDs.insert(GUID);
|
||||
}
|
||||
}
|
||||
#if LLVM_VERSION_GE(10, 0)
|
||||
auto isExported = [&](StringRef ModuleIdentifier, ValueInfo VI) {
|
||||
const auto &ExportList = Ret->ExportLists.find(ModuleIdentifier);
|
||||
return (ExportList != Ret->ExportLists.end() &&
|
||||
|
@ -1471,15 +1443,6 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules,
|
|||
ExportedGUIDs.count(VI.getGUID());
|
||||
};
|
||||
thinLTOInternalizeAndPromoteInIndex(Ret->Index, isExported, isPrevailing);
|
||||
#else
|
||||
auto isExported = [&](StringRef ModuleIdentifier, GlobalValue::GUID GUID) {
|
||||
const auto &ExportList = Ret->ExportLists.find(ModuleIdentifier);
|
||||
return (ExportList != Ret->ExportLists.end() &&
|
||||
ExportList->second.count(GUID)) ||
|
||||
ExportedGUIDs.count(GUID);
|
||||
};
|
||||
thinLTOInternalizeAndPromoteInIndex(Ret->Index, isExported);
|
||||
#endif
|
||||
|
||||
return Ret.release();
|
||||
}
|
||||
|
@ -1636,11 +1599,7 @@ struct LLVMRustThinLTOBuffer {
|
|||
|
||||
extern "C" LLVMRustThinLTOBuffer*
|
||||
LLVMRustThinLTOBufferCreate(LLVMModuleRef M) {
|
||||
#if LLVM_VERSION_GE(10, 0)
|
||||
auto Ret = std::make_unique<LLVMRustThinLTOBuffer>();
|
||||
#else
|
||||
auto Ret = llvm::make_unique<LLVMRustThinLTOBuffer>();
|
||||
#endif
|
||||
{
|
||||
raw_string_ostream OS(Ret->data);
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue