175 const PassesOptions &Opts = LibraryOptions.
get<PassesOptions>();
177 R.LoopInterchange =
LoopInterchange.value_or(Opts.enable_loopinterchange);
183 R.MergeFunctions =
MergeFunctions.value_or(Opts.enable_merge_functions);
184 R.MaxDevirtIterations =
186 R.EagerlyInvalidateAnalyses =
189 Opts.enable_devirtualize_speculatively);
195 for (
auto &
C : PeepholeEPCallbacks)
200 for (
auto &
C : LateLoopOptimizationsEPCallbacks)
205 for (
auto &
C : LoopOptimizerEndEPCallbacks)
210 for (
auto &
C : ScalarOptimizerLateEPCallbacks)
215 for (
auto &
C : CGSCCOptimizerLateEPCallbacks)
220 for (
auto &
C : VectorizerStartEPCallbacks)
225 for (
auto &
C : VectorizerEndEPCallbacks)
231 for (
auto &
C : OptimizerEarlyEPCallbacks)
237 for (
auto &
C : OptimizerLastEPCallbacks)
242 for (
auto &
C : FullLinkTimeOptimizationEarlyEPCallbacks)
247 for (
auto &
C : FullLinkTimeOptimizationLastEPCallbacks)
252 for (
auto &
C : ThinLinkTimeOptimizationEarlyEPCallbacks)
257 for (
auto &
C : ThinLinkTimeOptimizationLastEPCallbacks)
262 for (
auto &
C : PipelineStartEPCallbacks)
267 for (
auto &
C : PipelineEarlySimplificationEPCallbacks)
273 bool IsPreOptimization) {
285 const PassesOptions &Opts) {
294 const PassesOptions &Opts) {
361 if (Opts.enable_module_inliner)
378 FPM.
addPass(CountVisitsPass());
385 FPM.
addPass(EarlyCSEPass(
true ));
389 SimplifyCFGPass(SimplifyCFGOptions().convertSwitchRangeToICmp(
true)));
390 FPM.
addPass(InstCombinePass());
392 FPM.
addPass(LibCallsShrinkWrapPass());
397 SimplifyCFGPass(SimplifyCFGOptions().convertSwitchRangeToICmp(
true)));
402 FPM.
addPass(ReassociatePass());
418 LPM1.addPass(LoopInstSimplifyPass());
419 LPM1.addPass(LoopSimplifyCFGPass());
427 LPM1.addPass(LICMPass(*PTO.LicmMssaOptCap, *PTO.LicmMssaNoAccForPromotionCap,
433 LPM1.addPass(LICMPass(*PTO.LicmMssaOptCap, *PTO.LicmMssaNoAccForPromotionCap,
435 LPM1.addPass(SimpleLoopUnswitchPass());
436 if (Opts.enable_loop_flatten)
437 LPM1.addPass(LoopFlattenPass());
439 LPM2.addPass(LoopIdiomRecognizePass());
440 LPM2.addPass(IndVarSimplifyPass());
444 LPM2.addPass(LoopDeletionPass());
453 LPM2.addPass(LoopFullUnrollPass(
static_cast<int>(Level),
455 *PTO.ForgetAllSCEVInLoopUnroll));
462 SimplifyCFGPass(SimplifyCFGOptions().convertSwitchRangeToICmp(
true)));
463 FPM.
addPass(InstCombinePass());
487 FPM.
addPass(InstCombinePass());
499 SimplifyCFGPass(SimplifyCFGOptions().convertSwitchRangeToICmp(
true)));
500 FPM.
addPass(InstCombinePass());
514 return buildO1FunctionSimplificationPipeline(Level,
Phase);
531 if (Opts.enable_gvn_hoist)
535 if (Opts.enable_gvn_sink) {
549 if (Opts.enable_jump_table_to_switch)
566 isInstrumentedPGOUse()));
575 if (Opts.enable_constraint_elimination)
601 LPM1.addPass(
LICMPass(*PTO.LicmMssaOptCap, *PTO.LicmMssaNoAccForPromotionCap,
607 LPM1.addPass(
LICMPass(*PTO.LicmMssaOptCap, *PTO.LicmMssaNoAccForPromotionCap,
611 if (Opts.enable_loop_flatten)
621 LPM2.addPass(std::move(ExtraPasses));
637 *PTO.ForgetAllSCEVInLoopUnroll));
661 if (Opts.enable_newgvn)
683 if (Opts.enable_dfa_jump_thread)
701 LICMPass(*PTO.LicmMssaOptCap, *PTO.LicmMssaNoAccForPromotionCap,
710 .convertSwitchRangeToICmp(
true)
711 .convertSwitchToArithmetic(
true)
712 .hoistCommonInsts(
true)
713 .sinkCommonInsts(
true)));
729 bool IgnoreProfile) {
731 if (Opts.disable_preinline)
752 FPM.
addPass(SimplifyCFGPass(SimplifyCFGOptions().convertSwitchRangeToICmp(
754 FPM.
addPass(InstCombinePass());
758 std::move(FPM), *PTO.EagerlyInvalidateAnalyses));
770 if (Opts.enable_post_pgo_loop_rotation) {
775 *PTO.EagerlyInvalidateAnalyses));
781 bool IsCS,
bool AtomicCounterUpdate,
782 std::string ProfileFile,
783 std::string ProfileRemappingFile) {
786 if (!RunProfileGen) {
787 assert(!ProfileFile.empty() &&
"Profile use expecting a profile file!");
789 PGOInstrumentationUse(ProfileFile, ProfileRemappingFile, IsCS, FS));
792 MPM.
addPass(RequireAnalysisPass<ProfileSummaryAnalysis, Module>());
800 addPostPGOLoopRotation(MPM, Level);
803 if (!ProfileFile.empty())
804 Options.InstrProfileOutput = ProfileFile;
806 Options.DoCounterPromotion =
true;
807 Options.UseBFIInPromotion = IsCS;
808 if (Opts.enable_sampled_instrumentation) {
812 Options.DoCounterPromotion =
false;
814 Options.Atomic = AtomicCounterUpdate;
819 bool RunProfileGen,
bool IsCS,
820 bool AtomicCounterUpdate,
821 std::string ProfileFile,
822 std::string ProfileRemappingFile) {
823 if (!RunProfileGen) {
824 assert(!ProfileFile.empty() &&
"Profile use expecting a profile file!");
838 if (!ProfileFile.empty())
839 Options.InstrProfileOutput = ProfileFile;
841 Options.DoCounterPromotion =
false;
842 Options.UseBFIInPromotion = IsCS;
843 Options.Atomic = AtomicCounterUpdate;
851 if (PTO.InlinerThreshold == -1)
870 Opts.enable_ml_inliner,
871 *PTO.MaxDevirtIterations);
875 if (Opts.enable_global_analyses) {
928 *PTO.EagerlyInvalidateAnalyses,
true));
992 *PTO.EagerlyInvalidateAnalyses));
1008 "Should not be used for O0 pipeline");
1011 "FullLTOPostLink shouldn't call buildModuleSimplificationPipeline!");
1025 bool LoadSampleProfile = HasSampleProfile && !(Opts.flattened_profile_used &&
1066 std::move(EarlyFPM), *PTO.EagerlyInvalidateAnalyses));
1069 if (LoadSampleProfile) {
1073 PGOOpt->ProfileFile, PGOOpt->ProfileRemappingFile,
Phase, FS));
1129 std::move(GlobalCleanupPM), *PTO.EagerlyInvalidateAnalyses));
1134 const bool IsCtxProfGen =
1136 Context.getLibraryOptions());
1137 const bool IsPGOPreLink = !IsCtxProfGen && PGOOpt && IsPreLink;
1138 const bool IsPGOInstrGen =
1140 const bool IsPGOInstrUse =
1142 const bool IsMemprofUse = IsPGOPreLink && !PGOOpt->MemoryProfile.empty();
1146 Context.getLibraryOptions())) &&
1147 "Enabling both instrumented PGO and contextual instrumentation is not "
1151 assert((Opts.instrument_cold_function_only_path.empty() ||
1153 "--instrument-cold-function-only-path is provided but "
1154 "--pgo-instrument-cold-function-only is not enabled");
1155 const bool IsColdFuncOnlyInstrGen =
1157 IsPGOPreLink && !Opts.instrument_cold_function_only_path.empty();
1167 const bool PreInlinerIgnoreProfile =
1168 IsMemprofUse && HasSampleProfile && Opts.memprof_preinline_ignore_profile;
1169 if (IsPGOInstrGen || IsPGOInstrUse || IsMemprofUse || IsCtxProfGen ||
1170 IsCtxProfUse || IsColdFuncOnlyInstrGen)
1171 addPreInlinerPasses(MPM, Level,
Phase, PreInlinerIgnoreProfile);
1174 if (IsPGOInstrGen || IsPGOInstrUse) {
1175 addPGOInstrPasses(MPM, Level,
1177 false, PGOOpt->AtomicCounterUpdate,
1178 PGOOpt->ProfileFile, PGOOpt->ProfileRemappingFile);
1179 }
else if (IsCtxProfGen || IsCtxProfUse) {
1196 addPostPGOLoopRotation(MPM, Level);
1199 }
else if (IsColdFuncOnlyInstrGen) {
1200 addPGOInstrPasses(MPM, Level,
true,
false,
1202 Opts.instrument_cold_function_only_path.str(),
1206 if (IsPGOInstrGen || IsPGOInstrUse || IsCtxProfGen)
1211 PGOOpt->CSProfileGenFile, Opts.enable_sampled_instrumentation));
1222 if (Opts.enable_module_inliner)
1297 FPM.
addPass(InstCombinePass());
1300 ExtraFunctionPassManager<ShouldRunExtraVectorPasses> ExtraPasses;
1307 ExtraPasses.
addPass(EarlyCSEPass());
1308 ExtraPasses.
addPass(CorrelatedValuePropagationPass());
1309 ExtraPasses.
addPass(InstCombinePass());
1311 LPM.addPass(LICMPass(*PTO.LicmMssaOptCap, *PTO.LicmMssaNoAccForPromotionCap,
1313 LPM.addPass(SimpleLoopUnswitchPass( Level ==
1318 SimplifyCFGPass(SimplifyCFGOptions().convertSwitchRangeToICmp(
true)));
1319 ExtraPasses.
addPass(InstCombinePass());
1320 FPM.
addPass(std::move(ExtraPasses));
1332 FPM.
addPass(SimplifyCFGPass(SimplifyCFGOptions()
1333 .forwardSwitchCondToPhi(
true)
1334 .convertSwitchRangeToICmp(
true)
1335 .convertSwitchToArithmetic(
true)
1336 .convertSwitchToLookupTable(
true)
1337 .needCanonicalLoops(
false)
1338 .hoistCommonInsts(
true)
1339 .sinkCommonInsts(
true)));
1343 FPM.
addPass(InstCombinePass());
1348 if (PTO.SLPVectorization) {
1349 FPM.
addPass(SLPVectorizerPass());
1355 FPM.
addPass(VectorCombinePass());
1358 FPM.
addPass(InstCombinePass());
1366 if (Opts.enable_unroll_and_jam && PTO.LoopUnrolling) {
1368 LoopUnrollAndJamPass(
static_cast<int>(Level))));
1370 FPM.
addPass(LoopUnrollPass(LoopUnrollOptions(
1371 static_cast<int>(Level), !PTO.LoopUnrolling,
1372 *PTO.ForgetAllSCEVInLoopUnroll)));
1373 FPM.
addPass(WarnMissedTransformationsPass());
1392 FPM.
addPass(InferAlignmentPass());
1393 FPM.
addPass(InstCombinePass());
1402 LICMPass(*PTO.LicmMssaOptCap, *PTO.LicmMssaNoAccForPromotionCap,
1408 FPM.
addPass(AlignmentFromAssumptionsPass());
1418 if (Opts.enable_partial_inlining)
1447 addPGOInstrPasses(MPM, Level,
true,
1448 true, PGOOpt->AtomicCounterUpdate,
1449 PGOOpt->CSProfileGenFile, PGOOpt->ProfileRemappingFile);
1451 addPGOInstrPasses(MPM, Level,
false,
1452 true, PGOOpt->AtomicCounterUpdate,
1453 PGOOpt->ProfileFile, PGOOpt->ProfileRemappingFile);
1463 if (Opts.enable_global_analyses)
1481 if (Opts.enable_loop_versioning_licm) {
1486 LICMPass(*PTO.LicmMssaOptCap, *PTO.LicmMssaNoAccForPromotionCap,
1496 if (Opts.enable_matrix) {
1527 if (*PTO.LoopInterchange)
1548 addVectorPasses(Level, OptimizePM, LTOPhase);
1568 if (Opts.enable_mergeicmps)
1580 .convertSwitchRangeToICmp(
true)
1581 .convertSwitchToArithmetic(
true)
1582 .speculateUnpredictables(
true)
1583 .hoistLoadsStoresWithCondFaulting(
true)));
1587 std::move(OptimizePM), *PTO.EagerlyInvalidateAnalyses));
1597 if (Opts.enable_instrumentor)
1615 if (*PTO.MergeFunctions)
1635 *PTO.DevirtualizeSpeculatively));
1676 if (Opts.opt_pipeline_trigger_crash)
1679 if (PGOOpt && PGOOpt->DebugInfoForProfiling)
1691 if (PGOOpt && PGOOpt->PseudoProbeForProfiling &&
1699 addRequiredLTOPreLinkPasses(MPM);
1707 bool EmitSummary,
bool Verify) {
1782 if (PGOOpt && PGOOpt->DebugInfoForProfiling)
1797 addRequiredLTOPreLinkPasses(MPM);
1808 if (Opts.enable_partial_inlining)
1811 if (PGOOpt && PGOOpt->PseudoProbeForProfiling &&
1829 addRequiredLTOPreLinkPasses(MPM);
1850 if (ImportSummary) {
1970 PGOOpt->ProfileRemappingFile,
2093 std::move(PeepholeFPM), *PTO.EagerlyInvalidateAnalyses));
2137 if (Opts.enable_constraint_elimination)
2146 addPGOInstrPasses(MPM, Level,
true,
2147 true, PGOOpt->AtomicCounterUpdate,
2148 PGOOpt->CSProfileGenFile, PGOOpt->ProfileRemappingFile);
2150 addPGOInstrPasses(MPM, Level,
false,
2151 true, PGOOpt->AtomicCounterUpdate,
2152 PGOOpt->ProfileFile, PGOOpt->ProfileRemappingFile);
2165 std::move(FPM), *PTO.EagerlyInvalidateAnalyses));
2177 if (Opts.enable_global_analyses) {
2187 LICMPass(*PTO.LicmMssaOptCap, *PTO.LicmMssaNoAccForPromotionCap,
2191 if (Opts.enable_newgvn)
2235 std::move(MainFPM), *PTO.EagerlyInvalidateAnalyses));
2247 if (Opts.hot_cold_split)
2266 if (Opts.enable_mergeicmps)
2272 .convertSwitchRangeToICmp(
true)
2273 .convertSwitchToArithmetic(
true)
2274 .hoistCommonInsts(
true)
2275 .speculateUnpredictables(
true)));
2284 if (*PTO.MergeFunctions)
2289 if (PTO.CallGraphProfile)
2312 "buildO0DefaultPipeline should only be used with O0");
2322 if (PGOOpt && PGOOpt->PseudoProbeForProfiling)
2330 false, PGOOpt->AtomicCounterUpdate, PGOOpt->ProfileFile,
2331 PGOOpt->ProfileRemappingFile);
2339 if (PGOOpt && PGOOpt->DebugInfoForProfiling)
2346 PGOOpt->ProfileRemappingFile,
2364 if (*PTO.MergeFunctions)
2367 if (Opts.enable_matrix)
2371 if (!CGSCCOptimizerLateEPCallbacks.empty()) {
2377 if (!LateLoopOptimizationsEPCallbacks.empty()) {
2380 if (!LPM.isEmpty()) {
2385 if (!LoopOptimizerEndEPCallbacks.empty()) {
2388 if (!LPM.isEmpty()) {
2393 if (!ScalarOptimizerLateEPCallbacks.empty()) {
2402 if (!VectorizerStartEPCallbacks.empty()) {
2409 if (!VectorizerEndEPCallbacks.empty()) {
2425 if (Opts.enable_instrumentor)
2432 addRequiredLTOPreLinkPasses(MPM);
2450 TM->registerEarlyDefaultAliasAnalyses(
AA);
2466 if (Opts.enable_global_analyses)
2471 TM->registerDefaultAliasAnalyses(
AA);
2476bool PassBuilder::isInstrumentedPGOUse()
const {
aarch64 falkor hwpf fix Falkor HW Prefetch Fix Late Phase
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
AggressiveInstCombiner - Combine expression patterns to form expressions with fewer,...
Provides passes to inlining "always_inline" functions.
This is the interface for LLVM's primary stateless and local alias analysis.
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
This file provides the interface for LLVM's Call Graph Profile pass.
This header provides classes for managing passes over SCCs of the call graph.
This file provides the interface for a simple, fast CSE pass.
This file provides a pass which clones the current module and runs the provided pass pipeline on the ...
Super simple passes to force specific function attrs from the commandline into the IR for debugging p...
Provides passes for computing function attributes based on interprocedural analyses.
This file provides the interface for the GVNHoist pass.
This file provides the interface for the GVNSink pass.
This file provides the interface for LLVM's Global Value Numbering pass which eliminates fully redund...
This is the interface for a simple mod/ref and alias analysis over globals.
AcceleratorCodeSelection - Identify all functions reachable from a kernel, removing those that are un...
This header defines various interfaces for pass management in LLVM.
Interfaces for passes which infer implicit function attributes from the name and signature of functio...
This file provides the primary interface to the instcombine pass.
Defines passes for running instruction simplification across chunks of IR.
This file provides the interface for LLVM's PGO Instrumentation lowering pass.
See the comments on JumpThreadingPass.
This file implements the Loop Fusion pass.
This header defines the LoopLoadEliminationPass object.
This header provides classes for managing a pipeline of passes over loops in LLVM IR.
The header file for the LowerConstantIntrinsics pass as used by the new pass manager.
The header file for the LowerExpectIntrinsic pass as used by the new pass manager.
This pass performs merges of loads and stores on both sides of a.
This file provides the interface for LLVM's Global Value Numbering pass.
This header enumerates the LLVM-provided high-level optimization levels.
This file provides the interface for IR based instrumentation passes ( (profile-gen,...
Define option tunables for PGO.
ppc ctr loops PowerPC CTR Loops Verify
static void addPipelineEndPasses(ModulePassManager &MPM, const PassesOptions &Opts)
static void addPipelineStartPasses(ModulePassManager &MPM, const PassesOptions &Opts)
static bool isThinLTOPostLink(ThinOrFullLTOPhase Phase)
static void addModuleInlinerPass(ModulePassManager &MPM, const LLVMContext &Context, OptimizationLevel Level, ThinOrFullLTOPhase Phase)
static void addAnnotationRemarksPass(ModulePassManager &MPM)
static CoroConditionalWrapper buildCoroWrapper(ThinOrFullLTOPhase Phase)
static bool isFullLTOPostLink(ThinOrFullLTOPhase Phase)
static bool isThinLTOPreLink(ThinOrFullLTOPhase Phase)
static bool isLTOPreLink(ThinOrFullLTOPhase Phase)
static void instructionCountersPass(ModulePassManager &MPM, bool IsPreOptimization)
static bool isFullLTOPreLink(ThinOrFullLTOPhase Phase)
static bool isLTOPostLink(ThinOrFullLTOPhase Phase)
This file implements relative lookup table converter that converts lookup tables to relative lookup t...
This file provides the interface for LLVM's Scalar Replacement of Aggregates pass.
This file provides the interface for the pseudo probe implementation for AutoFDO.
This file provides the interface for the sampled PGO loader pass.
This is the interface for a metadata-based scoped no-alias analysis.
This file provides the interface for the pass responsible for both simplifying and canonicalizing the...
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
This is the interface for a metadata-based TBAA.
A manager for alias analyses.
A module pass that rewrites heap allocations to use token-enabled allocation functions based on vario...
Inlines functions marked as "always_inline".
Analysis pass providing a never-invalidated alias analysis result.
Simple pass that canonicalizes aliases.
A pass that merges duplicate global constants into a single constant.
Eliminate dead arguments (and return values) from functions.
A pass that transforms external global definitions into declarations.
Pass embeds a copy of the module optimized with the provided pass pipeline into a global variable.
Statistics pass for the FunctionPropertiesAnalysis results.
Pass to remove unused function declarations.
Optimize globals that never have their address taken.
Pass to perform split of global variables.
Analysis pass providing a never-invalidated alias analysis result.
Pass to outline cold regions.
Pass to perform interprocedural constant propagation.
Run instruction simplification across each instruction in the function.
Instrumentation based profiling lowering pass.
This pass performs 'jump threading', which looks at blocks that have multiple predecessors and multip...
Performs Loop Invariant Code Motion Pass.
This is an important class for using LLVM in a threaded context.
Loop unroll pass that only does full loop unrolling and peeling.
Performs Loop Idiom Recognize Pass.
Performs Loop Inst Simplify Pass.
A simple loop rotation transformation.
Performs basic CFG simplifications to assist other loop passes.
A pass that does profile-guided sinking of instructions into loops.
A simple loop rotation transformation.
Loop unroll pass that will support both full and partial unrolling.
Strips MemProf attributes and metadata.
Merge identical functions.
The module inliner pass for the new pass manager.
Module pass, wrapping the inliner pass.
void addModulePass(T Pass)
Add a module pass that runs before the CGSCC passes.
CGSCCPassManager & getPM()
Allow adding more CGSCC passes, besides inlining.
void addLateModulePass(T Pass)
Add a module pass that runs after the CGSCC passes.
Class to hold module path string table and global value map, and encapsulate methods for operating on...
bool withSupportsHotColdNew() const
Simple pass that provides a name to every anonymous globals.
Additional 'norecurse' attribute deduction during postlink LTO phase.
OpenMP optimizations pass.
static LLVM_ABI bool isCtxIRPGOInstrEnabled(const cl::LibraryOptionsContext &LibraryOptions)
The instrumentation (profile-instr-gen) pass for IR based PGO.
The instrumentation (profile-instr-gen) pass for IR based PGO.
The profile annotation (profile-instr-use) pass for IR based PGO.
The profile size based optimization pass for memory intrinsics.
Pass to remove unused function declarations.
LLVM_ABI void invokeFullLinkTimeOptimizationLastEPCallbacks(ModulePassManager &MPM, OptimizationLevel Level)
LLVM_ABI ModuleInlinerWrapperPass buildInlinerPipeline(OptimizationLevel Level, ThinOrFullLTOPhase Phase)
Construct the module pipeline that performs inlining as well as the inlining-driven cleanups.
LLVM_ABI void invokeOptimizerEarlyEPCallbacks(ModulePassManager &MPM, OptimizationLevel Level, ThinOrFullLTOPhase Phase)
LLVM_ABI ModulePassManager buildFatLTODefaultPipeline(OptimizationLevel Level, bool ThinLTO, bool EmitSummary, bool Verify=true)
Build a fat object default optimization pipeline.
LLVM_ABI void invokeVectorizerStartEPCallbacks(FunctionPassManager &FPM, OptimizationLevel Level)
LLVM_ABI AAManager buildDefaultAAPipeline()
Build the default AAManager with the default alias analysis pipeline registered.
LLVM_ABI void invokeCGSCCOptimizerLateEPCallbacks(CGSCCPassManager &CGPM, OptimizationLevel Level)
LLVM_ABI ModulePassManager buildThinLTOPreLinkDefaultPipeline(OptimizationLevel Level)
Build a pre-link, ThinLTO-targeting default optimization pipeline to a pass manager.
LLVM_ABI void addPGOInstrPassesForO0(ModulePassManager &MPM, bool RunProfileGen, bool IsCS, bool AtomicCounterUpdate, std::string ProfileFile, std::string ProfileRemappingFile)
Add PGOInstrumenation passes for O0 only.
LLVM_ABI void invokeScalarOptimizerLateEPCallbacks(FunctionPassManager &FPM, OptimizationLevel Level)
LLVM_ABI ModulePassManager buildPerModuleDefaultPipeline(OptimizationLevel Level, ThinOrFullLTOPhase Phase=ThinOrFullLTOPhase::None)
Build a per-module default optimization pipeline.
LLVM_ABI void invokePipelineStartEPCallbacks(ModulePassManager &MPM, OptimizationLevel Level)
LLVM_ABI void invokeVectorizerEndEPCallbacks(FunctionPassManager &FPM, OptimizationLevel Level)
LLVM_ABI void invokeThinLinkTimeOptimizationLastEPCallbacks(ModulePassManager &MPM, OptimizationLevel Level)
LLVM_ABI ModulePassManager buildO0DefaultPipeline(OptimizationLevel Level, ThinOrFullLTOPhase Phase=ThinOrFullLTOPhase::None)
Build an O0 pipeline with the minimal semantically required passes.
LLVM_ABI FunctionPassManager buildFunctionSimplificationPipeline(OptimizationLevel Level, ThinOrFullLTOPhase Phase)
Construct the core LLVM function canonicalization and simplification pipeline.
LLVM_ABI void invokePeepholeEPCallbacks(FunctionPassManager &FPM, OptimizationLevel Level)
LLVM_ABI void invokePipelineEarlySimplificationEPCallbacks(ModulePassManager &MPM, OptimizationLevel Level, ThinOrFullLTOPhase Phase)
LLVM_ABI void invokeLoopOptimizerEndEPCallbacks(LoopPassManager &LPM, OptimizationLevel Level)
LLVM_ABI ModulePassManager buildLTODefaultPipeline(OptimizationLevel Level, ModuleSummaryIndex *ExportSummary)
Build an LTO default optimization pipeline to a pass manager.
LLVM_ABI ModulePassManager buildModuleInlinerPipeline(OptimizationLevel Level, ThinOrFullLTOPhase Phase)
Construct the module pipeline that performs inlining with module inliner pass.
LLVM_ABI ModulePassManager buildThinLTODefaultPipeline(OptimizationLevel Level, const ModuleSummaryIndex *ImportSummary)
Build a ThinLTO default optimization pipeline to a pass manager.
LLVM_ABI void invokeLateLoopOptimizationsEPCallbacks(LoopPassManager &LPM, OptimizationLevel Level)
LLVM_ABI void invokeFullLinkTimeOptimizationEarlyEPCallbacks(ModulePassManager &MPM, OptimizationLevel Level)
LLVM_ABI ModulePassManager buildModuleSimplificationPipeline(OptimizationLevel Level, ThinOrFullLTOPhase Phase)
Construct the core LLVM module canonicalization and simplification pipeline.
LLVM_ABI ModulePassManager buildModuleOptimizationPipeline(OptimizationLevel Level, ThinOrFullLTOPhase LTOPhase)
Construct the core LLVM module optimization pipeline.
LLVM_ABI void invokeThinLinkTimeOptimizationEarlyEPCallbacks(ModulePassManager &MPM, OptimizationLevel Level)
LLVM_ABI void invokeOptimizerLastEPCallbacks(ModulePassManager &MPM, OptimizationLevel Level, ThinOrFullLTOPhase Phase)
LLVM_ABI ModulePassManager buildLTOPreLinkDefaultPipeline(OptimizationLevel Level)
Build a pre-link, LTO-targeting default optimization pipeline to a pass manager.
LLVM_ATTRIBUTE_MINSIZE std::enable_if_t<!std::is_same_v< PassT, PassManager > > addPass(PassT &&Pass)
bool isEmpty() const
Returns if the pass manager contains any passes.
Tunable parameters for passes in the default pipelines.
std::optional< bool > EagerlyInvalidateAnalyses
std::optional< bool > ForgetAllSCEVInLoopUnroll
Tuning option to forget all SCEV loops in LoopUnroll.
std::optional< unsigned > MaxDevirtIterations
Tuning option to cap how many times the inliner pipeline reruns on an SCC after devirtualizing a call...
std::optional< unsigned > LicmMssaNoAccForPromotionCap
Tuning option to disable promotion to scalars in LICM with MemorySSA, if the number of access is too ...
std::optional< bool > DevirtualizeSpeculatively
std::optional< unsigned > LicmMssaOptCap
Tuning option to cap the number of calls to retrive clobbering accesses in MemorySSA,...
LLVM_ABI PipelineTuningOptions resolve(const cl::LibraryOptionsContext &LibraryOptions) const
Return a copy whose unset members are set from LibraryOptions.
std::optional< bool > LoopInterchange
Tuning option to enable/disable loop interchange.
bool LoopInterleaving
Tuning option to set loop interleaving on/off, set based on opt level.
std::optional< bool > MergeFunctions
Tuning option to enable/disable function merging.
bool LoopUnrolling
Tuning option to enable/disable loop unrolling.
bool LoopVectorization
Tuning option to enable/disable loop vectorization, set based on opt level.
Inject MD_prof metadata where it's missing.
Checks that MD_prof is present on every instruction that supports it.
Reassociate commutative expressions.
A pass to do RPO deduction and propagation of function attributes.
This pass performs function-level constant propagation and merging.
The sample profiler data loader pass.
Analysis pass providing a never-invalidated alias analysis result.
This pass transforms loops that contain branches or switches on loop- invariant conditions to have mu...
A pass to simplify and canonicalize the CFG of a function.
Analysis pass providing a never-invalidated alias analysis result.
Optimize scalar/vector interactions in IR using target cost models.
Interfaces for registering analysis passes, producing common pass manager configurations,...
Abstract Attribute helper functions.
@ All
Drop only llvm.assumes using type test value.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI cl::opt< bool > EnableKnowledgeRetention
LLVM_ABI InlineParams getInlineParams(const LLVMContext &C)
Generate the parameters to tune the inline cost analysis based only on the commandline options.
ModuleToFunctionPassAdaptor createModuleToFunctionPassAdaptor(FunctionPassT &&Pass, bool EagerlyInvalidate=false)
A function to deduce a function pass type and wrap it in the templated adaptor.
cl::opt< bool > EnableProfcheckInPipeline("enable-profcheck-in-pipeline", cl::init(false), cl::desc("Adds profile verification to the pipeline, erroring if profile " "information is dropped."))
LLVM_ABI unsigned getLicmMssaOptCap(const cl::LibraryOptionsContext &LibraryOptions)
Return -licm-mssa-optimization-cap.
cl::opt< std::string > UseCtxProfile("use-ctx-profile", cl::init(""), cl::Hidden, cl::desc("Use the specified contextual profile file"))
@ O1
Optimize quickly without destroying debuggability.
@ O0
Disable as many optimizations as possible.
@ O3
Optimize for fast execution as much as possible.
@ O2
Optimize for fast execution as much as possible without triggering significant incremental compile ti...
PassManager< LazyCallGraph::SCC, CGSCCAnalysisManager, LazyCallGraph &, CGSCCUpdateResult & > CGSCCPassManager
The CGSCC pass manager.
ThinOrFullLTOPhase
This enumerates the LLVM full LTO or ThinLTO optimization phases.
@ FullLTOPreLink
Full LTO prelink phase.
@ ThinLTOPostLink
ThinLTO postlink (backend compile) phase.
@ None
No LTO/ThinLTO behavior needed.
@ FullLTOPostLink
Full LTO postlink (backend compile) phase.
@ ThinLTOPreLink
ThinLTO prelink (summary) phase.
PassManager< Loop, LoopAnalysisManager, LoopStandardAnalysisResults &, LPMUpdater & > LoopPassManager
The Loop pass manager.
ModuleToPostOrderCGSCCPassAdaptor createModuleToPostOrderCGSCCPassAdaptor(CGSCCPassT &&Pass)
A function to deduce a function pass type and wrap it in the templated adaptor.
LLVM_ABI InlineParams getInlineParamsFromOptLevel(const LLVMContext &C, unsigned OptLevel)
Generate the parameters to tune the inline cost analysis based on command line options.
FunctionToLoopPassAdaptor createFunctionToLoopPassAdaptor(LoopPassT &&Pass, bool UseMemorySSA=false)
A function to deduce a loop pass type and wrap it in the templated adaptor.
CGSCCToFunctionPassAdaptor createCGSCCToFunctionPassAdaptor(FunctionPassT &&Pass, bool EagerlyInvalidate=false, bool NoRerun=false)
A function to deduce a function pass type and wrap it in the templated adaptor.
LLVM_ABI bool getForgetSCEVInLoopUnroll(const cl::LibraryOptionsContext &LibraryOptions)
Return -forget-scev-loop-unroll.
PassManager< Module > ModulePassManager
Convenience typedef for a pass manager over modules.
LLVM_ABI bool AreStatisticsEnabled()
Check if statistics are enabled.
cl::opt< bool > EnableMemProfContextDisambiguation
Enable MemProf context disambiguation for thin link.
PassManager< Function > FunctionPassManager
Convenience typedef for a pass manager over functions.
LLVM_ABI unsigned getLicmMssaNoAccForPromotionCap(const cl::LibraryOptionsContext &LibraryOptions)
Return -licm-mssa-max-acc-promotion.
LLVM_ABI unsigned getMaxDevirtIterations(const cl::LibraryOptionsContext &)
const PassesOptions & getPassesOptions(const LLVMContext &C)
LLVM_ABI bool isPGOInstrumentColdFunctionOnly(const cl::LibraryOptionsContext &LibraryOptions)
Return the value of -pgo-instrument-cold-function-only in LibraryOptions.
A DCE pass that assumes instructions are dead until proven otherwise.
This pass attempts to minimize the number of assume without loosing any information.
A more lightweight version of the Attributor which only runs attribute inference but no simplificatio...
A more lightweight version of the Attributor which only runs attribute inference but no simplificatio...
Hoist/decompose integer division and remainder instructions to enable CFG improvements and better cod...
A simple and fast domtree-based CSE pass.
Pass which forces specific function attributes into the IR, primarily as a debugging tool.
A simple and fast domtree-based GVN pass to hoist common expressions from sibling branches.
Uses an "inverted" value numbering to decide the similarity of expressions and sinks similar expressi...
A set of parameters to control various transforms performed by IPSCCP pass.
A pass which infers function attributes from the names and signatures of function declarations in a m...
Provides context on when an inline advisor is constructed in the pipeline (e.g., link phase,...
Thresholds to tune inline cost analysis.
std::optional< int > OptSizeHintThreshold
Threshold to use for callees with inline hint, when the caller is optimized for size.
std::optional< int > HotCallSiteThreshold
Threshold to use when the callsite is considered hot.
std::optional< bool > IgnoreProfile
Indicate whether to ignore profile information.
int DefaultThreshold
The default threshold to start with for a callee.
std::optional< bool > EnableDeferral
Indicate whether we should allow inline deferral.
std::optional< int > HintThreshold
Threshold to use for callees with inline hint.
Options for the frontend instrumentation based profiling pass.
A no-op pass template which simply forces a specific analysis result to be invalidated.
Pass to forward loads in a loop around the backedge to subsequent iterations.
A set of parameters used to control various transforms performed by the LoopUnroll pass.
Computes function attributes in post-order over the call graph.
A utility pass template to force an analysis result to be available.