|
47 | 47 | #include <vector>
|
48 | 48 |
|
49 | 49 | // Conditional includes prevent clang-format from fully sorting the list,
|
50 |
| -// so keep them separate. |
51 |
| -#if LLVM_VERSION_GE(19, 0) |
52 |
| -#include "llvm/Support/PGOOptions.h" |
53 |
| -#endif |
| 50 | +// so if any are needed, keep them separate down here. |
54 | 51 |
|
55 | 52 | using namespace llvm;
|
56 | 53 |
|
@@ -432,31 +429,15 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
|
432 | 429 | }
|
433 | 430 | if (!strcmp("zlib", DebugInfoCompression) &&
|
434 | 431 | llvm::compression::zlib::isAvailable()) {
|
435 |
| -#if LLVM_VERSION_GE(19, 0) |
436 | 432 | Options.MCOptions.CompressDebugSections = DebugCompressionType::Zlib;
|
437 |
| -#else |
438 |
| - Options.CompressDebugSections = DebugCompressionType::Zlib; |
439 |
| -#endif |
440 | 433 | } else if (!strcmp("zstd", DebugInfoCompression) &&
|
441 | 434 | llvm::compression::zstd::isAvailable()) {
|
442 |
| -#if LLVM_VERSION_GE(19, 0) |
443 | 435 | Options.MCOptions.CompressDebugSections = DebugCompressionType::Zstd;
|
444 |
| -#else |
445 |
| - Options.CompressDebugSections = DebugCompressionType::Zstd; |
446 |
| -#endif |
447 | 436 | } else if (!strcmp("none", DebugInfoCompression)) {
|
448 |
| -#if LLVM_VERSION_GE(19, 0) |
449 | 437 | Options.MCOptions.CompressDebugSections = DebugCompressionType::None;
|
450 |
| -#else |
451 |
| - Options.CompressDebugSections = DebugCompressionType::None; |
452 |
| -#endif |
453 | 438 | }
|
454 | 439 |
|
455 |
| -#if LLVM_VERSION_GE(19, 0) |
456 | 440 | Options.MCOptions.X86RelaxRelocations = RelaxELFRelocations;
|
457 |
| -#else |
458 |
| - Options.RelaxELFRelocations = RelaxELFRelocations; |
459 |
| -#endif |
460 | 441 | Options.UseInitArray = UseInitArray;
|
461 | 442 | Options.EmulatedTLS = UseEmulatedTls;
|
462 | 443 |
|
@@ -753,34 +734,23 @@ extern "C" LLVMRustResult LLVMRustOptimize(
|
753 | 734 | auto FS = vfs::getRealFileSystem();
|
754 | 735 | if (PGOGenPath) {
|
755 | 736 | assert(!PGOUsePath && !PGOSampleUsePath);
|
756 |
| - PGOOpt = PGOOptions(PGOGenPath, "", "", "", FS, PGOOptions::IRInstr, |
757 |
| - PGOOptions::NoCSAction, |
758 |
| -#if LLVM_VERSION_GE(19, 0) |
759 |
| - PGOOptions::ColdFuncOpt::Default, |
760 |
| -#endif |
761 |
| - DebugInfoForProfiling); |
| 737 | + PGOOpt = PGOOptions( |
| 738 | + PGOGenPath, "", "", "", FS, PGOOptions::IRInstr, PGOOptions::NoCSAction, |
| 739 | + PGOOptions::ColdFuncOpt::Default, DebugInfoForProfiling); |
762 | 740 | } else if (PGOUsePath) {
|
763 | 741 | assert(!PGOSampleUsePath);
|
764 |
| - PGOOpt = PGOOptions(PGOUsePath, "", "", "", FS, PGOOptions::IRUse, |
765 |
| - PGOOptions::NoCSAction, |
766 |
| -#if LLVM_VERSION_GE(19, 0) |
767 |
| - PGOOptions::ColdFuncOpt::Default, |
768 |
| -#endif |
769 |
| - DebugInfoForProfiling); |
| 742 | + PGOOpt = PGOOptions( |
| 743 | + PGOUsePath, "", "", "", FS, PGOOptions::IRUse, PGOOptions::NoCSAction, |
| 744 | + PGOOptions::ColdFuncOpt::Default, DebugInfoForProfiling); |
770 | 745 | } else if (PGOSampleUsePath) {
|
771 |
| - PGOOpt = PGOOptions(PGOSampleUsePath, "", "", "", FS, PGOOptions::SampleUse, |
772 |
| - PGOOptions::NoCSAction, |
773 |
| -#if LLVM_VERSION_GE(19, 0) |
774 |
| - PGOOptions::ColdFuncOpt::Default, |
775 |
| -#endif |
776 |
| - DebugInfoForProfiling); |
| 746 | + PGOOpt = |
| 747 | + PGOOptions(PGOSampleUsePath, "", "", "", FS, PGOOptions::SampleUse, |
| 748 | + PGOOptions::NoCSAction, PGOOptions::ColdFuncOpt::Default, |
| 749 | + DebugInfoForProfiling); |
777 | 750 | } else if (DebugInfoForProfiling) {
|
778 |
| - PGOOpt = PGOOptions("", "", "", "", FS, PGOOptions::NoAction, |
779 |
| - PGOOptions::NoCSAction, |
780 |
| -#if LLVM_VERSION_GE(19, 0) |
781 |
| - PGOOptions::ColdFuncOpt::Default, |
782 |
| -#endif |
783 |
| - DebugInfoForProfiling); |
| 751 | + PGOOpt = PGOOptions( |
| 752 | + "", "", "", "", FS, PGOOptions::NoAction, PGOOptions::NoCSAction, |
| 753 | + PGOOptions::ColdFuncOpt::Default, DebugInfoForProfiling); |
784 | 754 | }
|
785 | 755 |
|
786 | 756 | auto PB = PassBuilder(TM, PTO, PGOOpt, &PIC);
|
|
0 commit comments