summaryrefslogtreecommitdiffstats
path: root/llvm/lib/LTO/LTOBackend.cpp
diff options
context:
space:
mode:
authorRong Xu <xur@google.com>2019-03-04 20:21:27 +0000
committerRong Xu <xur@google.com>2019-03-04 20:21:27 +0000
commitdb29a3a438d5991045b5980b2c70c1f48fb710ac (patch)
treefb4d74e9bbc88e9f9fbfff1d2b8243c92b9cc097 /llvm/lib/LTO/LTOBackend.cpp
parentbb4d4e2d767b451c88d8f226d62ab7c81f46711b (diff)
downloadbcm5719-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/lib/LTO/LTOBackend.cpp')
-rw-r--r--llvm/lib/LTO/LTOBackend.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp
index 02e51fbfa35..0595771bd00 100644
--- a/llvm/lib/LTO/LTOBackend.cpp
+++ b/llvm/lib/LTO/LTOBackend.cpp
@@ -154,8 +154,15 @@ static void runNewPMPasses(Config &Conf, Module &Mod, TargetMachine *TM,
const ModuleSummaryIndex *ImportSummary) {
Optional<PGOOptions> PGOOpt;
if (!Conf.SampleProfile.empty())
- PGOOpt = PGOOptions("", "", Conf.SampleProfile, Conf.ProfileRemapping,
- false, true);
+ PGOOpt = PGOOptions(Conf.SampleProfile, "", Conf.ProfileRemapping,
+ PGOOptions::SampleUse, PGOOptions::NoCSAction, true);
+ else if (Conf.RunCSIRInstr) {
+ PGOOpt = PGOOptions("", Conf.CSIRProfile, Conf.ProfileRemapping,
+ PGOOptions::IRUse, PGOOptions::CSIRInstr);
+ } else if (!Conf.CSIRProfile.empty()) {
+ PGOOpt = PGOOptions(Conf.CSIRProfile, "", Conf.ProfileRemapping,
+ PGOOptions::IRUse, PGOOptions::CSIRUse);
+ }
PassBuilder PB(TM, PGOOpt);
AAManager AA;
@@ -273,6 +280,11 @@ static void runOldPMPasses(Config &Conf, Module &Mod, TargetMachine *TM,
PMB.SLPVectorize = true;
PMB.OptLevel = Conf.OptLevel;
PMB.PGOSampleUse = Conf.SampleProfile;
+ PMB.EnablePGOCSInstrGen = Conf.RunCSIRInstr;
+ if (!Conf.RunCSIRInstr && !Conf.CSIRProfile.empty()) {
+ PMB.EnablePGOCSInstrUse = true;
+ PMB.PGOInstrUse = Conf.CSIRProfile;
+ }
if (IsThinLTO)
PMB.populateThinLTOPassManager(passes);
else
OpenPOWER on IntegriCloud