[llvm] r361540 - [NewPassManager] Add tuning option: LoopUnrolling [NFC].
Alina Sbirlea via llvm-commits
llvm-commits at lists.llvm.org
Thu May 23 12:35:40 PDT 2019
Author: asbirlea
Date: Thu May 23 12:35:40 2019
New Revision: 361540
URL: http://llvm.org/viewvc/llvm-project?rev=361540&view=rev
Log:
[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
Modified:
llvm/trunk/include/llvm/Passes/PassBuilder.h
llvm/trunk/lib/Passes/PassBuilder.cpp
Modified: llvm/trunk/include/llvm/Passes/PassBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Passes/PassBuilder.h?rev=361540&r1=361539&r2=361540&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Passes/PassBuilder.h (original)
+++ llvm/trunk/include/llvm/Passes/PassBuilder.h Thu May 23 12:35:40 2019
@@ -85,6 +85,9 @@ public:
/// is that of the flag: `vectorize-slp`.
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
/// MemorySSA, in LICM.
unsigned LicmMssaOptCap;
Modified: llvm/trunk/lib/Passes/PassBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Passes/PassBuilder.cpp?rev=361540&r1=361539&r2=361540&view=diff
==============================================================================
--- llvm/trunk/lib/Passes/PassBuilder.cpp (original)
+++ llvm/trunk/lib/Passes/PassBuilder.cpp Thu May 23 12:35:40 2019
@@ -217,6 +217,7 @@ PipelineTuningOptions::PipelineTuningOpt
LoopInterleaving = EnableLoopInterleaving;
LoopVectorization = EnableLoopVectorization;
SLPVectorization = RunSLPVectorization;
+ LoopUnrolling = true;
LicmMssaOptCap = SetLicmMssaOptCap;
LicmMssaNoAccForPromotionCap = SetLicmMssaNoAccForPromotionCap;
}
@@ -459,8 +460,9 @@ PassBuilder::buildFunctionSimplification
// Do not enable unrolling in PreLinkThinLTO phase during sample PGO
// because it changes IR to makes profile annotation in back compile
// inaccurate.
- if (Phase != ThinLTOPhase::PreLink || !PGOOpt ||
- PGOOpt->Action != PGOOptions::SampleUse)
+ if ((Phase != ThinLTOPhase::PreLink || !PGOOpt ||
+ PGOOpt->Action != PGOOptions::SampleUse) &&
+ PTO.LoopUnrolling)
LPM2.addPass(LoopFullUnrollPass(Level));
for (auto &C : LoopOptimizerEndEPCallbacks)
@@ -907,7 +909,8 @@ ModulePassManager PassBuilder::buildModu
OptimizePM.addPass(
createFunctionToLoopPassAdaptor(LoopUnrollAndJamPass(Level)));
}
- OptimizePM.addPass(LoopUnrollPass(LoopUnrollOptions(Level)));
+ if (PTO.LoopUnrolling)
+ OptimizePM.addPass(LoopUnrollPass(LoopUnrollOptions(Level)));
OptimizePM.addPass(WarnMissedTransformationsPass());
OptimizePM.addPass(InstCombinePass());
OptimizePM.addPass(RequireAnalysisPass<OptimizationRemarkEmitterAnalysis, Function>());
More information about the llvm-commits
mailing list