54 cl::desc(
"Run the Loop vectorization passes"));
58 cl::desc(
"Run the SLP vectorization passes"));
63 cl::desc(
"Run GVN instead of Early CSE after vectorization passes"));
67 cl::desc(
"Run cleanup optimization passes after vectorization."));
71 cl::desc(
"Run the loop rerolling pass"));
79 cl::desc(
"Run the SLP vectorizer (and BB vectorizer) after the Loop " 80 "vectorizer instead of before"));
86 cl::desc(
"Enable the new, experimental CFL alias analysis"),
89 "Enable unification-based CFL-AA"),
91 "Enable inclusion-based CFL-AA"),
93 "Enable both variants of CFL-AA")));
97 cl::desc(
"Enable the new, experimental LoopInterchange Pass"));
101 cl::desc(
"Enable Unroll And Jam Pass"));
105 cl::desc(
"Enable preparation for ThinLTO."));
109 cl::desc(
"Enable PGO instrumentation."));
113 cl::desc(
"Specify the path of profile data file."));
117 cl::desc(
"Enable use phase of PGO instrumentation and specify the path " 118 "of profile data file"));
122 cl::desc(
"Enable the experimental Loop Versioning LICM pass"));
126 cl::desc(
"Disable pre-instrumentation inliner"));
130 cl::desc(
"Control the amount of inlining in pre-instrumentation inliner " 135 cl::desc(
"Enable the EarlyCSE w/ MemorySSA pass (default = on)"));
139 cl::desc(
"Enable the GVN hoisting pass (default = off)"));
144 cl::desc(
"Disable shrink-wrap library calls"));
148 cl::desc(
"Enable the simple loop unswitch pass. Also enables independent " 149 "cleanup passes integrated into the loop pass manager pipeline."));
153 cl::desc(
"Enable the GVN sinking pass (default = off)"));
158 LibraryInfo =
nullptr;
160 DisableUnrollLoops =
false;
165 DisableGVNLoadPRE =
false;
167 VerifyOutput =
false;
168 MergeFunctions =
false;
169 PrepareForLTO =
false;
174 PerformThinLTO =
false;
175 DivergentTarget =
false;
191 return GlobalExtensions.isConstructed() && !GlobalExtensions->empty();
195 PassManagerBuilder::ExtensionPointTy Ty,
197 GlobalExtensions->push_back(std::make_pair(Ty, std::move(Fn)));
201 Extensions.push_back(std::make_pair(Ty, std::move(Fn)));
207 for (
auto &
Ext : *GlobalExtensions) {
208 if (
Ext.first == ETy)
209 Ext.second(*
this, PM);
212 for (
unsigned i = 0, e =
Extensions.size(); i != e; ++i)
217 void PassManagerBuilder::addInitialAliasAnalysisPasses(
241 void PassManagerBuilder::addInstructionCombiningPass(
243 bool ExpensiveCombines = OptLevel > 2;
249 addExtensionsToPM(EP_EarlyAsPossible, FPM);
256 if (OptLevel == 0)
return;
258 addInitialAliasAnalysisPasses(FPM);
268 if (!EnablePGOInstrGen && PGOInstrUse.empty() && PGOSampleUse.empty())
272 if (OptLevel > 0 && SizeLevel == 0 && !DisablePreInliner &&
273 PGOSampleUse.empty()) {
289 addExtensionsToPM(EP_Peephole, MPM);
291 if (EnablePGOInstrGen) {
295 if (!PGOInstrGen.empty())
301 if (!PGOInstrUse.empty())
310 void PassManagerBuilder::addFunctionSimplificationPasses(
331 addInstructionCombiningPass(MPM);
332 if (SizeLevel == 0 && !DisableLibCallsShrinkWrap)
334 addExtensionsToPM(EP_Peephole, MPM);
345 if (EnableSimpleLoopUnswitch) {
355 if (EnableSimpleLoopUnswitch)
363 addInstructionCombiningPass(MPM);
367 addExtensionsToPM(EP_LateLoopOptimizations, MPM);
370 if (EnableLoopInterchange) {
375 if (!DisableUnrollLoops)
377 addExtensionsToPM(EP_LoopOptimizerEnd, MPM);
395 addInstructionCombiningPass(MPM);
396 addExtensionsToPM(EP_Peephole, MPM);
402 addExtensionsToPM(EP_ScalarOptimizerLate, MPM);
412 addInstructionCombiningPass(MPM);
413 addExtensionsToPM(EP_Peephole, MPM);
418 if (!PGOSampleUse.empty()) {
429 addPGOInstrPasses(MPM);
445 if (PerformThinLTO) {
453 addExtensionsToPM(EP_EnabledOnOptLevel0, MPM);
459 if (PrepareForLTO || PrepareForThinLTO)
468 addInitialAliasAnalysisPasses(MPM);
479 !PGOSampleUse.empty()));
484 bool PrepareForThinLTOUsingPGOSampleProfile =
485 PrepareForThinLTO && !PGOSampleUse.empty();
486 if (PrepareForThinLTOUsingPGOSampleProfile)
487 DisableUnrollLoops =
true;
492 addExtensionsToPM(EP_ModuleOptimizerEarly, MPM);
505 addInstructionCombiningPass(MPM);
506 addExtensionsToPM(EP_Peephole, MPM);
514 if (!PerformThinLTO && !PrepareForThinLTOUsingPGOSampleProfile)
515 addPGOInstrPasses(MPM);
524 bool RunInliner =
false;
535 addExtensionsToPM(EP_CGSCCOptimizerLate, MPM);
536 addFunctionSimplificationPasses(MPM);
546 if (OptLevel > 1 && !PrepareForLTO && !PrepareForThinLTO)
574 if (PrepareForThinLTO) {
577 addExtensionsToPM(EP_OptimizerLast, MPM);
593 if (UseLoopVersioningLICM) {
617 addExtensionsToPM(EP_VectorizerStart, MPM);
641 addInstructionCombiningPass(MPM);
651 addInstructionCombiningPass(MPM);
655 addInstructionCombiningPass(MPM);
672 addExtensionsToPM(EP_Peephole, MPM);
673 addInstructionCombiningPass(MPM);
675 if (!DisableUnrollLoops) {
676 if (EnableUnrollAndJam) {
686 addInstructionCombiningPass(MPM);
729 addExtensionsToPM(EP_OptimizerLast, MPM);
742 addInitialAliasAnalysisPasses(PM);
806 addInstructionCombiningPass(PM);
807 addExtensionsToPM(EP_Peephole, PM);
828 addInstructionCombiningPass(PM);
829 addExtensionsToPM(EP_Peephole, PM);
851 if (EnableLoopInterchange)
854 if (!DisableUnrollLoops)
858 if (!DisableUnrollLoops)
864 addInstructionCombiningPass(PM);
867 addInstructionCombiningPass(PM);
880 addInstructionCombiningPass(PM);
881 addExtensionsToPM(EP_Peephole, PM);
886 void PassManagerBuilder::addLateLTOOptimizationPasses(
905 PerformThinLTO =
true;
929 populateModulePassManager(PM);
933 PerformThinLTO =
false;
944 addLTOOptimizationPasses(PM);
962 addLateLTOOptimizationPasses(PM);
995 unsigned SizeLevel) {
1051 if (RunInliner && !Builder->
Inliner)
Super simple passes to force specific function attrs from the commandline into the IR for debugging p...
Defines passes for running instruction simplification across chunks of IR.
ModulePass * createNameAnonGlobalPass()
===------------------------------------------------------------------—===//
FunctionPass * createGVNPass(bool NoLoads=false)
Create a legacy GVN pass.
Pass * createLoopRerollPass()
Thresholds to tune inline cost analysis.
ModulePass * createStripDeadPrototypesPass()
createStripDeadPrototypesPass - This pass removes any function declarations (prototypes) that are not...
ModulePass * createPGOInstrumentationGenLegacyPass()
static cl::opt< bool > UseLoopVersioningLICM("enable-loop-versioning-licm", cl::init(false), cl::Hidden, cl::desc("Enable the experimental Loop Versioning LICM pass"))
PassManagerBuilder - This class is used to set up a standard optimization sequence for languages like...
This is the interface for LLVM's inclusion-based alias analysis implemented with CFL graph reachabili...
Compute iterated dominance frontiers using a linear time algorithm.
This is the interface for a simple mod/ref and alias analysis over globals.
static cl::opt< bool > EnableEarlyCSEMemSSA("enable-earlycse-memssa", cl::init(true), cl::Hidden, cl::desc("Enable the EarlyCSE w/ MemorySSA pass (default = on)"))
FunctionPass * createPGOMemOPSizeOptLegacyPass()
ModulePass * createMergeFunctionsPass()
createMergeFunctionsPass - This pass discovers identical functions and collapses them.
Pass * createLoopUnrollPass(int OptLevel=2, int Threshold=-1, int Count=-1, int AllowPartial=-1, int Runtime=-1, int UpperBound=-1, int AllowPeeling=-1)
void populateThinLTOPassManager(legacy::PassManagerBase &PM)
static cl::opt< bool > EnableGVNHoist("enable-gvn-hoist", cl::init(false), cl::Hidden, cl::desc("Enable the GVN hoisting pass (default = off)"))
This is the interface for a metadata-based scoped no-alias analysis.
static cl::opt< std::string > RunPGOInstrUse("profile-use", cl::init(""), cl::Hidden, cl::value_desc("filename"), cl::desc("Enable use phase of PGO instrumentation and specify the path " "of profile data file"))
FunctionPass * createVerifierPass(bool FatalErrors=true)
ModulePass * createIPSCCPPass()
createIPSCCPPass - This pass propagates constants from call sites into the bodies of functions...
FunctionPass * createFloat2IntPass()
virtual void add(Pass *P)=0
Add a pass to the queue of passes to run.
static cl::opt< std::string > PGOOutputFile("profile-generate-file", cl::init(""), cl::Hidden, cl::desc("Specify the path of profile data file."))
ModulePass * createEliminateAvailableExternallyPass()
This transform is designed to eliminate available external globals (functions or global variables) ...
FunctionPass * createGVNHoistPass()
static cl::opt< bool > RunPGOInstrGen("profile-generate", cl::init(false), cl::Hidden, cl::desc("Enable PGO instrumentation."))
ModulePass * createInstrProfilingLegacyPass(const InstrProfOptions &Options=InstrProfOptions())
Insert frontend instrumentation based profiling.
ImmutablePass * createScopedNoAliasAAWrapperPass()
FunctionPass * createAlignmentFromAssumptionsPass()
Pass * Inliner
Inliner - Specifies the inliner to use.
FunctionPass * createJumpThreadingPass(int Threshold=-1)
FunctionPass * createCFGSimplificationPass(unsigned Threshold=1, bool ForwardSwitchCond=false, bool ConvertSwitch=false, bool KeepLoops=true, bool SinkCommon=false, std::function< bool(const Function &)> Ftor=nullptr)
static cl::opt< bool > RunLoopVectorization("vectorize-loops", cl::Hidden, cl::desc("Run the Loop vectorization passes"))
ModulePass * createPartialInliningPass()
createPartialInliningPass - This pass inlines parts of functions.
Attribute unwrap(LLVMAttributeRef Attr)
static void addGlobalExtension(ExtensionPointTy Ty, ExtensionFn Fn)
Adds an extension that will be used by all PassManagerBuilder instances.
Optional< int > HintThreshold
Threshold to use for callees with inline hint.
void populateLTOPassManager(legacy::PassManagerBase &PM)
ModulePass * createCrossDSOCFIPass()
This pass export CFI checks for use by external modules.
static cl::opt< bool > ExtraVectorizerPasses("extra-vectorizer-passes", cl::init(false), cl::Hidden, cl::desc("Run cleanup optimization passes after vectorization."))
FunctionPass * createReassociatePass()
Pass * createSimpleLoopUnrollPass(int OptLevel=2)
Pass * createArgumentPromotionPass(unsigned maxElements=3)
createArgumentPromotionPass - This pass promotes "by reference" arguments to be passed by value if th...
FunctionPass * createAggressiveInstCombinerPass()
static cl::opt< bool > EnablePrepareForThinLTO("prepare-for-thinlto", cl::init(false), cl::Hidden, cl::desc("Enable preparation for ThinLTO."))
FunctionPass * createSCCPPass()
std::function< void(const PassManagerBuilder &Builder, legacy::PassManagerBase &PM)> ExtensionFn
Extensions are passed the builder itself (so they can see how it is configured) as well as the pass m...
unsigned OptLevel
The Optimization Level - Specify the basic optimization level.
static cl::opt< bool > UseGVNAfterVectorization("use-gvn-after-vectorization", cl::init(false), cl::Hidden, cl::desc("Run GVN instead of Early CSE after vectorization passes"))
Pass * createLoopVectorizePass(bool NoUnrolling=false, bool AlwaysVectorize=true)
void populateModulePassManager(legacy::PassManagerBase &MPM)
populateModulePassManager - This sets up the primary pass manager.
static cl::opt< bool > DisablePreInliner("disable-preinline", cl::init(false), cl::Hidden, cl::desc("Disable pre-instrumentation inliner"))
ModulePass * createCalledValuePropagationPass()
createCalledValuePropagationPass - Attach metadata to indirct call sites indicating the set of functi...
void add(Pass *P) override
Add a pass to the queue of passes to run.
FunctionPass * createInstSimplifyLegacyPass()
Create a legacy pass that does instruction simplification on each instruction in a function...
Pass * createLoopInstSimplifyPass()
static ManagedStatic< SmallVector< std::pair< PassManagerBuilder::ExtensionPointTy, PassManagerBuilder::ExtensionFn >, 8 > > GlobalExtensions
Set of global extensions, automatically added as part of the standard set.
static cl::opt< bool > RunSLPVectorization("vectorize-slp", cl::Hidden, cl::desc("Run the SLP vectorization passes"))
ModulePass * createSampleProfileLoaderPass()
FunctionPass * createInstructionCombiningPass(bool ExpensiveCombines=true)
ModulePass * createGlobalDCEPass()
createGlobalDCEPass - This transform is designed to eliminate unreachable internal globals (functions...
static cl::opt< bool > EnableUnrollAndJam("enable-unroll-and-jam", cl::init(false), cl::Hidden, cl::desc("Enable Unroll And Jam Pass"))
Pass * createLoopUnrollAndJamPass(int OptLevel=2)
Pass * createCorrelatedValuePropagationPass()
This is the interface for LLVM's unification-based alias analysis implemented with CFL graph reachabi...
initializer< Ty > init(const Ty &Val)
This is the interface for a metadata-based TBAA.
FunctionPass * createTailCallEliminationPass()
This file provides the primary interface to the aggressive instcombine pass.
This file provides the interface for LLVM's Global Value Numbering pass which eliminates fully redund...
ValuesClass values(OptsTy... Options)
Helper to build a ValuesClass by forwarding a variable number of arguments as an initializer list to ...
FunctionPass * createPromoteMemoryToRegisterPass()
ModulePass * createDeadArgEliminationPass()
createDeadArgEliminationPass - This pass removes arguments from functions which are not used by the b...
FunctionPass * createDivRemPairsPass()
FunctionPass * createDeadStoreEliminationPass()
ModulePass * createLowerTypeTestsPass(ModuleSummaryIndex *ExportSummary, const ModuleSummaryIndex *ImportSummary)
This pass lowers type metadata and the llvm.type.test intrinsic to bitsets.
ModulePass * createPGOInstrumentationUseLegacyPass(StringRef Filename=StringRef(""))
ModulePass * createBarrierNoopPass()
createBarrierNoopPass - This pass is purely a module pass barrier in a pass manager.
FunctionPass * createMemCpyOptPass()
The public interface to this file...
FunctionPass * createBitTrackingDCEPass()
ModulePass * createConstantMergePass()
createConstantMergePass - This function returns a new pass that merges duplicate global constants tog...
Pass * createLoopSinkPass()
ModulePass * createGlobalOptimizerPass()
createGlobalOptimizerPass - This function returns a new pass that optimizes non-address taken interna...
Pass * createReversePostOrderFunctionAttrsPass()
createReversePostOrderFunctionAttrsPass - This pass walks SCCs of the call graph in RPO to deduce and...
void populateFunctionPassManager(legacy::FunctionPassManager &FPM)
populateFunctionPassManager - This fills in the function pass manager, which is expected to be run on...
FunctionPassManager manages FunctionPasses and BasicBlockPassManagers.
Pass * createPostOrderFunctionAttrsLegacyPass()
Create a legacy pass manager instance of a pass to compute function attrs in post-order.
std::string InstrProfileOutput
Pass * createLoopVersioningLICMPass()
ModulePass * createGlobalSplitPass()
This pass splits globals into pieces for the benefit of whole-program devirtualization and control-fl...
static cl::opt< bool > EnableLoopInterchange("enable-loopinterchange", cl::init(false), cl::Hidden, cl::desc("Enable the new, experimental LoopInterchange Pass"))
Pass * createLoopInterchangePass()
PassManagerBase - An abstract interface to allow code to add passes to a pass manager without having ...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
FunctionPass * createLoopLoadEliminationPass()
static cl::opt< bool > RunSLPAfterLoopVectorization("run-slp-after-loop-vectorization", cl::init(true), cl::Hidden, cl::desc("Run the SLP vectorizer (and BB vectorizer) after the Loop " "vectorizer instead of before"))
Pass * createSimpleLoopUnswitchLegacyPass(bool NonTrivial=false)
Create the legacy pass object for the simple loop unswitcher.
static cl::opt< CFLAAType > UseCFLAA("use-cfl-aa", cl::init(CFLAAType::None), cl::Hidden, cl::desc("Enable the new, experimental CFL alias analysis"), cl::values(clEnumValN(CFLAAType::None, "none", "Disable CFL-AA"), clEnumValN(CFLAAType::Steensgaard, "steens", "Enable unification-based CFL-AA"), clEnumValN(CFLAAType::Andersen, "anders", "Enable inclusion-based CFL-AA"), clEnumValN(CFLAAType::Both, "both", "Enable both variants of CFL-AA")))
Pass * createLoopSimplifyCFGPass()
FunctionPass * createSpeculativeExecutionIfHasBranchDivergencePass()
FunctionPass * createMergedLoadStoreMotionPass()
createMergedLoadStoreMotionPass - The public interface to this file.
FunctionPass * createLibCallsShrinkWrapPass()
struct LLVMOpaquePassManager * LLVMPassManagerRef
Pass * createLoopDeletionPass()
Pass * createLoopUnswitchPass(bool OptimizeForSize=false, bool hasBranchDivergence=false)
Options for the frontend instrumentation based profiling pass.
static cl::opt< bool > EnableGVNSink("enable-gvn-sink", cl::init(false), cl::Hidden, cl::desc("Enable the GVN sinking pass (default = off)"))
Pass * createLoopIdiomPass()
#define clEnumValN(ENUMVAL, FLAGNAME, DESC)
ModulePass * createWholeProgramDevirtPass(ModuleSummaryIndex *ExportSummary, const ModuleSummaryIndex *ImportSummary)
This pass implements whole-program devirtualization using type metadata.
Interfaces for passes which infer implicit function attributes from the name and signature of functio...
static const struct @375 Extensions[]
LLVMAttributeRef wrap(Attribute Attr)
unsigned SizeLevel
SizeLevel - How much we're optimizing for size.
static cl::opt< bool > DisableLibCallsShrinkWrap("disable-libcalls-shrinkwrap", cl::init(false), cl::Hidden, cl::desc("Disable shrink-wrap library calls"))
FunctionPass * createGVNSinkPass()
ModulePass * createGlobalsAAWrapperPass()
FunctionPass * createSROAPass()
Pass * createInferFunctionAttrsLegacyPass()
Create a legacy pass manager instance of a pass to infer function attributes.
static bool GlobalExtensionsNotEmpty()
Check if GlobalExtensions is constructed and not empty.
Provides passes for computing function attributes based on interprocedural analyses.
ImmutablePass * createCFLSteensAAWrapperPass()
ImmutablePass * createTypeBasedAAWrapperPass()
Pass * createSLPVectorizerPass()
static int const Threshold
TODO: Write a new FunctionPass AliasAnalysis so that it can keep a cache.
Pass * createFunctionInliningPass()
createFunctionInliningPass - Return a new pass object that uses a heuristic to inline direct function...
Pass * createPruneEHPass()
createPruneEHPass - Return a new pass object which transforms invoke instructions into calls...
LLVM Value Representation.
FunctionPass * createEarlyCSEPass(bool UseMemorySSA=false)
static cl::opt< int > PreInlineThreshold("preinline-threshold", cl::Hidden, cl::init(75), cl::ZeroOrMore, cl::desc("Control the amount of inlining in pre-instrumentation inliner " "(default = 75)"))
FunctionPass * createNewGVNPass()
This is the interface for LLVM's primary stateless and local alias analysis.
static cl::opt< bool > RunPartialInlining("enable-partial-inlining", cl::init(false), cl::Hidden, cl::ZeroOrMore, cl::desc("Run Partial inlinining pass"))
ManagedStatic - This transparently changes the behavior of global statics to be lazily constructed on...
static cl::opt< bool > EnableSimpleLoopUnswitch("enable-simple-loop-unswitch", cl::init(false), cl::Hidden, cl::desc("Enable the simple loop unswitch pass. Also enables independent " "cleanup passes integrated into the loop pass manager pipeline."))
ImmutablePass * createCFLAndersAAWrapperPass()
void addExtension(ExtensionPointTy Ty, ExtensionFn Fn)
FunctionPass * createEntryExitInstrumenterPass()
ModulePass * createPGOIndirectCallPromotionLegacyPass(bool InLTO=false, bool SamplePGO=false)
Pass * createForceFunctionAttrsLegacyPass()
Create a legacy pass manager instance of a pass to force function attrs.
Pass * createLoopRotatePass(int MaxHeaderSize=-1)
Pass * createIndVarSimplifyPass()
FunctionPass * createAggressiveDCEPass()
int DefaultThreshold
The default threshold to start with for a callee.
FunctionPass * createLoopDistributePass()
FunctionPass * createLowerExpectIntrinsicPass()
static cl::opt< bool > RunLoopRerolling("reroll-loops", cl::Hidden, cl::desc("Run the loop rerolling pass"))
static cl::opt< bool > RunNewGVN("enable-newgvn", cl::init(false), cl::Hidden, cl::desc("Run the NewGVN pass"))
FunctionPass * createCallSiteSplittingPass()