[NewPassManager] Add tuning option: LoopUnrolling [NFC].

Summary: Mirror tuning option from old pass manager in new pass manager.

Reviewers: chandlerc

Subscribers: jlebar, dmgreen, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D61618

llvm-svn: 361540
This commit is contained in:
Alina Sbirlea 2019-05-23 19:35:40 +00:00
parent a83bf47770
commit e4b27869c6
2 changed files with 9 additions and 3 deletions

View File

@ -85,6 +85,9 @@ public:
/// is that of the flag: `vectorize-slp`. /// is that of the flag: `vectorize-slp`.
bool SLPVectorization; bool SLPVectorization;
/// Tuning option to enable/disable loop unrolling. Its default value is true.
bool LoopUnrolling;
/// Tuning option to cap the number of calls to retrive clobbering accesses in /// Tuning option to cap the number of calls to retrive clobbering accesses in
/// MemorySSA, in LICM. /// MemorySSA, in LICM.
unsigned LicmMssaOptCap; unsigned LicmMssaOptCap;

View File

@ -217,6 +217,7 @@ PipelineTuningOptions::PipelineTuningOptions() {
LoopInterleaving = EnableLoopInterleaving; LoopInterleaving = EnableLoopInterleaving;
LoopVectorization = EnableLoopVectorization; LoopVectorization = EnableLoopVectorization;
SLPVectorization = RunSLPVectorization; SLPVectorization = RunSLPVectorization;
LoopUnrolling = true;
LicmMssaOptCap = SetLicmMssaOptCap; LicmMssaOptCap = SetLicmMssaOptCap;
LicmMssaNoAccForPromotionCap = SetLicmMssaNoAccForPromotionCap; LicmMssaNoAccForPromotionCap = SetLicmMssaNoAccForPromotionCap;
} }
@ -459,8 +460,9 @@ PassBuilder::buildFunctionSimplificationPipeline(OptimizationLevel Level,
// Do not enable unrolling in PreLinkThinLTO phase during sample PGO // Do not enable unrolling in PreLinkThinLTO phase during sample PGO
// because it changes IR to makes profile annotation in back compile // because it changes IR to makes profile annotation in back compile
// inaccurate. // inaccurate.
if (Phase != ThinLTOPhase::PreLink || !PGOOpt || if ((Phase != ThinLTOPhase::PreLink || !PGOOpt ||
PGOOpt->Action != PGOOptions::SampleUse) PGOOpt->Action != PGOOptions::SampleUse) &&
PTO.LoopUnrolling)
LPM2.addPass(LoopFullUnrollPass(Level)); LPM2.addPass(LoopFullUnrollPass(Level));
for (auto &C : LoopOptimizerEndEPCallbacks) for (auto &C : LoopOptimizerEndEPCallbacks)
@ -907,7 +909,8 @@ ModulePassManager PassBuilder::buildModuleOptimizationPipeline(
OptimizePM.addPass( OptimizePM.addPass(
createFunctionToLoopPassAdaptor(LoopUnrollAndJamPass(Level))); createFunctionToLoopPassAdaptor(LoopUnrollAndJamPass(Level)));
} }
OptimizePM.addPass(LoopUnrollPass(LoopUnrollOptions(Level))); if (PTO.LoopUnrolling)
OptimizePM.addPass(LoopUnrollPass(LoopUnrollOptions(Level)));
OptimizePM.addPass(WarnMissedTransformationsPass()); OptimizePM.addPass(WarnMissedTransformationsPass());
OptimizePM.addPass(InstCombinePass()); OptimizePM.addPass(InstCombinePass());
OptimizePM.addPass(RequireAnalysisPass<OptimizationRemarkEmitterAnalysis, Function>()); OptimizePM.addPass(RequireAnalysisPass<OptimizationRemarkEmitterAnalysis, Function>());