diff options
author | Rong Xu <xur@google.com> | 2019-03-04 20:21:27 +0000 |
---|---|---|
committer | Rong Xu <xur@google.com> | 2019-03-04 20:21:27 +0000 |
commit | db29a3a438d5991045b5980b2c70c1f48fb710ac (patch) | |
tree | fb4d74e9bbc88e9f9fbfff1d2b8243c92b9cc097 /llvm/tools/opt/opt.cpp | |
parent | bb4d4e2d767b451c88d8f226d62ab7c81f46711b (diff) | |
download | bcm5719-llvm-db29a3a438d5991045b5980b2c70c1f48fb710ac.tar.gz bcm5719-llvm-db29a3a438d5991045b5980b2c70c1f48fb710ac.zip |
[PGO] Context sensitive PGO (part 3)
Part 3 of CSPGO changes (mostly related to PassMananger).
Differential Revision: https://reviews.llvm.org/D54175
llvm-svn: 355330
Diffstat (limited to 'llvm/tools/opt/opt.cpp')
-rw-r--r-- | llvm/tools/opt/opt.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/llvm/tools/opt/opt.cpp b/llvm/tools/opt/opt.cpp index 4afe7508fc2..aef6df4a09d 100644 --- a/llvm/tools/opt/opt.cpp +++ b/llvm/tools/opt/opt.cpp @@ -287,6 +287,22 @@ cl::opt<PGOKind> cl::opt<std::string> ProfileFile("profile-file", cl::desc("Path to the profile."), cl::Hidden); +cl::opt<CSPGOKind> CSPGOKindFlag( + "cspgo-kind", cl::init(NoCSPGO), cl::Hidden, + cl::desc("The kind of context sensitive profile guided optimization"), + cl::values( + clEnumValN(NoCSPGO, "nocspgo", "Do not use CSPGO."), + clEnumValN( + CSInstrGen, "cspgo-instr-gen-pipeline", + "Instrument (context sensitive) the IR to generate profile."), + clEnumValN( + CSInstrUse, "cspgo-instr-use-pipeline", + "Use instrumented (context sensitive) profile to guide PGO."))); +cl::opt<std::string> CSProfileGenFile( + "cs-profilegen-file", + cl::desc("Path to the instrumented context sensitive profile."), + cl::Hidden); + class OptCustomPassManager : public legacy::PassManager { DebugifyStatsMap DIStatsMap; @@ -396,6 +412,17 @@ static void AddOptimizationPasses(legacy::PassManagerBase &MPM, break; } + switch (CSPGOKindFlag) { + case CSInstrGen: + Builder.EnablePGOCSInstrGen = true; + break; + case InstrUse: + Builder.EnablePGOCSInstrUse = true; + break; + default: + break; + } + Builder.populateFunctionPassManager(FPM); Builder.populateModulePassManager(MPM); } |