@@ -569,25 +569,43 @@ extern "C" LLVMRustResult LLVMRustOptimize(
569569 }
570570
571571 std::optional<PGOOptions> PGOOpt;
572+ #if LLVM_VERSION_LT(22, 0)
572573 auto FS = vfs::getRealFileSystem ();
574+ #endif
573575 if (PGOGenPath) {
574576 assert (!PGOUsePath && !PGOSampleUsePath);
575577 PGOOpt = PGOOptions (
578+ #if LLVM_VERSION_GE(22, 0)
579+ PGOGenPath, " " , " " , " " , PGOOptions::IRInstr, PGOOptions::NoCSAction,
580+ #else
576581 PGOGenPath, " " , " " , " " , FS, PGOOptions::IRInstr, PGOOptions::NoCSAction,
582+ #endif
577583 PGOOptions::ColdFuncOpt::Default, DebugInfoForProfiling);
578584 } else if (PGOUsePath) {
579585 assert (!PGOSampleUsePath);
580586 PGOOpt = PGOOptions (
587+ #if LLVM_VERSION_GE(22, 0)
588+ PGOUsePath, " " , " " , " " , PGOOptions::IRUse, PGOOptions::NoCSAction,
589+ #else
581590 PGOUsePath, " " , " " , " " , FS, PGOOptions::IRUse, PGOOptions::NoCSAction,
591+ #endif
582592 PGOOptions::ColdFuncOpt::Default, DebugInfoForProfiling);
583593 } else if (PGOSampleUsePath) {
584594 PGOOpt =
595+ #if LLVM_VERSION_GE(22, 0)
596+ PGOOptions (PGOSampleUsePath, " " , " " , " " , PGOOptions::SampleUse,
597+ #else
585598 PGOOptions (PGOSampleUsePath, " " , " " , " " , FS, PGOOptions::SampleUse,
599+ #endif
586600 PGOOptions::NoCSAction, PGOOptions::ColdFuncOpt::Default,
587601 DebugInfoForProfiling);
588602 } else if (DebugInfoForProfiling) {
589603 PGOOpt = PGOOptions (
604+ #if LLVM_VERSION_GE(22, 0)
605+ " " , " " , " " , " " , PGOOptions::NoAction, PGOOptions::NoCSAction,
606+ #else
590607 " " , " " , " " , " " , FS, PGOOptions::NoAction, PGOOptions::NoCSAction,
608+ #endif
591609 PGOOptions::ColdFuncOpt::Default, DebugInfoForProfiling);
592610 }
593611
0 commit comments