@@ -569,25 +569,43 @@ extern "C" LLVMRustResult LLVMRustOptimize(
569
569
}
570
570
571
571
std::optional<PGOOptions> PGOOpt;
572
+ #if LLVM_VERSION_LT(22, 0)
572
573
auto FS = vfs::getRealFileSystem ();
574
+ #endif
573
575
if (PGOGenPath) {
574
576
assert (!PGOUsePath && !PGOSampleUsePath);
575
577
PGOOpt = PGOOptions (
578
+ #if LLVM_VERSION_GE(22, 0)
579
+ PGOGenPath, " " , " " , " " , PGOOptions::IRInstr, PGOOptions::NoCSAction,
580
+ #else
576
581
PGOGenPath, " " , " " , " " , FS, PGOOptions::IRInstr, PGOOptions::NoCSAction,
582
+ #endif
577
583
PGOOptions::ColdFuncOpt::Default, DebugInfoForProfiling);
578
584
} else if (PGOUsePath) {
579
585
assert (!PGOSampleUsePath);
580
586
PGOOpt = PGOOptions (
587
+ #if LLVM_VERSION_GE(22, 0)
588
+ PGOUsePath, " " , " " , " " , PGOOptions::IRUse, PGOOptions::NoCSAction,
589
+ #else
581
590
PGOUsePath, " " , " " , " " , FS, PGOOptions::IRUse, PGOOptions::NoCSAction,
591
+ #endif
582
592
PGOOptions::ColdFuncOpt::Default, DebugInfoForProfiling);
583
593
} else if (PGOSampleUsePath) {
584
594
PGOOpt =
595
+ #if LLVM_VERSION_GE(22, 0)
596
+ PGOOptions (PGOSampleUsePath, " " , " " , " " , PGOOptions::SampleUse,
597
+ #else
585
598
PGOOptions (PGOSampleUsePath, " " , " " , " " , FS, PGOOptions::SampleUse,
599
+ #endif
586
600
PGOOptions::NoCSAction, PGOOptions::ColdFuncOpt::Default,
587
601
DebugInfoForProfiling);
588
602
} else if (DebugInfoForProfiling) {
589
603
PGOOpt = PGOOptions (
604
+ #if LLVM_VERSION_GE(22, 0)
605
+ " " , " " , " " , " " , PGOOptions::NoAction, PGOOptions::NoCSAction,
606
+ #else
590
607
" " , " " , " " , " " , FS, PGOOptions::NoAction, PGOOptions::NoCSAction,
608
+ #endif
591
609
PGOOptions::ColdFuncOpt::Default, DebugInfoForProfiling);
592
610
}
593
611
0 commit comments