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 llvm-svn: 309780
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user