Go to the documentation of this file.
49 cl::desc(
"Run Partial inlinining pass"));
54 cl::desc(
"Run GVN instead of Early CSE after vectorization passes"));
58 cl::desc(
"Run cleanup optimization passes after vectorization."));
62 cl::desc(
"Run the loop rerolling pass"));
70 cl::desc(
"Enable the new, experimental CFL alias analysis"),
73 "Enable unification-based CFL-AA"),
75 "Enable inclusion-based CFL-AA"),
77 "Enable both variants of CFL-AA")));
81 cl::desc(
"Enable the experimental LoopInterchange Pass"));
85 cl::desc(
"Enable Unroll And Jam Pass"));
89 cl::desc(
"Enable the LoopFlatten Pass"));
92 cl::desc(
"Enable DFA jump threading."),
97 cl::desc(
"Enable preparation for ThinLTO."));
101 cl::desc(
"Enable performing ThinLTO."));
107 cl::desc(
"Enable ir outliner pass"));
111 cl::desc(
"Enable the experimental Loop Versioning LICM pass"));
115 cl::desc(
"Disable pre-instrumentation inliner"));
119 cl::desc(
"Control the amount of inlining in pre-instrumentation inliner "
124 cl::desc(
"Enable the GVN hoisting pass (default = off)"));
129 cl::desc(
"Disable shrink-wrap library calls"));
133 cl::desc(
"Enable the GVN sinking pass (default = off)"));
139 cl::desc(
"Enable control height reduction optimization (CHR)"));
143 cl::desc(
"Indicate the sample profile being used is flattened, i.e., "
144 "no inline hierachy exists in the profile. "));
148 cl::desc(
"Enable order file instrumentation (default = off)"));
152 cl::desc(
"Enable lowering of the matrix intrinsics"));
157 "Enable pass to eliminate conditions based on linear constraints."));
161 cl::desc(
"Enable Function Specialization pass"));
165 cl::desc(
"Enable the attributor inter-procedural deduction pass."),
167 "enable all attributor runs"),
169 "enable module-wide attributor runs"),
171 "enable call graph SCC attributor runs"),
173 "disable attributor runs")));
245 auto GlobalExtension =
247 return std::get<2>(elem) == ExtensionID;
250 "The extension ID to be removed should always be valid.");
256 Extensions.push_back(std::make_pair(Ty,
std::move(Fn)));
259 void PassManagerBuilder::addExtensionsToPM(ExtensionPointTy ETy,
263 if (std::get<0>(
Ext) == ETy)
264 std::get<1>(
Ext)(*
this, PM);
267 for (
unsigned i = 0,
e = Extensions.size();
i !=
e; ++
i)
268 if (Extensions[
i].first == ETy)
269 Extensions[
i].second(*
this, PM);
272 void PassManagerBuilder::addInitialAliasAnalysisPasses(
275 case ::CFLAAType::Steensgaard:
278 case ::CFLAAType::Andersen:
281 case ::CFLAAType::Both:
313 addInitialAliasAnalysisPasses(FPM);
323 void PassManagerBuilder::addFunctionSimplificationPasses(
327 assert(
OptLevel >= 1 &&
"Calling function optimizer with no optimization level!");
537 .forwardSwitchCondToPhi(
true)
538 .convertSwitchRangeToICmp(
true)
539 .convertSwitchToLookupTable(
true)
540 .needCanonicalLoops(
false)
541 .hoistCommonInsts(
true)
542 .sinkCommonInsts(
true)));
660 addInitialAliasAnalysisPasses(
MPM);
676 bool PrepareForThinLTOUsingPGOSampleProfile =
678 if (PrepareForThinLTOUsingPGOSampleProfile)
719 bool RunInliner =
false;
740 addFunctionSimplificationPasses(
MPM);
848 addVectorPasses(
MPM,
false);
916 addInitialAliasAnalysisPasses(PM);
1055 addVectorPasses(PM,
true);
1062 void PassManagerBuilder::addLateLTOOptimizationPasses(
1097 unsigned OptLevel) {
1104 unsigned SizeLevel) {
1106 Builder->SizeLevel = SizeLevel;
1130 unsigned Threshold) {
1140 Builder->populateFunctionPassManager(*FPM);
FunctionPass * createLoopLoadEliminationPass()
@ EP_OptimizerLast
EP_OptimizerLast – This extension point allows adding passes that run after everything else.
FunctionPass * createAssumeSimplifyPass()
FunctionPass * createMergedLoadStoreMotionPass(bool SplitFooterBB=false)
createMergedLoadStoreMotionPass - The public interface to this file.
Pass * createSimpleLoopUnswitchLegacyPass(bool NonTrivial=false)
Create the legacy pass object for the simple loop unswitcher.
cl::opt< bool > RunNewGVN
FunctionPass * createGVNSinkPass()
std::string PGOSampleUse
Path of the sample Profile data file.
This is an optimization pass for GlobalISel generic memory operations.
FunctionPass * createTailCallEliminationPass()
ImmutablePass * createCFLAndersAAWrapperPass()
cl::opt< bool > EnableHotColdSplit
ModulePass * createLowerTypeTestsPass(ModuleSummaryIndex *ExportSummary, const ModuleSummaryIndex *ImportSummary, bool DropTypeTests=false)
This pass lowers type metadata and the llvm.type.test intrinsic to bitsets.
cl::opt< bool > ExtraVectorizerPasses
cl::opt< bool > EnableConstraintElimination
FunctionPass * createCFGSimplificationPass(SimplifyCFGOptions Options=SimplifyCFGOptions(), std::function< bool(const Function &)> Ftor=nullptr)
cl::opt< unsigned > SetLicmMssaNoAccForPromotionCap
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Pass * createLoopSimplifyCFGPass()
Pass * createPruneEHPass()
createPruneEHPass - Return a new pass object which transforms invoke instructions into calls,...
cl::opt< bool > RunPartialInlining
FunctionPass * createEarlyCSEPass(bool UseMemorySSA=false)
ModulePass * createSampleProfileLoaderPass()
ModulePass * createDeadArgEliminationPass()
createDeadArgEliminationPass - This pass removes arguments from functions which are not used by the b...
Pass * createVectorCombinePass()
ImmutablePass * createCFLSteensAAWrapperPass()
Pass * createLoopIdiomPass()
FunctionPass * createDeadStoreEliminationPass()
bool ForgetAllSCEVInLoopUnroll
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")))
cl::opt< bool > EnableKnowledgeRetention
enable preservation of attributes in assume like: call void @llvm.assume(i1 true) [ "nonnull"(i32* PT...
ModulePass * createBarrierNoopPass()
createBarrierNoopPass - This pass is purely a module pass barrier in a pass manager.
FunctionPass * createMemCpyOptPass()
The public interface to this file...
ModulePass * createMergeFunctionsPass()
createMergeFunctionsPass - This pass discovers identical functions and collapses them.
ModuleSummaryIndex * ExportSummary
The module summary index to use for exporting information from the regular LTO phase,...
cl::opt< bool > EnableOrderFileInstrumentation
FunctionPass * createGVNPass(bool NoMemDepAnalysis=false)
Create a legacy GVN pass.
cl::opt< bool > EnableMatrix
Pass * createAttributorLegacyPass()
ModulePass * createCGProfileLegacyPass()
FunctionPass * createCallSiteSplittingPass()
Pass * createInferFunctionAttrsLegacyPass()
Create a legacy pass manager instance of a pass to infer function attributes.
ModulePass * createNameAnonGlobalPass()
===------------------------------------------------------------------—===//
FunctionPass * createControlHeightReductionLegacyPass()
ModulePass * createStripDeadPrototypesPass()
createStripDeadPrototypesPass - This pass removes any function declarations (prototypes) that are not...
@ EP_LoopOptimizerEnd
EP_LoopOptimizerEnd - This extension point allows adding loop passes to the end of the loop optimizer...
Pass * createAttributorCGSCCLegacyPass()
FunctionPass * createFloat2IntPass()
FunctionPass * createDivRemPairsPass()
Pass * createSLPVectorizerPass()
std::string PGOInstrGen
Profile data file name that the instrumentation will be written to.
static ManagedStatic< SmallVector< std::tuple< PassManagerBuilder::ExtensionPointTy, PassManagerBuilder::ExtensionFn, PassManagerBuilder::GlobalExtensionID >, 8 > > GlobalExtensions
Set of global extensions, automatically added as part of the standard set.
Pass * createForceFunctionAttrsLegacyPass()
Create a legacy pass manager instance of a pass to force function attrs.
FunctionPass * createDFAJumpThreadingPass()
cl::opt< bool > FlattenedProfileUsed
Pass * createLoopSinkPass()
static GlobalExtensionID addGlobalExtension(ExtensionPointTy Ty, ExtensionFn Fn)
Adds an extension that will be used by all PassManagerBuilder instances.
Pass * createLoopInterchangePass()
ModulePass * createCanonicalizeAliasesPass()
TargetLibraryInfoImpl * LibraryInfo
LibraryInfo - Specifies information about the runtime library for the optimizer.
ModulePass * createWholeProgramDevirtPass(ModuleSummaryIndex *ExportSummary, const ModuleSummaryIndex *ImportSummary)
This pass implements whole-program devirtualization using type metadata.
Pass * createLowerMatrixIntrinsicsPass()
Pass * createLoopVersioningLICMPass()
ModulePass * createGlobalSplitPass()
This pass splits globals into pieces for the benefit of whole-program devirtualization and control-fl...
FunctionPass * createNewGVNPass()
ManagedStatic - This transparently changes the behavior of global statics to be lazily constructed on...
static cl::opt< bool > DisableLibCallsShrinkWrap("disable-libcalls-shrinkwrap", cl::init(false), cl::Hidden, cl::desc("Disable shrink-wrap library calls"))
static PassManagerBuilder::GlobalExtensionID GlobalExtensionsCounter
cl::opt< bool > DisablePreInliner
FunctionPass * createLibCallsShrinkWrapPass()
Attribute unwrap(LLVMAttributeRef Attr)
Pass * Inliner
Inliner - Specifies the inliner to use.
Pass * createIndVarSimplifyPass()
FunctionPass * createAnnotationRemarksLegacyPass()
ModulePass * createGlobalOptimizerPass()
createGlobalOptimizerPass - This function returns a new pass that optimizes non-address taken interna...
FunctionPass * createLoopDistributePass()
cl::opt< int > PreInlineThreshold
unsigned LicmMssaNoAccForPromotionCap
cl::opt< bool > EnableDFAJumpThreading
ModulePass * createHotColdSplittingPass()
createHotColdSplittingPass - This pass outlines cold blocks into a separate function(s).
Pass * createSimpleLoopUnrollPass(int OptLevel=2, bool OnlyWhenForced=false, bool ForgetAllSCEV=false)
Pass * createFunctionInliningPass()
createFunctionInliningPass - Return a new pass object that uses a heuristic to inline direct function...
virtual void add(Pass *P)=0
Add a pass to the queue of passes to run.
static cl::opt< bool > EnablePrepareForThinLTO("prepare-for-thinlto", cl::init(false), cl::Hidden, cl::desc("Enable preparation for ThinLTO."))
PassManagerBuilder - This class is used to set up a standard optimization sequence for languages like...
ModulePass * createGlobalsAAWrapperPass()
ModulePass * createIPSCCPPass()
createIPSCCPPass - This pass propagates constants from call sites into the bodies of functions,...
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 * createLoopRerollPass()
ValuesClass values(OptsTy... Options)
Helper to build a ValuesClass by forwarding a variable number of arguments as an initializer list to ...
FunctionPass * createGVNHoistPass()
static cl::opt< bool > RunLoopRerolling("reroll-loops", cl::Hidden, cl::desc("Run the loop rerolling pass"))
@ EP_ScalarOptimizerLate
EP_ScalarOptimizerLate - This extension point allows adding optimization passes after most of the mai...
Pass * createReversePostOrderFunctionAttrsPass()
createReversePostOrderFunctionAttrsPass - This pass walks SCCs of the call graph in RPO to deduce and...
FunctionPass * createAggressiveInstCombinerPass()
ModulePass * createGlobalDCEPass()
createGlobalDCEPass - This transform is designed to eliminate unreachable internal globals (functions...
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
std::function< void(const PassManagerBuilder &Builder, legacy::PassManagerBase &PM)> ExtensionFn
Extensions are passed to the builder itself (so they can see how it is configured) as well as the pas...
FunctionPass * createLowerExpectIntrinsicPass()
initializer< Ty > init(const Ty &Val)
cl::opt< bool > EnableGVNSink
unsigned OptLevel
The Optimization Level - Specify the basic optimization level.
Pass * createCorrelatedValuePropagationPass()
Pass * createPostOrderFunctionAttrsLegacyPass()
Create a legacy pass manager instance of a pass to compute function attrs in post-order.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
std::string PGOInstrUse
Path of the profile data file.
ImmutablePass * createTypeBasedAAWrapperPass()
cl::opt< bool > EnableIROutliner
void add(Pass *P) override
Add a pass to the queue of passes to run.
Pass * createArgumentPromotionPass(unsigned maxElements=3)
createArgumentPromotionPass - This pass promotes "by reference" arguments to be passed by value if th...
FunctionPass * createSCCPPass()
struct LLVMOpaquePassManager * LLVMPassManagerRef
LLVMAttributeRef wrap(Attribute Attr)
ModulePass * createIROutlinerPass()
createIROutlinerPass - This pass finds similar code regions and factors those regions out into functi...
cl::opt< bool > EnableLoopFlatten
#define clEnumValN(ENUMVAL, FLAGNAME, DESC)
@ EP_Peephole
EP_Peephole - This extension point allows adding passes that perform peephole optimizations similar t...
ModulePass * createCalledValuePropagationPass()
createCalledValuePropagationPass - Attach metadata to indirct call sites indicating the set of functi...
FunctionPass * createReassociatePass()
auto find_if(R &&Range, UnaryPredicate P)
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.
cl::opt< bool > ForgetSCEVInLoopUnroll
FunctionPass * createAggressiveDCEPass()
static void removeGlobalExtension(GlobalExtensionID ExtensionID)
Removes an extension that was previously added using addGlobalExtension.
@ EP_VectorizerStart
EP_VectorizerStart - This extension point allows adding optimization passes before the vectorizer and...
cl::opt< bool > EnableCHR
bool EnablePGOInstrGen
Enable profile instrumentation pass.
ImmutablePass * createScopedNoAliasAAWrapperPass()
FunctionPass * createBitTrackingDCEPass()
FunctionPass * createAlignmentFromAssumptionsPass()
void populateModulePassManager(legacy::PassManagerBase &MPM)
populateModulePassManager - This sets up the primary pass manager.
@ EP_ModuleOptimizerEarly
EP_ModuleOptimizerEarly - This extension point allows adding passes just before the main module-level...
Pass * createLoopRotatePass(int MaxHeaderSize=-1, bool PrepareForLTO=false)
unsigned SizeLevel
SizeLevel - How much we're optimizing for size.
FunctionPass * createInstSimplifyLegacyPass()
static cl::opt< bool > UseLoopVersioningLICM("enable-loop-versioning-licm", cl::init(false), cl::Hidden, cl::desc("Enable the experimental Loop Versioning LICM pass"))
static cl::opt< bool > EnablePerformThinLTO("perform-thinlto", cl::init(false), cl::Hidden, cl::desc("Enable performing ThinLTO."))
@ EP_LateLoopOptimizations
EP_LateLoopOptimizations - This extension point allows adding late loop canonicalization and simplifi...
Pass * createLoopInstSimplifyPass()
bool EnablePGOCSInstrGen
Enable profile context sensitive instrumentation pass.
FunctionPass * createPromoteMemoryToRegisterPass()
bool EnablePGOCSInstrUse
Enable profile context sensitive profile use pass.
FunctionPass * createInstructionCombiningPass()
ModulePass * createEliminateAvailableExternallyPass()
This transform is designed to eliminate available external globals (functions or global variables)
void populateFunctionPassManager(legacy::FunctionPassManager &FPM)
populateFunctionPassManager - This fills in the function pass manager, which is expected to be run on...
FunctionPass * createConstraintEliminationPass()
@ EP_EarlyAsPossible
EP_EarlyAsPossible - This extension point allows adding passes before any other transformations,...
FunctionPass * createLowerConstantIntrinsicsPass()
ModulePass * createConstantMergePass()
createConstantMergePass - This function returns a new pass that merges duplicate global constants tog...
FunctionPassManager manages FunctionPasses.
@ EP_EnabledOnOptLevel0
EP_EnabledOnOptLevel0 - This extension point allows adding passes that should not be disabled by O0 o...
FunctionPass * createLoopFlattenPass()
ModulePass * createInstrOrderFilePass()
PassManagerBase - An abstract interface to allow code to add passes to a pass manager without having ...
cl::opt< bool > EnableLoopInterchange
cl::opt< bool > EnableUnrollAndJam
ModulePass * createPartialInliningPass()
createPartialInliningPass - This pass inlines parts of functions.
Pass * createWarnMissedTransformationsPass()
cl::opt< AttributorRunOption > AttributorRun
void addExtension(ExtensionPointTy Ty, ExtensionFn Fn)
FunctionPass * createSpeculativeExecutionIfHasBranchDivergencePass()
Pass * createLowerMatrixIntrinsicsMinimalPass()
@ EP_CGSCCOptimizerLate
EP_CGSCCOptimizerLate - This extension point allows adding CallGraphSCC passes at the end of the main...
ModulePass * createFunctionSpecializationPass()
createFunctionSpecializationPass - This pass propagates constants from call sites to the specialized ...
cl::opt< unsigned > SetLicmMssaOptCap
Pass * createLoopDeletionPass()
FunctionPass * createSROAPass()
LLVM Value Representation.
cl::opt< bool > EnableFunctionSpecialization
Pass * createLoopUnrollAndJamPass(int OptLevel=2)
FunctionPass * createJumpThreadingPass(bool FreezeSelectCond=false, int Threshold=-1)
Pass * createLoopVectorizePass()
static bool GlobalExtensionsNotEmpty()
Check if GlobalExtensions is constructed and not empty.
Pass * createLoopUnrollPass(int OptLevel=2, bool OnlyWhenForced=false, bool ForgetAllSCEV=false, int Threshold=-1, int Count=-1, int AllowPartial=-1, int Runtime=-1, int UpperBound=-1, int AllowPeeling=-1)
ModulePass * createAnnotation2MetadataLegacyPass()
Pass * createOpenMPOptCGSCCLegacyPass()
createOpenMPOptLegacyPass - OpenMP specific optimizations.
cl::opt< bool > EnableGVNHoist