52 cl::desc(
"Run the Loop vectorization passes"));
56 cl::desc(
"Run the SLP vectorization passes"));
61 cl::desc(
"Run GVN instead of Early CSE after vectorization passes"));
65 cl::desc(
"Run cleanup optimization passes after vectorization."));
69 cl::desc(
"Run the loop rerolling pass"));
77 cl::desc(
"Run the SLP vectorizer (and BB vectorizer) after the Loop "
78 "vectorizer instead of before"));
84 cl::desc(
"Enable the new, experimental CFL alias analysis"),
87 "Enable unification-based CFL-AA"),
89 "Enable inclusion-based CFL-AA"),
91 "Enable both variants of CFL-AA")));
95 cl::desc(
"Enable the new, experimental LoopInterchange Pass"));
100 "Enable the GlobalsModRef AliasAnalysis outside of the LTO pipeline."));
104 cl::desc(
"Enable the LoopLoadElimination Pass"));
108 cl::desc(
"Enable preparation for ThinLTO."));
112 cl::desc(
"Enable PGO instrumentation."));
116 cl::desc(
"Specify the path of profile data file."));
120 cl::desc(
"Enable use phase of PGO instrumentation and specify the path "
121 "of profile data file"));
125 cl::desc(
"Enable the experimental Loop Versioning LICM pass"));
129 cl::desc(
"Disable pre-instrumentation inliner"));
133 cl::desc(
"Control the amount of inlining in pre-instrumentation inliner "
138 cl::desc(
"Enable the EarlyCSE w/ MemorySSA pass (default = on)"));
142 cl::desc(
"Enable the GVN hoisting pass (default = off)"));
147 cl::desc(
"Disable shrink-wrap library calls"));
152 cl::desc(
"Enable the simple loop unswitch pass."));
156 cl::desc(
"Enable the GVN sinking pass (default = off)"));
205 Extensions.push_back(std::make_pair(Ty, std::move(Fn)));
208 void PassManagerBuilder::addExtensionsToPM(ExtensionPointTy ETy,
212 if (
Ext.first == ETy)
213 Ext.second(*
this, PM);
216 for (
unsigned i = 0, e = Extensions.size(); i != e; ++i)
217 if (Extensions[i].
first == ETy)
218 Extensions[i].second(*
this, PM);
221 void PassManagerBuilder::addInitialAliasAnalysisPasses(
245 void PassManagerBuilder::addInstructionCombiningPass(
247 bool ExpensiveCombines =
OptLevel > 2;
261 addInitialAliasAnalysisPasses(FPM);
313 void PassManagerBuilder::addFunctionSimplificationPasses(
332 addInstructionCombiningPass(MPM);
352 addInstructionCombiningPass(MPM);
381 addInstructionCombiningPass(MPM);
398 addInstructionCombiningPass(MPM);
415 addPGOInstrPasses(MPM);
446 addInitialAliasAnalysisPasses(MPM);
462 bool PrepareForThinLTOUsingPGOSampleProfile =
464 if (PrepareForThinLTOUsingPGOSampleProfile)
480 addInstructionCombiningPass(MPM);
491 addPGOInstrPasses(MPM);
512 addFunctionSimplificationPasses(MPM);
608 addInstructionCombiningPass(MPM);
618 addInstructionCombiningPass(MPM);
622 addInstructionCombiningPass(MPM);
634 addInstructionCombiningPass(MPM);
640 addInstructionCombiningPass(MPM);
689 addInitialAliasAnalysisPasses(PM);
744 addInstructionCombiningPass(PM);
766 addInstructionCombiningPass(PM);
802 addInstructionCombiningPass(PM);
805 addInstructionCombiningPass(PM);
818 addInstructionCombiningPass(PM);
824 void PassManagerBuilder::addLateLTOOptimizationPasses(
880 addLTOOptimizationPasses(PM);
898 addLateLTOOptimizationPasses(PM);
931 unsigned SizeLevel) {
988 if (RunInliner && !Builder->
Inliner)
Super simple passes to force specific function attrs from the commandline into the IR for debugging p...
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...
bool EnablePGOInstrGen
Enable profile instrumentation pass.
This is the interface for LLVM's inclusion-based alias analysis implemented with CFL graph reachabili...
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"))
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.
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.
EP_ScalarOptimizerLate - This extension point allows adding optimization passes after most of the mai...
FunctionPass * createVerifierPass(bool FatalErrors=true)
ModuleSummaryIndex * ExportSummary
The module summary index to use for exporting information from the regular LTO phase, for example for the CFI and devirtualization type tests.
ModulePass * createIPSCCPPass()
createIPSCCPPass - This pass propagates constants from call sites into the bodies of functions...
FunctionPass * createFloat2IntPass()
const ModuleSummaryIndex * ImportSummary
The module summary index to use for importing information to the thin LTO backends, for example for the CFI and devirtualization type tests.
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.
std::string PGOSampleUse
Path of the sample Profile data file.
ImmutablePass * createScopedNoAliasAAWrapperPass()
FunctionPass * createAlignmentFromAssumptionsPass()
Pass * Inliner
Inliner - Specifies the inliner to use.
FunctionPass * createJumpThreadingPass(int Threshold=-1)
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...
static cl::opt< bool > EnableSimpleLoopUnswitch("enable-simple-loop-unswitch", cl::init(false), cl::Hidden, cl::desc("Enable the simple loop unswitch pass."))
static cl::opt< bool > EnablePrepareForThinLTO("prepare-for-thinlto", cl::init(false), cl::Hidden, cl::desc("Enable preparation for ThinLTO."))
EP_ModuleOptimizerEarly - This extension point allows adding passes just before the main module-level...
FunctionPass * createSCCPPass()
FunctionPass * createCFGSimplificationPass(int Threshold=-1, std::function< bool(const Function &)> Ftor=nullptr)
EP_EnabledOnOptLevel0 - This extension point allows adding passes that should not be disabled by O0 o...
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< 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"))
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"))
void add(Pass *P) override
Add a pass to the queue of passes to run.
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"))
FunctionPass * createNewGVNPass()
ModulePass * createSampleProfileLoaderPass()
FunctionPass * createInstructionCombiningPass(bool ExpensiveCombines=true)
ModulePass * createGlobalDCEPass()
createGlobalDCEPass - This transform is designed to eliminate unreachable internal globals (functions...
std::string PGOInstrUse
Path of the profile data file.
ValuesClass values(OptsTy...Options)
Helper to build a ValuesClass by forwarding a variable number of arguments as an initializer list to ...
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 interface for LLVM's Global Value Numbering pass which eliminates fully redund...
FunctionPass * createPromoteMemoryToRegisterPass()
TargetLibraryInfoImpl * LibraryInfo
LibraryInfo - Specifies information about the runtime library for the optimizer.
ModulePass * createDeadArgEliminationPass()
createDeadArgEliminationPass - This pass removes arguments from functions which are not used by the b...
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...
FunctionPass * createLateCFGSimplificationPass(int Threshold=-1, std::function< bool(const Function &)> Ftor=nullptr)
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...
EP_OptimizerLast – This extension point allows adding passes that run after everything else...
EP_EarlyAsPossible - This extension point allows adding passes before any other transformations, allowing them to see the code as it is coming out of the frontend.
static cl::opt< bool > EnableLoopInterchange("enable-loopinterchange", cl::init(false), cl::Hidden, cl::desc("Enable the new, experimental LoopInterchange Pass"))
EP_CGSCCOptimizerLate - This extension point allows adding CallGraphSCC passes at the end of the main...
EP_VectorizerStart - This extension point allows adding optimization passes before the vectorizer and...
static cl::opt< bool > EnableLoopLoadElim("enable-loop-load-elim", cl::init(true), cl::Hidden, cl::desc("Enable the LoopLoadElimination 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()
Pass * createSimpleLoopUnswitchLegacyPass()
Create the legacy pass object for the simple loop unswitcher.
FunctionPass * createSpeculativeExecutionIfHasBranchDivergencePass()
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)"))
Pass * createLoopUnrollPass(int OptLevel=2, int Threshold=-1, int Count=-1, int AllowPartial=-1, int Runtime=-1, int UpperBound=-1)
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)"))
EP_Peephole - This extension point allows adding passes that perform peephole optimizations similar t...
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...
std::string PGOInstrGen
Profile data file name that the instrumentation will be written to.
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 cl::opt< bool > EnableNonLTOGlobalsModRef("enable-non-lto-gmr", cl::init(true), cl::Hidden, cl::desc("Enable the GlobalsModRef AliasAnalysis outside of the LTO pipeline."))
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.
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")))
ModuleSummaryIndex.h This file contains the declarations the classes that hold the module index and s...
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)
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...
ImmutablePass * createCFLAndersAAWrapperPass()
void addExtension(ExtensionPointTy Ty, ExtensionFn Fn)
FunctionPass * createInstructionSimplifierPass()
EP_LateLoopOptimizations - This extension point allows adding late loop canonicalization and simplifi...
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()
EP_LoopOptimizerEnd - This extension point allows adding loop passes to the end of the loop optimizer...
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"))
ModulePass * createPGOIndirectCallPromotionLegacyPass(bool InLTO=false, bool SamplePGO=false)