170 const PassesOptions &Opts = PassesOptions::Global;
194 for (
auto &
C : PeepholeEPCallbacks)
199 for (
auto &
C : LateLoopOptimizationsEPCallbacks)
204 for (
auto &
C : LoopOptimizerEndEPCallbacks)
209 for (
auto &
C : ScalarOptimizerLateEPCallbacks)
214 for (
auto &
C : CGSCCOptimizerLateEPCallbacks)
219 for (
auto &
C : VectorizerStartEPCallbacks)
224 for (
auto &
C : VectorizerEndEPCallbacks)
230 for (
auto &
C : OptimizerEarlyEPCallbacks)
236 for (
auto &
C : OptimizerLastEPCallbacks)
241 for (
auto &
C : FullLinkTimeOptimizationEarlyEPCallbacks)
246 for (
auto &
C : FullLinkTimeOptimizationLastEPCallbacks)
251 for (
auto &
C : ThinLinkTimeOptimizationEarlyEPCallbacks)
256 for (
auto &
C : ThinLinkTimeOptimizationLastEPCallbacks)
261 for (
auto &
C : PipelineStartEPCallbacks)
266 for (
auto &
C : PipelineEarlySimplificationEPCallbacks)
272 bool IsPreOptimization) {
336 const PassesOptions &Opts,
340 if (Opts.enable_module_inliner)
357 FPM.
addPass(CountVisitsPass());
364 FPM.
addPass(EarlyCSEPass(
true ));
368 SimplifyCFGPass(SimplifyCFGOptions().convertSwitchRangeToICmp(
true)));
369 FPM.
addPass(InstCombinePass());
371 FPM.
addPass(LibCallsShrinkWrapPass());
376 SimplifyCFGPass(SimplifyCFGOptions().convertSwitchRangeToICmp(
true)));
381 FPM.
addPass(ReassociatePass());
397 LPM1.addPass(LoopInstSimplifyPass());
398 LPM1.addPass(LoopSimplifyCFGPass());
406 LPM1.addPass(LICMPass(PTO.LicmMssaOptCap, PTO.LicmMssaNoAccForPromotionCap,
412 LPM1.addPass(LICMPass(PTO.LicmMssaOptCap, PTO.LicmMssaNoAccForPromotionCap,
414 LPM1.addPass(SimpleLoopUnswitchPass());
415 if (Opts.enable_loop_flatten)
416 LPM1.addPass(LoopFlattenPass());
418 LPM2.addPass(LoopIdiomRecognizePass());
419 LPM2.addPass(IndVarSimplifyPass());
423 LPM2.addPass(LoopDeletionPass());
432 LPM2.addPass(LoopFullUnrollPass(
static_cast<int>(Level),
434 PTO.ForgetAllSCEVInLoopUnroll));
441 SimplifyCFGPass(SimplifyCFGOptions().convertSwitchRangeToICmp(
true)));
442 FPM.
addPass(InstCombinePass());
466 FPM.
addPass(InstCombinePass());
478 SimplifyCFGPass(SimplifyCFGOptions().convertSwitchRangeToICmp(
true)));
479 FPM.
addPass(InstCombinePass());
493 return buildO1FunctionSimplificationPipeline(Level,
Phase);
510 if (Opts.enable_gvn_hoist)
514 if (Opts.enable_gvn_sink) {
528 if (Opts.enable_jump_table_to_switch)
545 isInstrumentedPGOUse()));
554 if (Opts.enable_constraint_elimination)
580 LPM1.addPass(
LICMPass(PTO.LicmMssaOptCap, PTO.LicmMssaNoAccForPromotionCap,
586 LPM1.addPass(
LICMPass(PTO.LicmMssaOptCap, PTO.LicmMssaNoAccForPromotionCap,
590 if (Opts.enable_loop_flatten)
600 LPM2.addPass(std::move(ExtraPasses));
616 PTO.ForgetAllSCEVInLoopUnroll));
640 if (Opts.enable_newgvn)
662 if (Opts.enable_dfa_jump_thread)
680 LICMPass(PTO.LicmMssaOptCap, PTO.LicmMssaNoAccForPromotionCap,
689 .convertSwitchRangeToICmp(
true)
690 .convertSwitchToArithmetic(
true)
691 .hoistCommonInsts(
true)
692 .sinkCommonInsts(
true)));
709 if (Opts.disable_preinline)
729 FPM.
addPass(SimplifyCFGPass(SimplifyCFGOptions().convertSwitchRangeToICmp(
731 FPM.
addPass(InstCombinePass());
735 std::move(FPM), PTO.EagerlyInvalidateAnalyses));
747 if (Opts.enable_post_pgo_loop_rotation) {
752 PTO.EagerlyInvalidateAnalyses));
758 bool IsCS,
bool AtomicCounterUpdate,
759 std::string ProfileFile,
760 std::string ProfileRemappingFile) {
763 if (!RunProfileGen) {
764 assert(!ProfileFile.empty() &&
"Profile use expecting a profile file!");
766 PGOInstrumentationUse(ProfileFile, ProfileRemappingFile, IsCS, FS));
769 MPM.
addPass(RequireAnalysisPass<ProfileSummaryAnalysis, Module>());
777 addPostPGOLoopRotation(MPM, Level);
780 if (!ProfileFile.empty())
781 Options.InstrProfileOutput = ProfileFile;
783 Options.DoCounterPromotion =
true;
784 Options.UseBFIInPromotion = IsCS;
785 if (Opts.enable_sampled_instrumentation) {
789 Options.DoCounterPromotion =
false;
791 Options.Atomic = AtomicCounterUpdate;
796 bool RunProfileGen,
bool IsCS,
797 bool AtomicCounterUpdate,
798 std::string ProfileFile,
799 std::string ProfileRemappingFile) {
800 if (!RunProfileGen) {
801 assert(!ProfileFile.empty() &&
"Profile use expecting a profile file!");
815 if (!ProfileFile.empty())
816 Options.InstrProfileOutput = ProfileFile;
818 Options.DoCounterPromotion =
false;
819 Options.UseBFIInPromotion = IsCS;
820 Options.Atomic = AtomicCounterUpdate;
828 if (PTO.InlinerThreshold == -1)
851 if (Opts.enable_global_analyses) {
901 PTO.EagerlyInvalidateAnalyses,
true));
962 PTO.EagerlyInvalidateAnalyses));
978 "Should not be used for O0 pipeline");
981 "FullLTOPostLink shouldn't call buildModuleSimplificationPipeline!");
995 bool LoadSampleProfile = HasSampleProfile && !(Opts.flattened_profile_used &&
1036 std::move(EarlyFPM), PTO.EagerlyInvalidateAnalyses));
1039 if (LoadSampleProfile) {
1043 PGOOpt->ProfileFile, PGOOpt->ProfileRemappingFile,
Phase, FS));
1099 PTO.EagerlyInvalidateAnalyses));
1104 const bool IsCtxProfGen =
1106 const bool IsPGOPreLink = !IsCtxProfGen && PGOOpt && IsPreLink;
1107 const bool IsPGOInstrGen =
1109 const bool IsPGOInstrUse =
1111 const bool IsMemprofUse = IsPGOPreLink && !PGOOpt->MemoryProfile.empty();
1115 "Enabling both instrumented PGO and contextual instrumentation is not "
1119 assert((Opts.instrument_cold_function_only_path.empty() ||
1121 "--instrument-cold-function-only-path is provided but "
1122 "--pgo-instrument-cold-function-only is not enabled");
1123 const bool IsColdFuncOnlyInstrGen =
1125 !Opts.instrument_cold_function_only_path.empty();
1127 if (IsPGOInstrGen || IsPGOInstrUse || IsMemprofUse || IsCtxProfGen ||
1128 IsCtxProfUse || IsColdFuncOnlyInstrGen)
1129 addPreInlinerPasses(MPM, Level,
Phase);
1132 if (IsPGOInstrGen || IsPGOInstrUse) {
1133 addPGOInstrPasses(MPM, Level,
1135 false, PGOOpt->AtomicCounterUpdate,
1136 PGOOpt->ProfileFile, PGOOpt->ProfileRemappingFile);
1137 }
else if (IsCtxProfGen || IsCtxProfUse) {
1154 addPostPGOLoopRotation(MPM, Level);
1157 }
else if (IsColdFuncOnlyInstrGen) {
1158 addPGOInstrPasses(MPM, Level,
true,
false,
1160 Opts.instrument_cold_function_only_path.str(),
1164 if (IsPGOInstrGen || IsPGOInstrUse || IsCtxProfGen)
1169 PGOOpt->CSProfileGenFile, Opts.enable_sampled_instrumentation));
1180 if (Opts.enable_module_inliner)
1255 FPM.
addPass(InstCombinePass());
1258 ExtraFunctionPassManager<ShouldRunExtraVectorPasses> ExtraPasses;
1265 ExtraPasses.
addPass(EarlyCSEPass());
1266 ExtraPasses.
addPass(CorrelatedValuePropagationPass());
1267 ExtraPasses.
addPass(InstCombinePass());
1269 LPM.addPass(LICMPass(PTO.LicmMssaOptCap, PTO.LicmMssaNoAccForPromotionCap,
1271 LPM.addPass(SimpleLoopUnswitchPass( Level ==
1276 SimplifyCFGPass(SimplifyCFGOptions().convertSwitchRangeToICmp(
true)));
1277 ExtraPasses.
addPass(InstCombinePass());
1278 FPM.
addPass(std::move(ExtraPasses));
1290 FPM.
addPass(SimplifyCFGPass(SimplifyCFGOptions()
1291 .forwardSwitchCondToPhi(
true)
1292 .convertSwitchRangeToICmp(
true)
1293 .convertSwitchToArithmetic(
true)
1294 .convertSwitchToLookupTable(
true)
1295 .needCanonicalLoops(
false)
1296 .hoistCommonInsts(
true)
1297 .sinkCommonInsts(
true)));
1301 FPM.
addPass(InstCombinePass());
1306 if (PTO.SLPVectorization) {
1307 FPM.
addPass(SLPVectorizerPass());
1313 FPM.
addPass(VectorCombinePass());
1316 FPM.
addPass(InstCombinePass());
1324 if (Opts.enable_unroll_and_jam && PTO.LoopUnrolling) {
1326 LoopUnrollAndJamPass(
static_cast<int>(Level))));
1328 FPM.
addPass(LoopUnrollPass(LoopUnrollOptions(
1329 static_cast<int>(Level), !PTO.LoopUnrolling,
1330 PTO.ForgetAllSCEVInLoopUnroll)));
1331 FPM.
addPass(WarnMissedTransformationsPass());
1350 FPM.
addPass(InferAlignmentPass());
1351 FPM.
addPass(InstCombinePass());
1360 LICMPass(PTO.LicmMssaOptCap, PTO.LicmMssaNoAccForPromotionCap,
1366 FPM.
addPass(AlignmentFromAssumptionsPass());
1376 if (Opts.enable_partial_inlining)
1402 addPGOInstrPasses(MPM, Level,
true,
1403 true, PGOOpt->AtomicCounterUpdate,
1404 PGOOpt->CSProfileGenFile, PGOOpt->ProfileRemappingFile);
1406 addPGOInstrPasses(MPM, Level,
false,
1407 true, PGOOpt->AtomicCounterUpdate,
1408 PGOOpt->ProfileFile, PGOOpt->ProfileRemappingFile);
1418 if (Opts.enable_global_analyses)
1436 if (Opts.enable_loop_versioning_licm) {
1441 LICMPass(PTO.LicmMssaOptCap, PTO.LicmMssaNoAccForPromotionCap,
1451 if (Opts.enable_matrix) {
1482 if (PTO.LoopInterchange)
1503 addVectorPasses(Level, OptimizePM, LTOPhase);
1523 if (Opts.enable_mergeicmps)
1535 .convertSwitchRangeToICmp(
true)
1536 .convertSwitchToArithmetic(
true)
1537 .speculateUnpredictables(
true)
1538 .hoistLoadsStoresWithCondFaulting(
true)));
1542 PTO.EagerlyInvalidateAnalyses));
1552 if (Opts.enable_instrumentor)
1570 if (PTO.MergeFunctions)
1590 PTO.DevirtualizeSpeculatively));
1631 if (Opts.opt_pipeline_trigger_crash)
1634 if (PGOOpt && PGOOpt->DebugInfoForProfiling)
1646 if (PGOOpt && PGOOpt->PseudoProbeForProfiling &&
1654 addRequiredLTOPreLinkPasses(MPM);
1662 bool EmitSummary,
bool Verify) {
1736 if (PGOOpt && PGOOpt->DebugInfoForProfiling)
1751 addRequiredLTOPreLinkPasses(MPM);
1762 if (Opts.enable_partial_inlining)
1765 if (PGOOpt && PGOOpt->PseudoProbeForProfiling &&
1783 addRequiredLTOPreLinkPasses(MPM);
1804 if (ImportSummary) {
1924 PGOOpt->ProfileRemappingFile,
2041 PTO.EagerlyInvalidateAnalyses));
2084 if (Opts.enable_constraint_elimination)
2093 addPGOInstrPasses(MPM, Level,
true,
2094 true, PGOOpt->AtomicCounterUpdate,
2095 PGOOpt->CSProfileGenFile, PGOOpt->ProfileRemappingFile);
2097 addPGOInstrPasses(MPM, Level,
false,
2098 true, PGOOpt->AtomicCounterUpdate,
2099 PGOOpt->ProfileFile, PGOOpt->ProfileRemappingFile);
2112 PTO.EagerlyInvalidateAnalyses));
2119 if (Opts.enable_global_analyses) {
2129 LICMPass(PTO.LicmMssaOptCap, PTO.LicmMssaNoAccForPromotionCap,
2133 if (Opts.enable_newgvn)
2160 PTO.ForgetAllSCEVInLoopUnroll));
2179 PTO.EagerlyInvalidateAnalyses));
2191 if (Opts.hot_cold_split)
2210 .convertSwitchRangeToICmp(
true)
2211 .convertSwitchToArithmetic(
true)
2212 .hoistCommonInsts(
true)
2213 .speculateUnpredictables(
true)));
2222 if (PTO.MergeFunctions)
2227 if (PTO.CallGraphProfile)
2250 "buildO0DefaultPipeline should only be used with O0");
2260 if (PGOOpt && PGOOpt->PseudoProbeForProfiling)
2268 false, PGOOpt->AtomicCounterUpdate, PGOOpt->ProfileFile,
2269 PGOOpt->ProfileRemappingFile);
2277 if (PGOOpt && PGOOpt->DebugInfoForProfiling)
2284 PGOOpt->ProfileRemappingFile,
2302 if (PTO.MergeFunctions)
2305 if (Opts.enable_matrix)
2309 if (!CGSCCOptimizerLateEPCallbacks.empty()) {
2315 if (!LateLoopOptimizationsEPCallbacks.empty()) {
2318 if (!LPM.isEmpty()) {
2323 if (!LoopOptimizerEndEPCallbacks.empty()) {
2326 if (!LPM.isEmpty()) {
2331 if (!ScalarOptimizerLateEPCallbacks.empty()) {
2340 if (!VectorizerStartEPCallbacks.empty()) {
2347 if (!VectorizerEndEPCallbacks.empty()) {
2363 if (Opts.enable_instrumentor)
2370 addRequiredLTOPreLinkPasses(MPM);
2388 TM->registerEarlyDefaultAliasAnalyses(
AA);
2404 if (Opts.enable_global_analyses)
2409 TM->registerDefaultAliasAnalyses(
AA);
2414bool 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 bool isThinLTOPostLink(ThinOrFullLTOPhase Phase)
static void addAnnotationRemarksPass(ModulePassManager &MPM)
static CoroConditionalWrapper buildCoroWrapper(ThinOrFullLTOPhase Phase)
static bool isFullLTOPostLink(ThinOrFullLTOPhase Phase)
static void addModuleInlinerPass(ModulePassManager &MPM, const PassesOptions &Opts, OptimizationLevel Level, 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.
This class implements a trivial dead store elimination.
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.
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()
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.
unsigned LicmMssaNoAccForPromotionCap
Tuning option to disable promotion to scalars in LICM with MemorySSA, if the number of access is too ...
bool SLPVectorization
Tuning option to enable/disable slp loop vectorization, set based on opt level.
bool DevirtualizeSpeculatively
int InlinerThreshold
Tuning option to override the default inliner threshold.
bool LoopFusion
Tuning option to enable/disable loop fusion. Its default value is false.
bool EagerlyInvalidateAnalyses
bool CallGraphProfile
Tuning option to enable/disable call graph profile.
bool MergeFunctions
Tuning option to enable/disable function merging.
bool ForgetAllSCEVInLoopUnroll
Tuning option to forget all SCEV loops in LoopUnroll.
unsigned LicmMssaOptCap
Tuning option to cap the number of calls to retrive clobbering accesses in MemorySSA,...
bool LoopInterleaving
Tuning option to set loop interleaving on/off, set based on opt level.
LLVM_ABI PipelineTuningOptions()
Constructor sets pipeline tuning defaults based on cl::opts.
bool LoopUnrolling
Tuning option to enable/disable loop unrolling. Its default value is true.
bool LoopInterchange
Tuning option to enable/disable loop interchange.
bool LoopVectorization
Tuning option to enable/disable loop vectorization, set based on opt level.
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
ModuleToFunctionPassAdaptor createModuleToFunctionPassAdaptor(FunctionPassT &&Pass, bool EagerlyInvalidate=false)
A function to deduce a function pass type and wrap it in the templated adaptor.
cl::opt< std::string > UseCtxProfile("use-ctx-profile", cl::init(""), cl::Hidden, cl::desc("Use the specified contextual profile file"))
LLVM_ABI bool getForgetSCEVInLoopUnroll()
Returns -forget-scev-loop-unroll.
@ 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.
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.
PassManager< Module > ModulePassManager
Convenience typedef for a pass manager over modules.
LLVM_ABI bool AreStatisticsEnabled()
Check if statistics are enabled.
LLVM_ABI unsigned getLicmMssaNoAccForPromotionCap()
Returns -licm-mssa-max-acc-promotion.
cl::opt< bool > EnableMemProfContextDisambiguation
Enable MemProf context disambiguation for thin link.
PassManager< Function > FunctionPassManager
Convenience typedef for a pass manager over functions.
LLVM_ABI InlineParams getInlineParams()
Generate the parameters to tune the inline cost analysis based only on the commandline options.
LLVM_ABI unsigned getLicmMssaOptCap()
Returns -licm-mssa-optimization-cap.
LLVM_ABI InlineParams getInlineParamsFromOptLevel(unsigned OptLevel)
Generate the parameters to tune the inline cost analysis based on command line options.
cl::opt< unsigned > MaxDevirtIterations("max-devirt-iterations", cl::ReallyHidden, cl::init(4))
LLVM_ABI bool isPGOInstrumentColdFunctionOnly()
Return the value of -pgo-instrument-cold-function-only.
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.
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.