diff options
author | Wei Mi <wmi@google.com> | 2019-01-16 23:19:02 +0000 |
---|---|---|
committer | Wei Mi <wmi@google.com> | 2019-01-16 23:19:02 +0000 |
commit | c876e3d42be916a405fcbbc2fa75ecef9de95e11 (patch) | |
tree | 703998216d0bb3b779230ce2acc839993b51c9f9 /llvm/tools/opt/opt.cpp | |
parent | 931779761e7e8852d6cbdf7a5cd55b1ccf287be1 (diff) | |
download | bcm5719-llvm-c876e3d42be916a405fcbbc2fa75ecef9de95e11.tar.gz bcm5719-llvm-c876e3d42be916a405fcbbc2fa75ecef9de95e11.zip |
[PGO] Make pgo related options in opt more consistent.
Currently we have pgo options defined in PassManagerBuilder.cpp only for
instrument pgo, but not for sample pgo. We also have pgo options defined
in NewPMDriver.cpp in opt only for new pass manager and for all kinds of
pgo. They have some inconsistency.
To make the options more consistent and make tests writing easier, the
patch let old pass manager to share the same pgo options with new pass
manager in opt, and removes the options in PassManagerBuilder.cpp.
Differential Revision: https://reviews.llvm.org/D56749
llvm-svn: 351392
Diffstat (limited to 'llvm/tools/opt/opt.cpp')
-rw-r--r-- | llvm/tools/opt/opt.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/llvm/tools/opt/opt.cpp b/llvm/tools/opt/opt.cpp index a4967a234d9..21f28c7a621 100644 --- a/llvm/tools/opt/opt.cpp +++ b/llvm/tools/opt/opt.cpp @@ -275,6 +275,19 @@ static cl::opt<std::string> cl::desc("YAML output filename for pass remarks"), cl::value_desc("filename")); +cl::opt<PGOKind> + PGOKindFlag("pgo-kind", cl::init(NoPGO), cl::Hidden, + cl::desc("The kind of profile guided optimization"), + cl::values(clEnumValN(NoPGO, "nopgo", "Do not use PGO."), + clEnumValN(InstrGen, "pgo-instr-gen-pipeline", + "Instrument the IR to generate profile."), + clEnumValN(InstrUse, "pgo-instr-use-pipeline", + "Use instrumented profile to guide PGO."), + clEnumValN(SampleUse, "pgo-sample-use-pipeline", + "Use sampled profile to guide PGO."))); +cl::opt<std::string> ProfileFile("profile-file", + cl::desc("Path to the profile."), cl::Hidden); + class OptCustomPassManager : public legacy::PassManager { DebugifyStatsMap DIStatsMap; @@ -369,6 +382,21 @@ static void AddOptimizationPasses(legacy::PassManagerBase &MPM, if (Coroutines) addCoroutinePassesToExtensionPoints(Builder); + switch (PGOKindFlag) { + case InstrGen: + Builder.EnablePGOInstrGen = true; + Builder.PGOInstrGen = ProfileFile; + break; + case InstrUse: + Builder.PGOInstrUse = ProfileFile; + break; + case SampleUse: + Builder.PGOSampleUse = ProfileFile; + break; + default: + break; + } + Builder.populateFunctionPassManager(FPM); Builder.populateModulePassManager(MPM); } |