@@ -65,13 +65,9 @@ extern "C" void LLVMInitializePasses() {
65
65
}
66
66
67
67
extern " C" void LLVMTimeTraceProfilerInitialize () {
68
- #if LLVM_VERSION_GE(10, 0)
69
68
timeTraceProfilerInitialize (
70
69
/* TimeTraceGranularity */ 0 ,
71
70
/* ProcName */ " rustc" );
72
- #else
73
- timeTraceProfilerInitialize ();
74
- #endif
75
71
}
76
72
77
73
extern " C" void LLVMTimeTraceProfilerFinish (const char * FileName) {
@@ -596,7 +592,6 @@ enum class LLVMRustFileType {
596
592
ObjectFile,
597
593
};
598
594
599
- #if LLVM_VERSION_GE(10, 0)
600
595
static CodeGenFileType fromRust (LLVMRustFileType Type) {
601
596
switch (Type) {
602
597
case LLVMRustFileType::AssemblyFile:
@@ -607,18 +602,6 @@ static CodeGenFileType fromRust(LLVMRustFileType Type) {
607
602
report_fatal_error (" Bad FileType." );
608
603
}
609
604
}
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
622
605
623
606
extern " C" LLVMRustResult
624
607
LLVMRustWriteOutputFile (LLVMTargetMachineRef Target, LLVMPassManagerRef PMR,
@@ -868,13 +851,11 @@ LLVMRustOptimizeWithNewPassManager(
868
851
}
869
852
);
870
853
#else
871
- #if LLVM_VERSION_GE(10, 0)
872
854
PipelineStartEPCallbacks.push_back (
873
855
[Options](ModulePassManager &MPM, PassBuilder::OptimizationLevel Level) {
874
856
MPM.addPass (MemorySanitizerPass (Options));
875
857
}
876
858
);
877
- #endif
878
859
OptimizerLastEPCallbacks.push_back (
879
860
[Options](FunctionPassManager &FPM, PassBuilder::OptimizationLevel Level) {
880
861
FPM.addPass (MemorySanitizerPass (Options));
@@ -892,13 +873,11 @@ LLVMRustOptimizeWithNewPassManager(
892
873
}
893
874
);
894
875
#else
895
- #if LLVM_VERSION_GE(10, 0)
896
876
PipelineStartEPCallbacks.push_back (
897
877
[](ModulePassManager &MPM, PassBuilder::OptimizationLevel Level) {
898
878
MPM.addPass (ThreadSanitizerPass ());
899
879
}
900
880
);
901
- #endif
902
881
OptimizerLastEPCallbacks.push_back (
903
882
[](FunctionPassManager &FPM, PassBuilder::OptimizationLevel Level) {
904
883
FPM.addPass (ThreadSanitizerPass ());
@@ -989,13 +968,11 @@ LLVMRustOptimizeWithNewPassManager(
989
968
990
969
MPM.addPass (AlwaysInlinerPass (EmitLifetimeMarkers));
991
970
992
- # if LLVM_VERSION_GE(10, 0)
993
971
if (PGOOpt) {
994
972
PB.addPGOInstrPassesForO0 (
995
973
MPM, DebugPassManager, PGOOpt->Action == PGOOptions::IRInstr,
996
974
/* IsCS=*/ false , PGOOpt->ProfileFile , PGOOpt->ProfileRemappingFile );
997
975
}
998
- # endif
999
976
#endif
1000
977
} else {
1001
978
#if LLVM_VERSION_GE(12, 0)
@@ -1366,11 +1343,7 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules,
1366
1343
int num_modules,
1367
1344
const char **preserved_symbols,
1368
1345
int num_symbols) {
1369
- #if LLVM_VERSION_GE(10, 0)
1370
1346
auto Ret = std::make_unique<LLVMRustThinLTOData>();
1371
- #else
1372
- auto Ret = llvm::make_unique<LLVMRustThinLTOData>();
1373
- #endif
1374
1347
1375
1348
// Load each module's summary and merge it into one combined index
1376
1349
for (int i = 0 ; i < num_modules; i++) {
@@ -1455,23 +1428,13 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules,
1455
1428
ExportedGUIDs.insert (GUID);
1456
1429
}
1457
1430
}
1458
- #if LLVM_VERSION_GE(10, 0)
1459
1431
auto isExported = [&](StringRef ModuleIdentifier, ValueInfo VI) {
1460
1432
const auto &ExportList = Ret->ExportLists .find (ModuleIdentifier);
1461
1433
return (ExportList != Ret->ExportLists .end () &&
1462
1434
ExportList->second .count (VI)) ||
1463
1435
ExportedGUIDs.count (VI.getGUID ());
1464
1436
};
1465
1437
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
1475
1438
1476
1439
return Ret.release ();
1477
1440
}
@@ -1628,11 +1591,7 @@ struct LLVMRustThinLTOBuffer {
1628
1591
1629
1592
extern " C" LLVMRustThinLTOBuffer*
1630
1593
LLVMRustThinLTOBufferCreate (LLVMModuleRef M) {
1631
- #if LLVM_VERSION_GE(10, 0)
1632
1594
auto Ret = std::make_unique<LLVMRustThinLTOBuffer>();
1633
- #else
1634
- auto Ret = llvm::make_unique<LLVMRustThinLTOBuffer>();
1635
- #endif
1636
1595
{
1637
1596
raw_string_ostream OS (Ret->data );
1638
1597
{
0 commit comments