diff options
| author | bors <bors@rust-lang.org> | 2023-02-04 03:41:57 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-02-04 03:41:57 +0000 |
| commit | 91eb6f9acfcfde6832d547959ad2d95b1ac0b5dc (patch) | |
| tree | eac1bf39849eae33d4bb2b9bdb80304e8a03dd48 /compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp | |
| parent | 886b2c3e005b153b3c8263f48193e0df7de0f5b3 (diff) | |
| parent | 4614e5b5bf1331907bf3baf70cf0eb705f2959e9 (diff) | |
| download | rust-91eb6f9acfcfde6832d547959ad2d95b1ac0b5dc.tar.gz rust-91eb6f9acfcfde6832d547959ad2d95b1ac0b5dc.zip | |
Auto merge of #107591 - krasimirgg:llvm-17-pgoopts, r=cuviper
llvm-wrapper: adapt for LLVM API changes Adapts the wrapper for https://github.com/llvm/llvm-project/commit/516e301752560311d2cd8c2b549493eb0f98d01b, where the constructor of PGOOptions gained a new FileSystem argument. Adapted to use the real file system, similarly to the changes inside of LLVM: https://github.com/llvm/llvm-project/commit/516e301752560311d2cd8c2b549493eb0f98d01b#diff-f409934ba27ad86494f3012324e9a3995b56e0743609ded7a387ba62bbf5edb0R236 Found via our experimental Rust + LLVM at HEAD bot: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/16853#01860e2e-5eba-4f07-8359-0325913ff410/219-517
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp')
| -rw-r--r-- | compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp index f728bff0e3b..15a4273fc59 100644 --- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp @@ -21,6 +21,9 @@ #include "llvm/Passes/StandardInstrumentations.h" #include "llvm/Support/CBindingWrapping.h" #include "llvm/Support/FileSystem.h" +#if LLVM_VERSION_GE(17, 0) +#include "llvm/Support/VirtualFileSystem.h" +#endif #include "llvm/Support/Host.h" #if LLVM_VERSION_LT(14, 0) #include "llvm/Support/TargetRegistry.h" @@ -652,20 +655,39 @@ LLVMRustOptimize( #else std::optional<PGOOptions> PGOOpt; #endif +#if LLVM_VERSION_GE(17, 0) + auto FS = vfs::getRealFileSystem(); +#endif if (PGOGenPath) { assert(!PGOUsePath && !PGOSampleUsePath); - PGOOpt = PGOOptions(PGOGenPath, "", "", PGOOptions::IRInstr, - PGOOptions::NoCSAction, DebugInfoForProfiling); + PGOOpt = PGOOptions(PGOGenPath, "", "", +#if LLVM_VERSION_GE(17, 0) + FS, +#endif + PGOOptions::IRInstr, PGOOptions::NoCSAction, + DebugInfoForProfiling); } else if (PGOUsePath) { assert(!PGOSampleUsePath); - PGOOpt = PGOOptions(PGOUsePath, "", "", PGOOptions::IRUse, - PGOOptions::NoCSAction, DebugInfoForProfiling); + PGOOpt = PGOOptions(PGOUsePath, "", "", +#if LLVM_VERSION_GE(17, 0) + FS, +#endif + PGOOptions::IRUse, PGOOptions::NoCSAction, + DebugInfoForProfiling); } else if (PGOSampleUsePath) { - PGOOpt = PGOOptions(PGOSampleUsePath, "", "", PGOOptions::SampleUse, - PGOOptions::NoCSAction, DebugInfoForProfiling); + PGOOpt = PGOOptions(PGOSampleUsePath, "", "", +#if LLVM_VERSION_GE(17, 0) + FS, +#endif + PGOOptions::SampleUse, PGOOptions::NoCSAction, + DebugInfoForProfiling); } else if (DebugInfoForProfiling) { - PGOOpt = PGOOptions("", "", "", PGOOptions::NoAction, - PGOOptions::NoCSAction, DebugInfoForProfiling); + PGOOpt = PGOOptions("", "", "", +#if LLVM_VERSION_GE(17, 0) + FS, +#endif + PGOOptions::NoAction, PGOOptions::NoCSAction, + DebugInfoForProfiling); } PassBuilder PB(TM, PTO, PGOOpt, &PIC); |
