|
21 | 21 | #include "llvm/Passes/StandardInstrumentations.h"
|
22 | 22 | #include "llvm/Support/CBindingWrapping.h"
|
23 | 23 | #include "llvm/Support/FileSystem.h"
|
| 24 | +#if LLVM_VERSION_GE(17, 0) |
| 25 | +#include "llvm/Support/VirtualFileSystem.h" |
| 26 | +#endif |
24 | 27 | #include "llvm/Support/Host.h"
|
25 | 28 | #if LLVM_VERSION_LT(14, 0)
|
26 | 29 | #include "llvm/Support/TargetRegistry.h"
|
@@ -651,21 +654,40 @@ LLVMRustOptimize(
|
651 | 654 | Optional<PGOOptions> PGOOpt;
|
652 | 655 | #else
|
653 | 656 | std::optional<PGOOptions> PGOOpt;
|
| 657 | +#endif |
| 658 | +#if LLVM_VERSION_GE(17, 0) |
| 659 | + auto FS = vfs::getRealFileSystem(); |
654 | 660 | #endif
|
655 | 661 | if (PGOGenPath) {
|
656 | 662 | assert(!PGOUsePath && !PGOSampleUsePath);
|
657 |
| - PGOOpt = PGOOptions(PGOGenPath, "", "", PGOOptions::IRInstr, |
658 |
| - PGOOptions::NoCSAction, DebugInfoForProfiling); |
| 663 | + PGOOpt = PGOOptions(PGOGenPath, "", "", |
| 664 | +#if LLVM_VERSION_GE(17, 0) |
| 665 | + FS, |
| 666 | +#endif |
| 667 | + PGOOptions::IRInstr, PGOOptions::NoCSAction, |
| 668 | + DebugInfoForProfiling); |
659 | 669 | } else if (PGOUsePath) {
|
660 | 670 | assert(!PGOSampleUsePath);
|
661 |
| - PGOOpt = PGOOptions(PGOUsePath, "", "", PGOOptions::IRUse, |
662 |
| - PGOOptions::NoCSAction, DebugInfoForProfiling); |
| 671 | + PGOOpt = PGOOptions(PGOUsePath, "", "", |
| 672 | +#if LLVM_VERSION_GE(17, 0) |
| 673 | + FS, |
| 674 | +#endif |
| 675 | + PGOOptions::IRUse, PGOOptions::NoCSAction, |
| 676 | + DebugInfoForProfiling); |
663 | 677 | } else if (PGOSampleUsePath) {
|
664 |
| - PGOOpt = PGOOptions(PGOSampleUsePath, "", "", PGOOptions::SampleUse, |
665 |
| - PGOOptions::NoCSAction, DebugInfoForProfiling); |
| 678 | + PGOOpt = PGOOptions(PGOSampleUsePath, "", "", |
| 679 | +#if LLVM_VERSION_GE(17, 0) |
| 680 | + FS, |
| 681 | +#endif |
| 682 | + PGOOptions::SampleUse, PGOOptions::NoCSAction, |
| 683 | + DebugInfoForProfiling); |
666 | 684 | } else if (DebugInfoForProfiling) {
|
667 |
| - PGOOpt = PGOOptions("", "", "", PGOOptions::NoAction, |
668 |
| - PGOOptions::NoCSAction, DebugInfoForProfiling); |
| 685 | + PGOOpt = PGOOptions("", "", "", |
| 686 | +#if LLVM_VERSION_GE(17, 0) |
| 687 | + FS, |
| 688 | +#endif |
| 689 | + PGOOptions::NoAction, PGOOptions::NoCSAction, |
| 690 | + DebugInfoForProfiling); |
669 | 691 | }
|
670 | 692 |
|
671 | 693 | PassBuilder PB(TM, PTO, PGOOpt, &PIC);
|
|
0 commit comments