diff options
author | Dehao Chen <dehao@google.com> | 2017-08-02 01:28:31 +0000 |
---|---|---|
committer | Dehao Chen <dehao@google.com> | 2017-08-02 01:28:31 +0000 |
commit | cbd284128f6bede7c09c6e28dd205d948a5d6ddf (patch) | |
tree | 51bbdbc79709dedc742122869590459840f8fdf8 /lib/LTO | |
parent | dbd873dceb685962f5be9bb84c7fd1fb61f64530 (diff) |
Update the new PM pipeline to make ICP aware if it is SamplePGO build.
Summary: In ThinLTO backend compile, OPTOptions are not set so that the ICP in ThinLTO backend does not know if it is a SamplePGO build, in which profile count needs to be annotated directly on call instructions. This patch cleaned up the PGOOptions handling logic and passes down PGOOptions to ThinLTO backend.
Reviewers: chandlerc, tejohnson, davidxl
Reviewed By: chandlerc
Subscribers: sanjoy, llvm-commits, mehdi_amini
Differential Revision: https://reviews.llvm.org/D36052
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309780 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/LTO')
-rw-r--r-- | lib/LTO/LTOBackend.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/LTO/LTOBackend.cpp b/lib/LTO/LTOBackend.cpp index 3f72e446cdf..6d1e37fa7e1 100644 --- a/lib/LTO/LTOBackend.cpp +++ b/lib/LTO/LTOBackend.cpp @@ -131,9 +131,13 @@ createTargetMachine(Config &Conf, const Target *TheTarget, Module &M) { Conf.CodeModel, Conf.CGOptLevel)); } -static void runNewPMPasses(Module &Mod, TargetMachine *TM, unsigned OptLevel, - bool IsThinLTO) { - PassBuilder PB(TM); +static void runNewPMPasses(Config &Conf, Module &Mod, TargetMachine *TM, + unsigned OptLevel, bool IsThinLTO) { + Optional<PGOOptions> PGOOpt; + if (!Conf.SampleProfile.empty()) + PGOOpt = PGOOptions("", "", Conf.SampleProfile, false, true); + + PassBuilder PB(TM, PGOOpt); AAManager AA; // Parse a custom AA pipeline if asked to. @@ -262,7 +266,7 @@ bool opt(Config &Conf, TargetMachine *TM, unsigned Task, Module &Mod, runNewPMCustomPasses(Mod, TM, Conf.OptPipeline, Conf.AAPipeline, Conf.DisableVerify); else if (Conf.UseNewPM) - runNewPMPasses(Mod, TM, Conf.OptLevel, IsThinLTO); + runNewPMPasses(Conf, Mod, TM, Conf.OptLevel, IsThinLTO); else runOldPMPasses(Conf, Mod, TM, IsThinLTO, ExportSummary, ImportSummary); return !Conf.PostOptModuleHook || Conf.PostOptModuleHook(Task, Mod); |