166 cl::desc(
"Enable ML policy for inliner. Currently trained for -Oz only"),
168 "Heuristics-based inliner version"),
170 "Use development mode (runtime-loadable model)"),
172 "Use release mode (AOT-compiled model)")));
178 cl::desc(
"Enable inline deferral during PGO"));
186 cl::desc(
"Perform mandatory inlinings module-wide, before performing "
191 cl::desc(
"Eagerly invalidate more analyses in default pipelines"));
195 cl::desc(
"Enable function merging as part of the optimization pipeline"));
199 cl::desc(
"Run the loop rotation transformation after PGO instrumentation"));
203 cl::desc(
"Trigger crash in optimization pipeline"));
207 cl::desc(
"Enable inter-procedural analyses"));
211 cl::desc(
"Run Partial inlining pass"));
215 cl::desc(
"Run cleanup optimization passes after vectorization"));
222 cl::desc(
"Enable the LoopInterchange Pass"));
226 cl::desc(
"Enable Unroll And Jam Pass"));
230 cl::desc(
"Enable the LoopFlatten Pass"));
234 cl::desc(
"Enable the Instrumentor Pass"));
238 cl::desc(
"Enable DFA jump threading"),
243 cl::desc(
"Enable hot-cold splitting pass"));
247 cl::desc(
"Disable pre-instrumentation inliner"));
251 cl::desc(
"Control the amount of inlining in pre-instrumentation inliner "
256 cl::desc(
"Enable the GVN hoisting pass (default = off)"));
260 cl::desc(
"Enable the GVN sinking pass (default = off)"));
263 "enable-jump-table-to-switch",
cl::init(
true),
264 cl::desc(
"Enable JumpTableToSwitch pass (default = true)"));
270 cl::desc(
"Enable control height reduction optimization (CHR)"));
274 cl::desc(
"Indicate the sample profile being used is flattened, i.e., "
275 "no inline hierarchy exists in the profile"));
279 cl::desc(
"Enable lowering of the matrix intrinsics"));
283 cl::desc(
"Enable MergeICmps pass in the optimization pipeline"));
288 "Enable pass to eliminate conditions based on linear constraints"));
292 cl::desc(
"Enable the attributor inter-procedural deduction pass"),
294 "enable all full attributor runs"),
296 "enable all attributor-light runs"),
298 "enable module-wide attributor runs"),
300 "enable module-wide attributor-light runs"),
302 "enable call graph SCC attributor runs"),
304 "enable call graph SCC attributor-light runs"),
306 "disable attributor runs")));
310 cl::desc(
"Enable profile instrumentation sampling (default = off)"));
313 cl::desc(
"Enable the experimental Loop Versioning LICM pass"));
316 "instrument-cold-function-only-path",
cl::init(
""),
317 cl::desc(
"File path for cold function only instrumentation(requires use "
318 "with --pgo-instrument-cold-function-only)"),
324 "enable-devirtualize-speculatively",
325 cl::desc(
"Enable speculative devirtualization optimization"),
358 for (
auto &
C : PeepholeEPCallbacks)
363 for (
auto &
C : LateLoopOptimizationsEPCallbacks)
368 for (
auto &
C : LoopOptimizerEndEPCallbacks)
373 for (
auto &
C : ScalarOptimizerLateEPCallbacks)
378 for (
auto &
C : CGSCCOptimizerLateEPCallbacks)
383 for (
auto &
C : VectorizerStartEPCallbacks)
388 for (
auto &
C : VectorizerEndEPCallbacks)
394 for (
auto &
C : OptimizerEarlyEPCallbacks)
400 for (
auto &
C : OptimizerLastEPCallbacks)
405 for (
auto &
C : FullLinkTimeOptimizationEarlyEPCallbacks)
410 for (
auto &
C : FullLinkTimeOptimizationLastEPCallbacks)
415 for (
auto &
C : ThinLinkTimeOptimizationEarlyEPCallbacks)
420 for (
auto &
C : ThinLinkTimeOptimizationLastEPCallbacks)
425 for (
auto &
C : PipelineStartEPCallbacks)
430 for (
auto &
C : PipelineEarlySimplificationEPCallbacks)
436 bool IsPreOptimization) {
503 FPM.
addPass(CountVisitsPass());
510 FPM.
addPass(EarlyCSEPass(
true ));
514 SimplifyCFGPass(SimplifyCFGOptions().convertSwitchRangeToICmp(
true)));
515 FPM.
addPass(InstCombinePass());
517 FPM.
addPass(LibCallsShrinkWrapPass());
522 SimplifyCFGPass(SimplifyCFGOptions().convertSwitchRangeToICmp(
true)));
527 FPM.
addPass(ReassociatePass());
543 LPM1.addPass(LoopInstSimplifyPass());
544 LPM1.addPass(LoopSimplifyCFGPass());
552 LPM1.addPass(LICMPass(PTO.LicmMssaOptCap, PTO.LicmMssaNoAccForPromotionCap,
558 LPM1.addPass(LICMPass(PTO.LicmMssaOptCap, PTO.LicmMssaNoAccForPromotionCap,
560 LPM1.addPass(SimpleLoopUnswitchPass());
562 LPM1.addPass(LoopFlattenPass());
564 LPM2.addPass(LoopIdiomRecognizePass());
565 LPM2.addPass(IndVarSimplifyPass());
569 LPM2.addPass(LoopDeletionPass());
578 LPM2.addPass(LoopFullUnrollPass(
static_cast<int>(Level),
580 PTO.ForgetAllSCEVInLoopUnroll));
587 SimplifyCFGPass(SimplifyCFGOptions().convertSwitchRangeToICmp(
true)));
588 FPM.
addPass(InstCombinePass());
612 FPM.
addPass(InstCombinePass());
624 SimplifyCFGPass(SimplifyCFGOptions().convertSwitchRangeToICmp(
true)));
625 FPM.
addPass(InstCombinePass());
639 return buildO1FunctionSimplificationPipeline(Level,
Phase);
691 isInstrumentedPGOUse()));
726 LPM1.addPass(
LICMPass(PTO.LicmMssaOptCap, PTO.LicmMssaNoAccForPromotionCap,
732 LPM1.addPass(
LICMPass(PTO.LicmMssaOptCap, PTO.LicmMssaNoAccForPromotionCap,
746 LPM2.addPass(std::move(ExtraPasses));
762 PTO.ForgetAllSCEVInLoopUnroll));
826 LICMPass(PTO.LicmMssaOptCap, PTO.LicmMssaNoAccForPromotionCap,
835 .convertSwitchRangeToICmp(
true)
836 .convertSwitchToArithmetic(
true)
837 .hoistCommonInsts(
true)
838 .sinkCommonInsts(
true)));
875 FPM.
addPass(SimplifyCFGPass(SimplifyCFGOptions().convertSwitchRangeToICmp(
877 FPM.
addPass(InstCombinePass());
881 std::move(FPM), PTO.EagerlyInvalidateAnalyses));
898 PTO.EagerlyInvalidateAnalyses));
904 bool IsCS,
bool AtomicCounterUpdate,
905 std::string ProfileFile,
906 std::string ProfileRemappingFile) {
909 if (!RunProfileGen) {
910 assert(!ProfileFile.empty() &&
"Profile use expecting a profile file!");
912 PGOInstrumentationUse(ProfileFile, ProfileRemappingFile, IsCS, FS));
915 MPM.
addPass(RequireAnalysisPass<ProfileSummaryAnalysis, Module>());
923 addPostPGOLoopRotation(MPM, Level);
926 if (!ProfileFile.empty())
927 Options.InstrProfileOutput = ProfileFile;
929 Options.DoCounterPromotion =
true;
930 Options.UseBFIInPromotion = IsCS;
935 Options.DoCounterPromotion =
false;
937 Options.Atomic = AtomicCounterUpdate;
942 bool RunProfileGen,
bool IsCS,
943 bool AtomicCounterUpdate,
944 std::string ProfileFile,
945 std::string ProfileRemappingFile) {
946 if (!RunProfileGen) {
947 assert(!ProfileFile.empty() &&
"Profile use expecting a profile file!");
961 if (!ProfileFile.empty())
962 Options.InstrProfileOutput = ProfileFile;
964 Options.DoCounterPromotion =
false;
965 Options.UseBFIInPromotion = IsCS;
966 Options.Atomic = AtomicCounterUpdate;
978 if (PTO.InlinerThreshold == -1)
1051 PTO.EagerlyInvalidateAnalyses,
true));
1112 PTO.EagerlyInvalidateAnalyses));
1128 "Should not be used for O0 pipeline");
1131 "FullLTOPostLink shouldn't call buildModuleSimplificationPipeline!");
1145 bool LoadSampleProfile =
1186 std::move(EarlyFPM), PTO.EagerlyInvalidateAnalyses));
1189 if (LoadSampleProfile) {
1193 PGOOpt->ProfileFile, PGOOpt->ProfileRemappingFile,
Phase, FS));
1249 PTO.EagerlyInvalidateAnalyses));
1254 const bool IsCtxProfGen =
1256 const bool IsPGOPreLink = !IsCtxProfGen && PGOOpt && IsPreLink;
1257 const bool IsPGOInstrGen =
1259 const bool IsPGOInstrUse =
1261 const bool IsMemprofUse = IsPGOPreLink && !PGOOpt->MemoryProfile.empty();
1265 "Enabling both instrumented PGO and contextual instrumentation is not "
1271 "--instrument-cold-function-only-path is provided but "
1272 "--pgo-instrument-cold-function-only is not enabled");
1277 if (IsPGOInstrGen || IsPGOInstrUse || IsMemprofUse || IsCtxProfGen ||
1278 IsCtxProfUse || IsColdFuncOnlyInstrGen)
1279 addPreInlinerPasses(MPM, Level,
Phase);
1282 if (IsPGOInstrGen || IsPGOInstrUse) {
1283 addPGOInstrPasses(MPM, Level,
1285 false, PGOOpt->AtomicCounterUpdate,
1286 PGOOpt->ProfileFile, PGOOpt->ProfileRemappingFile);
1287 }
else if (IsCtxProfGen || IsCtxProfUse) {
1304 addPostPGOLoopRotation(MPM, Level);
1307 }
else if (IsColdFuncOnlyInstrGen) {
1308 addPGOInstrPasses(MPM, Level,
true,
false,
1314 if (IsPGOInstrGen || IsPGOInstrUse || IsCtxProfGen)
1405 FPM.
addPass(InstCombinePass());
1408 ExtraFunctionPassManager<ShouldRunExtraVectorPasses> ExtraPasses;
1415 ExtraPasses.
addPass(EarlyCSEPass());
1416 ExtraPasses.
addPass(CorrelatedValuePropagationPass());
1417 ExtraPasses.
addPass(InstCombinePass());
1419 LPM.addPass(LICMPass(PTO.LicmMssaOptCap, PTO.LicmMssaNoAccForPromotionCap,
1421 LPM.addPass(SimpleLoopUnswitchPass( Level ==
1426 SimplifyCFGPass(SimplifyCFGOptions().convertSwitchRangeToICmp(
true)));
1427 ExtraPasses.
addPass(InstCombinePass());
1428 FPM.
addPass(std::move(ExtraPasses));
1440 FPM.
addPass(SimplifyCFGPass(SimplifyCFGOptions()
1441 .forwardSwitchCondToPhi(
true)
1442 .convertSwitchRangeToICmp(
true)
1443 .convertSwitchToArithmetic(
true)
1444 .convertSwitchToLookupTable(
true)
1445 .needCanonicalLoops(
false)
1446 .hoistCommonInsts(
true)
1447 .sinkCommonInsts(
true)));
1451 FPM.
addPass(InstCombinePass());
1456 if (PTO.SLPVectorization) {
1457 FPM.
addPass(SLPVectorizerPass());
1463 FPM.
addPass(VectorCombinePass());
1466 FPM.
addPass(InstCombinePass());
1476 LoopUnrollAndJamPass(
static_cast<int>(Level))));
1478 FPM.
addPass(LoopUnrollPass(LoopUnrollOptions(
1479 static_cast<int>(Level), !PTO.LoopUnrolling,
1480 PTO.ForgetAllSCEVInLoopUnroll)));
1481 FPM.
addPass(WarnMissedTransformationsPass());
1500 FPM.
addPass(InferAlignmentPass());
1501 FPM.
addPass(InstCombinePass());
1510 LICMPass(PTO.LicmMssaOptCap, PTO.LicmMssaNoAccForPromotionCap,
1516 FPM.
addPass(AlignmentFromAssumptionsPass());
1552 addPGOInstrPasses(MPM, Level,
true,
1553 true, PGOOpt->AtomicCounterUpdate,
1554 PGOOpt->CSProfileGenFile, PGOOpt->ProfileRemappingFile);
1556 addPGOInstrPasses(MPM, Level,
false,
1557 true, PGOOpt->AtomicCounterUpdate,
1558 PGOOpt->ProfileFile, PGOOpt->ProfileRemappingFile);
1591 LICMPass(PTO.LicmMssaOptCap, PTO.LicmMssaNoAccForPromotionCap,
1632 if (PTO.LoopInterchange)
1653 addVectorPasses(Level, OptimizePM, LTOPhase);
1685 .convertSwitchRangeToICmp(
true)
1686 .convertSwitchToArithmetic(
true)
1687 .speculateUnpredictables(
true)
1688 .hoistLoadsStoresWithCondFaulting(
true)));
1692 PTO.EagerlyInvalidateAnalyses));
1720 if (PTO.MergeFunctions)
1740 PTO.DevirtualizeSpeculatively));
1793 if (PGOOpt && PGOOpt->DebugInfoForProfiling)
1805 if (PGOOpt && PGOOpt->PseudoProbeForProfiling &&
1813 addRequiredLTOPreLinkPasses(MPM);
1821 bool EmitSummary,
bool Verify) {
1895 if (PGOOpt && PGOOpt->DebugInfoForProfiling)
1910 addRequiredLTOPreLinkPasses(MPM);
1924 if (PGOOpt && PGOOpt->PseudoProbeForProfiling &&
1942 addRequiredLTOPreLinkPasses(MPM);
1963 if (ImportSummary) {
2083 PGOOpt->ProfileRemappingFile,
2200 PTO.EagerlyInvalidateAnalyses));
2262 addPGOInstrPasses(MPM, Level,
true,
2263 true, PGOOpt->AtomicCounterUpdate,
2264 PGOOpt->CSProfileGenFile, PGOOpt->ProfileRemappingFile);
2266 addPGOInstrPasses(MPM, Level,
false,
2267 true, PGOOpt->AtomicCounterUpdate,
2268 PGOOpt->ProfileFile, PGOOpt->ProfileRemappingFile);
2281 PTO.EagerlyInvalidateAnalyses));
2298 LICMPass(PTO.LicmMssaOptCap, PTO.LicmMssaNoAccForPromotionCap,
2329 PTO.ForgetAllSCEVInLoopUnroll));
2348 PTO.EagerlyInvalidateAnalyses));
2379 .convertSwitchRangeToICmp(
true)
2380 .convertSwitchToArithmetic(
true)
2381 .hoistCommonInsts(
true)
2382 .speculateUnpredictables(
true)));
2391 if (PTO.MergeFunctions)
2396 if (PTO.CallGraphProfile)
2419 "buildO0DefaultPipeline should only be used with O0");
2429 if (PGOOpt && PGOOpt->PseudoProbeForProfiling)
2437 false, PGOOpt->AtomicCounterUpdate, PGOOpt->ProfileFile,
2438 PGOOpt->ProfileRemappingFile);
2446 if (PGOOpt && PGOOpt->DebugInfoForProfiling)
2453 PGOOpt->ProfileRemappingFile,
2471 if (PTO.MergeFunctions)
2478 if (!CGSCCOptimizerLateEPCallbacks.empty()) {
2484 if (!LateLoopOptimizationsEPCallbacks.empty()) {
2487 if (!LPM.isEmpty()) {
2492 if (!LoopOptimizerEndEPCallbacks.empty()) {
2495 if (!LPM.isEmpty()) {
2500 if (!ScalarOptimizerLateEPCallbacks.empty()) {
2509 if (!VectorizerStartEPCallbacks.empty()) {
2516 if (!VectorizerEndEPCallbacks.empty()) {
2539 addRequiredLTOPreLinkPasses(MPM);
2557 TM->registerEarlyDefaultAliasAnalyses(
AA);
2578 TM->registerDefaultAliasAnalyses(
AA);
2583bool 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.
#define clEnumValN(ENUMVAL, FLAGNAME, DESC)
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 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.
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.
ValuesClass values(OptsTy... Options)
Helper to build a ValuesClass by forwarding a variable number of arguments as an initializer list to ...
initializer< Ty > init(const Ty &Val)
@ 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
static cl::opt< bool > RunNewGVN("enable-newgvn", cl::init(false), cl::Hidden, cl::desc("Run the NewGVN pass"))
static cl::opt< bool > DisablePreInliner("disable-preinline", cl::init(false), cl::Hidden, cl::desc("Disable pre-instrumentation inliner"))
static cl::opt< bool > EnableDFAJumpThreading("enable-dfa-jump-thread", cl::desc("Enable DFA jump threading"), cl::init(true), cl::Hidden)
static cl::opt< bool > PerformMandatoryInliningsFirst("mandatory-inlining-first", cl::init(false), cl::Hidden, cl::desc("Perform mandatory inlinings module-wide, before performing " "inlining"))
static cl::opt< bool > RunPartialInlining("enable-partial-inlining", cl::init(false), cl::Hidden, cl::desc("Run Partial inlining pass"))
static cl::opt< bool > EnableGVNSink("enable-gvn-sink", cl::desc("Enable the GVN sinking pass (default = off)"))
static cl::opt< bool > EnableModuleInliner("enable-module-inliner", cl::init(false), cl::Hidden, cl::desc("Enable module inliner"))
static cl::opt< bool > EnableEagerlyInvalidateAnalyses("eagerly-invalidate-analyses", cl::init(true), cl::Hidden, cl::desc("Eagerly invalidate more analyses in default pipelines"))
static cl::opt< bool > EnableMatrix("enable-matrix", cl::init(false), cl::Hidden, cl::desc("Enable lowering of the matrix intrinsics"))
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"))
static cl::opt< bool > EnableSampledInstr("enable-sampled-instrumentation", cl::init(false), cl::Hidden, cl::desc("Enable profile instrumentation sampling (default = off)"))
static cl::opt< bool > EnableLoopFlatten("enable-loop-flatten", cl::init(false), cl::Hidden, cl::desc("Enable the LoopFlatten Pass"))
@ 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...
static cl::opt< InliningAdvisorMode > UseInlineAdvisor("enable-ml-inliner", cl::init(InliningAdvisorMode::Default), cl::Hidden, cl::desc("Enable ML policy for inliner. Currently trained for -Oz only"), cl::values(clEnumValN(InliningAdvisorMode::Default, "default", "Heuristics-based inliner version"), clEnumValN(InliningAdvisorMode::Development, "development", "Use development mode (runtime-loadable model)"), clEnumValN(InliningAdvisorMode::Release, "release", "Use release mode (AOT-compiled model)")))
static cl::opt< bool > EnableJumpTableToSwitch("enable-jump-table-to-switch", cl::init(true), cl::desc("Enable JumpTableToSwitch pass (default = true)"))
PassManager< LazyCallGraph::SCC, CGSCCAnalysisManager, LazyCallGraph &, CGSCCUpdateResult & > CGSCCPassManager
The CGSCC pass manager.
static cl::opt< bool > EnableUnrollAndJam("enable-unroll-and-jam", cl::init(false), cl::Hidden, cl::desc("Enable Unroll And Jam Pass"))
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.
static cl::opt< bool > EnableConstraintElimination("enable-constraint-elimination", cl::init(true), cl::Hidden, cl::desc("Enable pass to eliminate conditions based on linear constraints"))
ModuleToPostOrderCGSCCPassAdaptor createModuleToPostOrderCGSCCPassAdaptor(CGSCCPassT &&Pass)
A function to deduce a function pass type and wrap it in the templated adaptor.
static cl::opt< bool > EnablePGOInlineDeferral("enable-npm-pgo-inline-deferral", cl::init(true), cl::Hidden, cl::desc("Enable inline deferral during PGO"))
Flag to enable inline deferral during PGO.
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 cl::opt< bool > ForgetSCEVInLoopUnroll
PassManager< Module > ModulePassManager
Convenience typedef for a pass manager over modules.
static cl::opt< bool > EnablePostPGOLoopRotation("enable-post-pgo-loop-rotation", cl::init(true), cl::Hidden, cl::desc("Run the loop rotation transformation after PGO instrumentation"))
LLVM_ABI bool AreStatisticsEnabled()
Check if statistics are enabled.
static cl::opt< std::string > InstrumentColdFuncOnlyPath("instrument-cold-function-only-path", cl::init(""), cl::desc("File path for cold function only instrumentation(requires use " "with --pgo-instrument-cold-function-only)"), cl::Hidden)
static cl::opt< bool > EnableGlobalAnalyses("enable-global-analyses", cl::init(true), cl::Hidden, cl::desc("Enable inter-procedural analyses"))
static cl::opt< bool > FlattenedProfileUsed("flattened-profile-used", cl::init(false), cl::Hidden, cl::desc("Indicate the sample profile being used is flattened, i.e., " "no inline hierarchy exists in the profile"))
static cl::opt< AttributorRunOption > AttributorRun("attributor-enable", cl::Hidden, cl::init(AttributorRunOption::NONE), cl::desc("Enable the attributor inter-procedural deduction pass"), cl::values(clEnumValN(AttributorRunOption::FULL, "full", "enable all full attributor runs"), clEnumValN(AttributorRunOption::LIGHT, "light", "enable all attributor-light runs"), clEnumValN(AttributorRunOption::MODULE, "module", "enable module-wide attributor runs"), clEnumValN(AttributorRunOption::MODULE_LIGHT, "module-light", "enable module-wide attributor-light runs"), clEnumValN(AttributorRunOption::CGSCC, "cgscc", "enable call graph SCC attributor runs"), clEnumValN(AttributorRunOption::CGSCC_LIGHT, "cgscc-light", "enable call graph SCC attributor-light runs"), clEnumValN(AttributorRunOption::NONE, "none", "disable attributor runs")))
static cl::opt< bool > EnableLoopInterchange("enable-loopinterchange", cl::init(true), cl::Hidden, cl::desc("Enable the LoopInterchange Pass"))
static cl::opt< bool > ExtraVectorizerPasses("extra-vectorizer-passes", cl::init(false), cl::Hidden, cl::desc("Run cleanup optimization passes after vectorization"))
static cl::opt< bool > EnableHotColdSplit("hot-cold-split", cl::desc("Enable hot-cold splitting pass"))
cl::opt< bool > EnableMemProfContextDisambiguation
Enable MemProf context disambiguation for thin link.
static cl::opt< bool > TriggerCrash("opt-pipeline-trigger-crash", cl::init(false), cl::Hidden, cl::desc("Trigger crash in optimization pipeline"))
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.
cl::opt< bool > PGOInstrumentColdFunctionOnly
static cl::opt< bool > EnableCHR("enable-chr", cl::init(true), cl::Hidden, cl::desc("Enable control height reduction optimization (CHR)"))
static cl::opt< bool > EnableMergeFunctions("enable-merge-functions", cl::init(false), cl::Hidden, cl::desc("Enable function merging as part of the optimization pipeline"))
static cl::opt< bool > EnableDevirtualizeSpeculatively("enable-devirtualize-speculatively", cl::desc("Enable speculative devirtualization optimization"), cl::init(false))
static cl::opt< bool > EnableGVNHoist("enable-gvn-hoist", cl::desc("Enable the GVN hoisting pass (default = off)"))
LLVM_ABI cl::opt< unsigned > SetLicmMssaNoAccForPromotionCap
LLVM_ABI InlineParams getInlineParamsFromOptLevel(unsigned OptLevel)
Generate the parameters to tune the inline cost analysis based on command line options.
static cl::opt< int > PreInlineThreshold("preinline-threshold", cl::Hidden, cl::init(75), cl::desc("Control the amount of inlining in pre-instrumentation inliner " "(default = 75)"))
static cl::opt< bool > UseLoopVersioningLICM("enable-loop-versioning-licm", cl::init(false), cl::Hidden, cl::desc("Enable the experimental Loop Versioning LICM pass"))
cl::opt< unsigned > MaxDevirtIterations("max-devirt-iterations", cl::ReallyHidden, cl::init(4))
LLVM_ABI cl::opt< unsigned > SetLicmMssaOptCap
static cl::opt< bool > EnableInstrumentor("enable-instrumentor", cl::init(false), cl::Hidden, cl::desc("Enable the Instrumentor Pass"))
static cl::opt< bool > EnableMergeICmps("enable-mergeicmps", cl::init(true), cl::Hidden, cl::desc("Enable MergeICmps pass in the optimization pipeline"))
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.