-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[llvm] Add vfs::FileSystem
to PassBuilder
#160188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-backend-arm @llvm/pr-subscribers-clang-codegen Author: Jan Svoboda (jansvoboda11) ChangesSome LLVM passes need access to the filesystem to read configuration files and similar. In some places, this is achieved by grabbing the VFS from Patch is 25.70 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/160188.diff 10 Files Affected:
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp
index 106363fa83e2b..d2ab7aa0b0369 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -785,7 +785,8 @@ static void addSanitizers(const Triple &TargetTriple,
HWASanPass(SanitizerKind::KernelHWAddress, true);
if (LangOpts.Sanitize.has(SanitizerKind::DataFlow)) {
- MPM.addPass(DataFlowSanitizerPass(LangOpts.NoSanitizeFiles));
+ MPM.addPass(DataFlowSanitizerPass(LangOpts.NoSanitizeFiles,
+ PB.getVirtualFileSystemPtr()));
}
};
if (ClSanitizeOnOptimizerEarlyEP) {
@@ -837,9 +838,9 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
if (CodeGenOpts.hasProfileIRInstr())
// -fprofile-generate.
PGOOpt = PGOOptions(getProfileGenName(CodeGenOpts), "", "",
- CodeGenOpts.MemoryProfileUsePath, nullptr,
- PGOOptions::IRInstr, PGOOptions::NoCSAction,
- ClPGOColdFuncAttr, CodeGenOpts.DebugInfoForProfiling,
+ CodeGenOpts.MemoryProfileUsePath, PGOOptions::IRInstr,
+ PGOOptions::NoCSAction, ClPGOColdFuncAttr,
+ CodeGenOpts.DebugInfoForProfiling,
/*PseudoProbeForProfiling=*/false,
CodeGenOpts.AtomicProfileUpdate);
else if (CodeGenOpts.hasProfileIRUse()) {
@@ -848,32 +849,30 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
: PGOOptions::NoCSAction;
PGOOpt = PGOOptions(CodeGenOpts.ProfileInstrumentUsePath, "",
CodeGenOpts.ProfileRemappingFile,
- CodeGenOpts.MemoryProfileUsePath, VFS,
- PGOOptions::IRUse, CSAction, ClPGOColdFuncAttr,
+ CodeGenOpts.MemoryProfileUsePath, PGOOptions::IRUse,
+ CSAction, ClPGOColdFuncAttr,
CodeGenOpts.DebugInfoForProfiling);
} else if (!CodeGenOpts.SampleProfileFile.empty())
// -fprofile-sample-use
PGOOpt = PGOOptions(
CodeGenOpts.SampleProfileFile, "", CodeGenOpts.ProfileRemappingFile,
- CodeGenOpts.MemoryProfileUsePath, VFS, PGOOptions::SampleUse,
+ CodeGenOpts.MemoryProfileUsePath, PGOOptions::SampleUse,
PGOOptions::NoCSAction, ClPGOColdFuncAttr,
CodeGenOpts.DebugInfoForProfiling, CodeGenOpts.PseudoProbeForProfiling);
else if (!CodeGenOpts.MemoryProfileUsePath.empty())
// -fmemory-profile-use (without any of the above options)
- PGOOpt = PGOOptions("", "", "", CodeGenOpts.MemoryProfileUsePath, VFS,
+ PGOOpt = PGOOptions("", "", "", CodeGenOpts.MemoryProfileUsePath,
PGOOptions::NoAction, PGOOptions::NoCSAction,
ClPGOColdFuncAttr, CodeGenOpts.DebugInfoForProfiling);
else if (CodeGenOpts.PseudoProbeForProfiling)
// -fpseudo-probe-for-profiling
- PGOOpt =
- PGOOptions("", "", "", /*MemoryProfile=*/"", nullptr,
- PGOOptions::NoAction, PGOOptions::NoCSAction,
- ClPGOColdFuncAttr, CodeGenOpts.DebugInfoForProfiling, true);
+ PGOOpt = PGOOptions("", "", "", /*MemoryProfile=*/"", PGOOptions::NoAction,
+ PGOOptions::NoCSAction, ClPGOColdFuncAttr,
+ CodeGenOpts.DebugInfoForProfiling, true);
else if (CodeGenOpts.DebugInfoForProfiling)
// -fdebug-info-for-profiling
- PGOOpt = PGOOptions("", "", "", /*MemoryProfile=*/"", nullptr,
- PGOOptions::NoAction, PGOOptions::NoCSAction,
- ClPGOColdFuncAttr, true);
+ PGOOpt = PGOOptions("", "", "", /*MemoryProfile=*/"", PGOOptions::NoAction,
+ PGOOptions::NoCSAction, ClPGOColdFuncAttr, true);
// Check to see if we want to generate a CS profile.
if (CodeGenOpts.hasProfileCSIRInstr()) {
@@ -889,7 +888,7 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
PGOOpt->CSAction = PGOOptions::CSIRInstr;
} else
PGOOpt = PGOOptions("", getProfileGenName(CodeGenOpts), "",
- /*MemoryProfile=*/"", nullptr, PGOOptions::NoAction,
+ /*MemoryProfile=*/"", PGOOptions::NoAction,
PGOOptions::CSIRInstr, ClPGOColdFuncAttr,
CodeGenOpts.DebugInfoForProfiling);
}
@@ -926,7 +925,7 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
(CodeGenOpts.DebugPassManager || DebugPassStructure),
CodeGenOpts.VerifyEach, PrintPassOpts);
SI.registerCallbacks(PIC, &MAM);
- PassBuilder PB(TM.get(), PTO, PGOOpt, &PIC);
+ PassBuilder PB(TM.get(), PTO, PGOOpt, &PIC, CI.getVirtualFileSystemPtr());
// Handle the assignment tracking feature options.
switch (CodeGenOpts.getAssignmentTrackingMode()) {
diff --git a/llvm/include/llvm/Passes/PassBuilder.h b/llvm/include/llvm/Passes/PassBuilder.h
index 2742ec1b71b7e..8538a8b2afe14 100644
--- a/llvm/include/llvm/Passes/PassBuilder.h
+++ b/llvm/include/llvm/Passes/PassBuilder.h
@@ -23,6 +23,7 @@
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/PGOOptions.h"
+#include "llvm/Support/VirtualFileSystem.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/IPO/Inliner.h"
#include "llvm/Transforms/IPO/ModuleInliner.h"
@@ -35,10 +36,6 @@ class StringRef;
class AAManager;
class TargetMachine;
class ModuleSummaryIndex;
-template <typename T> class IntrusiveRefCntPtr;
-namespace vfs {
-class FileSystem;
-} // namespace vfs
/// Tunable parameters for passes in the default pipelines.
class PipelineTuningOptions {
@@ -115,6 +112,7 @@ class PassBuilder {
PipelineTuningOptions PTO;
std::optional<PGOOptions> PGOOpt;
PassInstrumentationCallbacks *PIC;
+ IntrusiveRefCntPtr<vfs::FileSystem> FS;
public:
/// A struct to capture parsed pass pipeline names.
@@ -134,7 +132,8 @@ class PassBuilder {
TargetMachine *TM = nullptr,
PipelineTuningOptions PTO = PipelineTuningOptions(),
std::optional<PGOOptions> PGOOpt = std::nullopt,
- PassInstrumentationCallbacks *PIC = nullptr);
+ PassInstrumentationCallbacks *PIC = nullptr,
+ IntrusiveRefCntPtr<vfs::FileSystem> FS = vfs::getRealFileSystem());
/// Cross register the analysis managers through their proxies.
///
@@ -632,8 +631,7 @@ class PassBuilder {
bool RunProfileGen, bool IsCS,
bool AtomicCounterUpdate,
std::string ProfileFile,
- std::string ProfileRemappingFile,
- IntrusiveRefCntPtr<vfs::FileSystem> FS);
+ std::string ProfileRemappingFile);
/// Returns PIC. External libraries can use this to register pass
/// instrumentation callbacks.
@@ -641,6 +639,11 @@ class PassBuilder {
return PIC;
}
+ /// Returns the virtual file system.
+ IntrusiveRefCntPtr<vfs::FileSystem> getVirtualFileSystemPtr() const {
+ return FS;
+ }
+
// Invoke the callbacks registered for the various extension points.
// Custom pipelines should use these to invoke the callbacks registered
// by TargetMachines and other clients.
@@ -772,8 +775,7 @@ class PassBuilder {
void addPGOInstrPasses(ModulePassManager &MPM, OptimizationLevel Level,
bool RunProfileGen, bool IsCS,
bool AtomicCounterUpdate, std::string ProfileFile,
- std::string ProfileRemappingFile,
- IntrusiveRefCntPtr<vfs::FileSystem> FS);
+ std::string ProfileRemappingFile);
void addPostPGOLoopRotation(ModulePassManager &MPM, OptimizationLevel Level);
bool isInstrumentedPGOUse() const;
diff --git a/llvm/include/llvm/Support/PGOOptions.h b/llvm/include/llvm/Support/PGOOptions.h
index 6527a18258bf8..fb1dc0cf4aa0a 100644
--- a/llvm/include/llvm/Support/PGOOptions.h
+++ b/llvm/include/llvm/Support/PGOOptions.h
@@ -14,16 +14,10 @@
#ifndef LLVM_SUPPORT_PGOOPTIONS_H
#define LLVM_SUPPORT_PGOOPTIONS_H
-#include "llvm/ADT/IntrusiveRefCntPtr.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Error.h"
namespace llvm {
-
-namespace vfs {
-class FileSystem;
-} // namespace vfs
-
/// A struct capturing PGO tunables.
struct PGOOptions {
enum PGOAction { NoAction, IRInstr, IRUse, SampleUse };
@@ -31,9 +25,7 @@ struct PGOOptions {
enum class ColdFuncOpt { Default, OptSize, MinSize, OptNone };
LLVM_ABI PGOOptions(std::string ProfileFile, std::string CSProfileGenFile,
std::string ProfileRemappingFile,
- std::string MemoryProfile,
- IntrusiveRefCntPtr<vfs::FileSystem> FS,
- PGOAction Action = NoAction,
+ std::string MemoryProfile, PGOAction Action = NoAction,
CSPGOAction CSAction = NoCSAction,
ColdFuncOpt ColdType = ColdFuncOpt::Default,
bool DebugInfoForProfiling = false,
@@ -53,7 +45,6 @@ struct PGOOptions {
bool DebugInfoForProfiling;
bool PseudoProbeForProfiling;
bool AtomicCounterUpdate;
- IntrusiveRefCntPtr<vfs::FileSystem> FS;
};
} // namespace llvm
diff --git a/llvm/include/llvm/Transforms/Instrumentation/DataFlowSanitizer.h b/llvm/include/llvm/Transforms/Instrumentation/DataFlowSanitizer.h
index af3662e4a6565..9c9d6afe1872f 100644
--- a/llvm/include/llvm/Transforms/Instrumentation/DataFlowSanitizer.h
+++ b/llvm/include/llvm/Transforms/Instrumentation/DataFlowSanitizer.h
@@ -10,6 +10,7 @@
#include "llvm/IR/PassManager.h"
#include "llvm/Support/Compiler.h"
+#include "llvm/Support/VirtualFileSystem.h"
#include <string>
#include <vector>
@@ -19,11 +20,13 @@ class Module;
class DataFlowSanitizerPass : public PassInfoMixin<DataFlowSanitizerPass> {
private:
std::vector<std::string> ABIListFiles;
+ IntrusiveRefCntPtr<vfs::FileSystem> FS;
public:
DataFlowSanitizerPass(
- const std::vector<std::string> &ABIListFiles = std::vector<std::string>())
- : ABIListFiles(ABIListFiles) {}
+ const std::vector<std::string> &ABIListFiles = std::vector<std::string>(),
+ IntrusiveRefCntPtr<vfs::FileSystem> FS = vfs::getRealFileSystem())
+ : ABIListFiles(ABIListFiles), FS(std::move(FS)) {}
LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
static bool isRequired() { return true; }
};
diff --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp
index c126e8efe82b3..11a7b3221bec9 100644
--- a/llvm/lib/LTO/LTOBackend.cpp
+++ b/llvm/lib/LTO/LTOBackend.cpp
@@ -240,27 +240,26 @@ static void runNewPMPasses(const Config &Conf, Module &Mod, TargetMachine *TM,
unsigned OptLevel, bool IsThinLTO,
ModuleSummaryIndex *ExportSummary,
const ModuleSummaryIndex *ImportSummary) {
- auto FS = vfs::getRealFileSystem();
std::optional<PGOOptions> PGOOpt;
if (!Conf.SampleProfile.empty())
PGOOpt = PGOOptions(Conf.SampleProfile, "", Conf.ProfileRemapping,
- /*MemoryProfile=*/"", FS, PGOOptions::SampleUse,
+ /*MemoryProfile=*/"", PGOOptions::SampleUse,
PGOOptions::NoCSAction,
PGOOptions::ColdFuncOpt::Default, true);
else if (Conf.RunCSIRInstr) {
PGOOpt = PGOOptions("", Conf.CSIRProfile, Conf.ProfileRemapping,
- /*MemoryProfile=*/"", FS, PGOOptions::IRUse,
+ /*MemoryProfile=*/"", PGOOptions::IRUse,
PGOOptions::CSIRInstr, PGOOptions::ColdFuncOpt::Default,
Conf.AddFSDiscriminator);
} else if (!Conf.CSIRProfile.empty()) {
- PGOOpt = PGOOptions(Conf.CSIRProfile, "", Conf.ProfileRemapping,
- /*MemoryProfile=*/"", FS, PGOOptions::IRUse,
- PGOOptions::CSIRUse, PGOOptions::ColdFuncOpt::Default,
- Conf.AddFSDiscriminator);
+ PGOOpt =
+ PGOOptions(Conf.CSIRProfile, "", Conf.ProfileRemapping,
+ /*MemoryProfile=*/"", PGOOptions::IRUse, PGOOptions::CSIRUse,
+ PGOOptions::ColdFuncOpt::Default, Conf.AddFSDiscriminator);
NoPGOWarnMismatch = !Conf.PGOWarnMismatch;
} else if (Conf.AddFSDiscriminator) {
- PGOOpt = PGOOptions("", "", "", /*MemoryProfile=*/"", nullptr,
- PGOOptions::NoAction, PGOOptions::NoCSAction,
+ PGOOpt = PGOOptions("", "", "", /*MemoryProfile=*/"", PGOOptions::NoAction,
+ PGOOptions::NoCSAction,
PGOOptions::ColdFuncOpt::Default, true);
}
TM->setPGOOption(PGOOpt);
diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp
index e4dab4acc0b4a..ebade6e7860c7 100644
--- a/llvm/lib/Passes/PassBuilder.cpp
+++ b/llvm/lib/Passes/PassBuilder.cpp
@@ -504,8 +504,9 @@ static Expected<OptimizationLevel> parseOptLevelParam(StringRef S) {
PassBuilder::PassBuilder(TargetMachine *TM, PipelineTuningOptions PTO,
std::optional<PGOOptions> PGOOpt,
- PassInstrumentationCallbacks *PIC)
- : TM(TM), PTO(PTO), PGOOpt(PGOOpt), PIC(PIC) {
+ PassInstrumentationCallbacks *PIC,
+ IntrusiveRefCntPtr<vfs::FileSystem> FS)
+ : TM(TM), PTO(PTO), PGOOpt(PGOOpt), PIC(PIC), FS(std::move(FS)) {
if (TM)
TM->registerPassBuilderCallbacks(*this);
if (PIC) {
diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp
index 30c6f06be139d..020e34e543cb5 100644
--- a/llvm/lib/Passes/PassBuilderPipelines.cpp
+++ b/llvm/lib/Passes/PassBuilderPipelines.cpp
@@ -848,8 +848,7 @@ void PassBuilder::addPGOInstrPasses(ModulePassManager &MPM,
OptimizationLevel Level, bool RunProfileGen,
bool IsCS, bool AtomicCounterUpdate,
std::string ProfileFile,
- std::string ProfileRemappingFile,
- IntrusiveRefCntPtr<vfs::FileSystem> FS) {
+ std::string ProfileRemappingFile) {
assert(Level != OptimizationLevel::O0 && "Not expecting O0 here!");
if (!RunProfileGen) {
@@ -884,10 +883,11 @@ void PassBuilder::addPGOInstrPasses(ModulePassManager &MPM,
MPM.addPass(InstrProfilingLoweringPass(Options, IsCS));
}
-void PassBuilder::addPGOInstrPassesForO0(
- ModulePassManager &MPM, bool RunProfileGen, bool IsCS,
- bool AtomicCounterUpdate, std::string ProfileFile,
- std::string ProfileRemappingFile, IntrusiveRefCntPtr<vfs::FileSystem> FS) {
+void PassBuilder::addPGOInstrPassesForO0(ModulePassManager &MPM,
+ bool RunProfileGen, bool IsCS,
+ bool AtomicCounterUpdate,
+ std::string ProfileFile,
+ std::string ProfileRemappingFile) {
if (!RunProfileGen) {
assert(!ProfileFile.empty() && "Profile use expecting a profile file!");
MPM.addPass(
@@ -1133,8 +1133,8 @@ PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level,
if (LoadSampleProfile) {
// Annotate sample profile right after early FPM to ensure freshness of
// the debug info.
- MPM.addPass(SampleProfileLoaderPass(PGOOpt->ProfileFile,
- PGOOpt->ProfileRemappingFile, Phase));
+ MPM.addPass(SampleProfileLoaderPass(
+ PGOOpt->ProfileFile, PGOOpt->ProfileRemappingFile, Phase, FS));
// Cache ProfileSummaryAnalysis once to avoid the potential need to insert
// RequireAnalysisPass for PSI before subsequent non-module passes.
MPM.addPass(RequireAnalysisPass<ProfileSummaryAnalysis, Module>());
@@ -1230,8 +1230,7 @@ PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level,
addPGOInstrPasses(MPM, Level,
/*RunProfileGen=*/IsPGOInstrGen,
/*IsCS=*/false, PGOOpt->AtomicCounterUpdate,
- PGOOpt->ProfileFile, PGOOpt->ProfileRemappingFile,
- PGOOpt->FS);
+ PGOOpt->ProfileFile, PGOOpt->ProfileRemappingFile);
} else if (IsCtxProfGen || IsCtxProfUse) {
MPM.addPass(PGOInstrumentationGen(PGOInstrumentationType::CTXPROF));
// In pre-link, we just want the instrumented IR. We use the contextual
@@ -1254,10 +1253,10 @@ PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level,
addPostPGOLoopRotation(MPM, Level);
MPM.addPass(PGOCtxProfLoweringPass());
} else if (IsColdFuncOnlyInstrGen) {
- addPGOInstrPasses(
- MPM, Level, /* RunProfileGen */ true, /* IsCS */ false,
- /* AtomicCounterUpdate */ false, InstrumentColdFuncOnlyPath,
- /* ProfileRemappingFile */ "", IntrusiveRefCntPtr<vfs::FileSystem>());
+ addPGOInstrPasses(MPM, Level, /* RunProfileGen */ true, /* IsCS */ false,
+ /* AtomicCounterUpdate */ false,
+ InstrumentColdFuncOnlyPath,
+ /* ProfileRemappingFile */ "");
}
if (IsPGOInstrGen || IsPGOInstrUse || IsCtxProfGen)
@@ -1268,7 +1267,7 @@ PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level,
EnableSampledInstr));
if (IsMemprofUse)
- MPM.addPass(MemProfUsePass(PGOOpt->MemoryProfile, PGOOpt->FS));
+ MPM.addPass(MemProfUsePass(PGOOpt->MemoryProfile, FS));
if (PGOOpt && (PGOOpt->Action == PGOOptions::IRUse ||
PGOOpt->Action == PGOOptions::SampleUse))
@@ -1477,13 +1476,11 @@ PassBuilder::buildModuleOptimizationPipeline(OptimizationLevel Level,
if (PGOOpt->CSAction == PGOOptions::CSIRInstr)
addPGOInstrPasses(MPM, Level, /*RunProfileGen=*/true,
/*IsCS=*/true, PGOOpt->AtomicCounterUpdate,
- PGOOpt->CSProfileGenFile, PGOOpt->ProfileRemappingFile,
- PGOOpt->FS);
+ PGOOpt->CSProfileGenFile, PGOOpt->ProfileRemappingFile);
else if (PGOOpt->CSAction == PGOOptions::CSIRUse)
addPGOInstrPasses(MPM, Level, /*RunProfileGen=*/false,
/*IsCS=*/true, PGOOpt->AtomicCounterUpdate,
- PGOOpt->ProfileFile, PGOOpt->ProfileRemappingFile,
- PGOOpt->FS);
+ PGOOpt->ProfileFile, PGOOpt->ProfileRemappingFile);
}
// Re-compute GlobalsAA here prior to function passes. This is particularly
@@ -2070,13 +2067,11 @@ PassBuilder::buildLTODefaultPipeline(OptimizationLevel Level,
if (PGOOpt->CSAction == PGOOptions::CSIRInstr)
addPGOInstrPasses(MPM, Level, /*RunProfileGen=*/true,
/*IsCS=*/true, PGOOpt->AtomicCounterUpdate,
- PGOOpt->CSProfileGenFile, PGOOpt->ProfileRemappingFile,
- PGOOpt->FS);
+ PGOOpt->CSProfileGenFile, PGOOpt->ProfileRemappingFile);
else if (PGOOpt->CSAction == PGOOptions::CSIRUse)
addPGOInstrPasses(MPM, Level, /*RunProfileGen=*/false,
/*IsCS=*/true, PGOOpt->AtomicCounterUpdate,
- PGOOpt->ProfileFile, PGOOpt->ProfileRemappingFile,
- PGOOpt->FS);
+ PGOOpt->ProfileFile, PGOOpt->ProfileRemappingFile);
}
// Break up allocas
@@ -2236,7 +2231,7 @@ PassBuilder::buildO0DefaultPipeline(OptimizationLevel Level,
MPM,
/*RunProfileGen=*/(PGOOpt->Action == PGOOptions::IRInstr),
/*IsCS=*/false, PGOOpt->AtomicCounterUpdate, PGOOpt->ProfileFile,
- PGOOpt->ProfileRemappingFile, PGOOpt->FS);
+ PGOOpt->ProfileRemappingFile);
// Instrument function entry and exit before all inlining.
MPM.addPass(createModuleToFunctionPassAdaptor(
diff --git a/llvm/lib/Support/PGOOptions.cpp b/llvm/lib/Support/PGOOptions.cpp
index 5981dff9e0946..ecfb0ca33f16c 100644
--- a/llvm/lib/Support/PGOOptions.cpp
+++ b/llvm/lib/Support/P...
[truncated]
|
c7afccc
to
7b36dad
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM in general.
Nit: I will title the commit to be add VFS to PassBuilder so LLVM passes can access file through VFS, and lifting PGO option is just one use case for that.
PGOOptions
to PassBuilder
vfs::FileSystem
to PassBuilder
Some LLVM passes need access to the filesystem to read configuration files and similar. In some places, this is achieved by grabbing the VFS from `PGOOptions`, but some passes don't have access to these and resort to just calling `vfs::getRealFileSystem()`. This PR allows setting the VFS directly on `PassBuilder` that's able to pass it down to all passes that need it.
Some LLVM passes need access to the filesystem to read configuration files and similar. In some places, this is achieved by grabbing the VFS from `PGOOptions`, but some passes don't have access to these and resort to just calling `vfs::getRealFileSystem()`. This PR allows setting the VFS directly on `PassBuilder` that's able to pass it down to all passes that need it.
Some LLVM passes need access to the filesystem to read configuration files and similar. In some places, this is achieved by grabbing the VFS from
PGOOptions
, but some passes don't have access to these and resort to just callingvfs::getRealFileSystem()
. This PR allows setting the VFS directly onPassBuilder
that's able to pass it down to all passes that need it.