147 #include <type_traits>
149 using namespace llvm;
156 cl::desc(
"Run Partial inlinining pass"));
161 cl::desc(
"Run NewGVN instead of GVN"));
165 cl::desc(
"Enable the EarlyCSE w/ MemorySSA pass for the new PM (default = on)"));
169 cl::desc(
"Enable the GVN hoisting pass for the new PM (default = off)"));
173 cl::desc(
"Enable the GVN hoisting pass for the new PM (default = off)"));
176 "^(default|thinlto-pre-link|thinlto|lto-pre-link|lto)<(O[0123sz])>$");
196 struct NoOpModulePass {
215 struct NoOpCGSCCPass {
237 struct NoOpFunctionPass {
256 struct NoOpLoopPass {
284 void PassBuilder::invokePeepholeEPCallbacks(
286 for (
auto &
C : PeepholeEPCallbacks)
291 #define MODULE_ANALYSIS(NAME, CREATE_PASS) \
292 MAM.registerPass([&] { return CREATE_PASS; });
293 #include "PassRegistry.def"
295 for (
auto &
C : ModuleAnalysisRegistrationCallbacks)
300 #define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
301 CGAM.registerPass([&] { return CREATE_PASS; });
302 #include "PassRegistry.def"
304 for (
auto &
C : CGSCCAnalysisRegistrationCallbacks)
309 #define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
310 FAM.registerPass([&] { return CREATE_PASS; });
311 #include "PassRegistry.def"
313 for (
auto &
C : FunctionAnalysisRegistrationCallbacks)
318 #define LOOP_ANALYSIS(NAME, CREATE_PASS) \
319 LAM.registerPass([&] { return CREATE_PASS; });
320 #include "PassRegistry.def"
322 for (
auto &
C : LoopAnalysisRegistrationCallbacks)
329 bool PrepareForThinLTO) {
330 assert(Level !=
O0 &&
"Must request optimizations!");
362 invokePeepholeEPCallbacks(FPM, Level);
388 for (
auto &
C : LateLoopOptimizationsEPCallbacks)
395 if (!PrepareForThinLTO || !PGOOpt || PGOOpt->SampleProfileFile.empty())
398 for (
auto &
C : LoopOptimizerEndEPCallbacks)
435 invokePeepholeEPCallbacks(FPM, Level);
444 for (
auto &
C : ScalarOptimizerLateEPCallbacks)
452 invokePeepholeEPCallbacks(FPM, Level);
460 std::string ProfileGenFile,
461 std::string ProfileUseFile) {
486 invokePeepholeEPCallbacks(FPM, Level);
507 if (!ProfileGenFile.empty())
513 if (!ProfileUseFile.empty())
520 unsigned OptLevel = Level > O3 ? 2 :
Level;
521 unsigned SizeLevel = Level > O3 ? Level - O3 : 0;
528 bool PrepareForThinLTO) {
568 invokePeepholeEPCallbacks(GlobalCleanupPM, Level);
575 assert(PGOOpt->RunProfileGen || !PGOOpt->SampleProfileFile.empty() ||
576 !PGOOpt->ProfileUseFile.empty());
577 if (PGOOpt->SampleProfileFile.empty())
578 addPGOInstrPasses(MPM, DebugLogging, Level, PGOOpt->RunProfileGen,
579 PGOOpt->ProfileGenFile, PGOOpt->ProfileUseFile);
586 if (!PrepareForThinLTO || PGOOpt->SampleProfileFile.empty())
588 false, PGOOpt && !PGOOpt->SampleProfileFile.empty()));
616 if (PrepareForThinLTO && PGOOpt && !PGOOpt->SampleProfileFile.empty())
632 PrepareForThinLTO)));
634 for (
auto &
C : CGSCCOptimizerLateEPCallbacks)
635 C(MainCGPipeline, Level);
695 for (
auto &
C : VectorizerStartEPCallbacks)
696 C(OptimizePM, Level);
773 assert(Level !=
O0 &&
"Must request optimizations for the default pipeline!");
793 assert(Level !=
O0 &&
"Must request optimizations for the default pipeline!");
838 true , PGOOpt && !PGOOpt->SampleProfileFile.empty() &&
839 !PGOOpt->ProfileUseFile.empty()));
854 assert(Level !=
O0 &&
"Must request optimizations for the default pipeline!");
861 assert(Level !=
O0 &&
"Must request optimizations for the default pipeline!");
881 true , PGOOpt && !PGOOpt->SampleProfileFile.empty()));
928 invokePeepholeEPCallbacks(PeepholeFPM, Level);
950 invokePeepholeEPCallbacks(FPM, Level);
1002 invokePeepholeEPCallbacks(MainFPM, Level);
1093 template <
typename PassManagerT,
typename CallbacksT>
1095 if (!Callbacks.empty()) {
1096 PassManagerT DummyPM;
1097 for (
auto &CB : Callbacks)
1098 if (CB(Name, DummyPM, {}))
1104 template <
typename CallbacksT>
1111 if (Name ==
"module")
1113 if (Name ==
"cgscc")
1115 if (Name ==
"function")
1122 #define MODULE_PASS(NAME, CREATE_PASS) \
1125 #define MODULE_ANALYSIS(NAME, CREATE_PASS) \
1126 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1128 #include "PassRegistry.def"
1130 return callbacksAcceptPassName<ModulePassManager>(
Name, Callbacks);
1133 template <
typename CallbacksT>
1136 if (Name ==
"cgscc")
1138 if (Name ==
"function")
1147 #define CGSCC_PASS(NAME, CREATE_PASS) \
1150 #define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
1151 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1153 #include "PassRegistry.def"
1155 return callbacksAcceptPassName<CGSCCPassManager>(
Name, Callbacks);
1158 template <
typename CallbacksT>
1161 if (Name ==
"function")
1170 #define FUNCTION_PASS(NAME, CREATE_PASS) \
1173 #define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
1174 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1176 #include "PassRegistry.def"
1178 return callbacksAcceptPassName<FunctionPassManager>(
Name, Callbacks);
1181 template <
typename CallbacksT>
1191 #define LOOP_PASS(NAME, CREATE_PASS) \
1194 #define LOOP_ANALYSIS(NAME, CREATE_PASS) \
1195 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1197 #include "PassRegistry.def"
1199 return callbacksAcceptPassName<LoopPassManager>(
Name, Callbacks);
1203 PassBuilder::parsePipelineText(
StringRef Text) {
1204 std::vector<PipelineElement> ResultPipeline;
1209 std::vector<PipelineElement> &Pipeline = *PipelineStack.
back();
1211 Pipeline.push_back({Text.
substr(0, Pos), {}});
1214 if (Pos == Text.
npos)
1217 char Sep = Text[Pos];
1218 Text = Text.
substr(Pos + 1);
1225 PipelineStack.
push_back(&Pipeline.back().InnerPipeline);
1229 assert(Sep ==
')' &&
"Bogus separator!");
1234 if (PipelineStack.
size() == 1)
1250 if (PipelineStack.
size() > 1)
1254 assert(PipelineStack.
back() == &ResultPipeline &&
1255 "Wrong pipeline at the bottom of the stack!");
1256 return {std::move(ResultPipeline)};
1260 const PipelineElement &
E,
bool VerifyEachPass,
1261 bool DebugLogging) {
1262 auto &
Name = E.Name;
1263 auto &InnerPipeline = E.InnerPipeline;
1266 if (!InnerPipeline.empty()) {
1267 if (
Name ==
"module") {
1269 if (!parseModulePassPipeline(NestedMPM, InnerPipeline, VerifyEachPass,
1272 MPM.
addPass(std::move(NestedMPM));
1275 if (
Name ==
"cgscc") {
1277 if (!parseCGSCCPassPipeline(CGPM, InnerPipeline, VerifyEachPass,
1284 if (
Name ==
"function") {
1286 if (!parseFunctionPassPipeline(FPM, InnerPipeline, VerifyEachPass,
1294 if (!parseModulePassPipeline(NestedMPM, InnerPipeline, VerifyEachPass,
1301 for (
auto &
C : ModulePipelineParsingCallbacks)
1302 if (
C(
Name, MPM, InnerPipeline))
1314 assert(Matches.
size() == 3 &&
"Must capture two matched strings!");
1327 if (Matches[1] ==
"default") {
1329 }
else if (Matches[1] ==
"thinlto-pre-link") {
1331 }
else if (Matches[1] ==
"thinlto") {
1333 }
else if (Matches[1] ==
"lto-pre-link") {
1336 assert(Matches[1] ==
"lto" &&
"Not one of the matched options!");
1343 #define MODULE_PASS(NAME, CREATE_PASS) \
1344 if (Name == NAME) { \
1345 MPM.addPass(CREATE_PASS); \
1348 #define MODULE_ANALYSIS(NAME, CREATE_PASS) \
1349 if (Name == "require<" NAME ">") { \
1351 RequireAnalysisPass< \
1352 std::remove_reference<decltype(CREATE_PASS)>::type, Module>()); \
1355 if (Name == "invalidate<" NAME ">") { \
1356 MPM.addPass(InvalidateAnalysisPass< \
1357 std::remove_reference<decltype(CREATE_PASS)>::type>()); \
1360 #include "PassRegistry.def"
1362 for (
auto &
C : ModulePipelineParsingCallbacks)
1363 if (
C(
Name, MPM, InnerPipeline))
1369 const PipelineElement &E,
bool VerifyEachPass,
1370 bool DebugLogging) {
1371 auto &
Name = E.Name;
1372 auto &InnerPipeline = E.InnerPipeline;
1375 if (!InnerPipeline.empty()) {
1376 if (
Name ==
"cgscc") {
1378 if (!parseCGSCCPassPipeline(NestedCGPM, InnerPipeline, VerifyEachPass,
1382 CGPM.
addPass(std::move(NestedCGPM));
1385 if (
Name ==
"function") {
1387 if (!parseFunctionPassPipeline(FPM, InnerPipeline, VerifyEachPass,
1397 if (!parseCGSCCPassPipeline(NestedCGPM, InnerPipeline, VerifyEachPass,
1405 if (!parseCGSCCPassPipeline(NestedCGPM, InnerPipeline, VerifyEachPass,
1409 *MaxRepetitions, DebugLogging));
1413 for (
auto &
C : CGSCCPipelineParsingCallbacks)
1414 if (
C(
Name, CGPM, InnerPipeline))
1422 #define CGSCC_PASS(NAME, CREATE_PASS) \
1423 if (Name == NAME) { \
1424 CGPM.addPass(CREATE_PASS); \
1427 #define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
1428 if (Name == "require<" NAME ">") { \
1429 CGPM.addPass(RequireAnalysisPass< \
1430 std::remove_reference<decltype(CREATE_PASS)>::type, \
1431 LazyCallGraph::SCC, CGSCCAnalysisManager, LazyCallGraph &, \
1432 CGSCCUpdateResult &>()); \
1435 if (Name == "invalidate<" NAME ">") { \
1436 CGPM.addPass(InvalidateAnalysisPass< \
1437 std::remove_reference<decltype(CREATE_PASS)>::type>()); \
1440 #include "PassRegistry.def"
1442 for (
auto &
C : CGSCCPipelineParsingCallbacks)
1443 if (
C(
Name, CGPM, InnerPipeline))
1449 const PipelineElement &E,
1450 bool VerifyEachPass,
bool DebugLogging) {
1451 auto &
Name = E.Name;
1452 auto &InnerPipeline = E.InnerPipeline;
1455 if (!InnerPipeline.empty()) {
1456 if (
Name ==
"function") {
1458 if (!parseFunctionPassPipeline(NestedFPM, InnerPipeline, VerifyEachPass,
1462 FPM.
addPass(std::move(NestedFPM));
1465 if (
Name ==
"loop") {
1467 if (!parseLoopPassPipeline(LPM, InnerPipeline, VerifyEachPass,
1476 if (!parseFunctionPassPipeline(NestedFPM, InnerPipeline, VerifyEachPass,
1483 for (
auto &
C : FunctionPipelineParsingCallbacks)
1484 if (
C(
Name, FPM, InnerPipeline))
1492 #define FUNCTION_PASS(NAME, CREATE_PASS) \
1493 if (Name == NAME) { \
1494 FPM.addPass(CREATE_PASS); \
1497 #define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
1498 if (Name == "require<" NAME ">") { \
1500 RequireAnalysisPass< \
1501 std::remove_reference<decltype(CREATE_PASS)>::type, Function>()); \
1504 if (Name == "invalidate<" NAME ">") { \
1505 FPM.addPass(InvalidateAnalysisPass< \
1506 std::remove_reference<decltype(CREATE_PASS)>::type>()); \
1509 #include "PassRegistry.def"
1511 for (
auto &
C : FunctionPipelineParsingCallbacks)
1512 if (
C(
Name, FPM, InnerPipeline))
1517 bool PassBuilder::parseLoopPass(
LoopPassManager &LPM,
const PipelineElement &E,
1518 bool VerifyEachPass,
bool DebugLogging) {
1520 auto &InnerPipeline = E.InnerPipeline;
1523 if (!InnerPipeline.empty()) {
1524 if (Name ==
"loop") {
1526 if (!parseLoopPassPipeline(NestedLPM, InnerPipeline, VerifyEachPass,
1530 LPM.
addPass(std::move(NestedLPM));
1535 if (!parseLoopPassPipeline(NestedLPM, InnerPipeline, VerifyEachPass,
1542 for (
auto &
C : LoopPipelineParsingCallbacks)
1543 if (
C(Name, LPM, InnerPipeline))
1551 #define LOOP_PASS(NAME, CREATE_PASS) \
1552 if (Name == NAME) { \
1553 LPM.addPass(CREATE_PASS); \
1556 #define LOOP_ANALYSIS(NAME, CREATE_PASS) \
1557 if (Name == "require<" NAME ">") { \
1558 LPM.addPass(RequireAnalysisPass< \
1559 std::remove_reference<decltype(CREATE_PASS)>::type, Loop, \
1560 LoopAnalysisManager, LoopStandardAnalysisResults &, \
1564 if (Name == "invalidate<" NAME ">") { \
1565 LPM.addPass(InvalidateAnalysisPass< \
1566 std::remove_reference<decltype(CREATE_PASS)>::type>()); \
1569 #include "PassRegistry.def"
1571 for (
auto &
C : LoopPipelineParsingCallbacks)
1572 if (
C(Name, LPM, InnerPipeline))
1578 #define MODULE_ALIAS_ANALYSIS(NAME, CREATE_PASS) \
1579 if (Name == NAME) { \
1580 AA.registerModuleAnalysis< \
1581 std::remove_reference<decltype(CREATE_PASS)>::type>(); \
1584 #define FUNCTION_ALIAS_ANALYSIS(NAME, CREATE_PASS) \
1585 if (Name == NAME) { \
1586 AA.registerFunctionAnalysis< \
1587 std::remove_reference<decltype(CREATE_PASS)>::type>(); \
1590 #include "PassRegistry.def"
1592 for (
auto &
C : AAParsingCallbacks)
1600 bool VerifyEachPass,
1601 bool DebugLogging) {
1602 for (
const auto &Element : Pipeline) {
1603 if (!parseLoopPass(LPM, Element, VerifyEachPass, DebugLogging))
1612 bool VerifyEachPass,
1613 bool DebugLogging) {
1614 for (
const auto &Element : Pipeline) {
1615 if (!parseFunctionPass(FPM, Element, VerifyEachPass, DebugLogging))
1625 bool VerifyEachPass,
1626 bool DebugLogging) {
1627 for (
const auto &Element : Pipeline) {
1628 if (!parseCGSCCPass(CGPM, Element, VerifyEachPass, DebugLogging))
1650 bool VerifyEachPass,
1651 bool DebugLogging) {
1652 for (
const auto &Element : Pipeline) {
1653 if (!parseModulePass(MPM, Element, VerifyEachPass, DebugLogging))
1665 StringRef PipelineText,
bool VerifyEachPass,
1666 bool DebugLogging) {
1667 auto Pipeline = parsePipelineText(PipelineText);
1668 if (!Pipeline || Pipeline->empty())
1677 Pipeline = {{
"cgscc", std::move(*Pipeline)}};
1679 FunctionPipelineParsingCallbacks)) {
1680 Pipeline = {{
"function", std::move(*Pipeline)}};
1681 }
else if (
isLoopPassName(FirstName, LoopPipelineParsingCallbacks)) {
1682 Pipeline = {{
"function", {{
"loop", std::move(*Pipeline)}}}};
1684 for (
auto &
C : TopLevelPipelineParsingCallbacks)
1685 if (
C(MPM, *Pipeline, VerifyEachPass, DebugLogging))
1693 return parseModulePassPipeline(MPM, *Pipeline, VerifyEachPass, DebugLogging);
1698 StringRef PipelineText,
bool VerifyEachPass,
1699 bool DebugLogging) {
1700 auto Pipeline = parsePipelineText(PipelineText);
1701 if (!Pipeline || Pipeline->empty())
1708 return parseCGSCCPassPipeline(CGPM, *Pipeline, VerifyEachPass, DebugLogging);
1714 StringRef PipelineText,
bool VerifyEachPass,
1715 bool DebugLogging) {
1716 auto Pipeline = parsePipelineText(PipelineText);
1717 if (!Pipeline || Pipeline->empty())
1724 return parseFunctionPassPipeline(FPM, *Pipeline, VerifyEachPass,
1730 StringRef PipelineText,
bool VerifyEachPass,
1731 bool DebugLogging) {
1732 auto Pipeline = parsePipelineText(PipelineText);
1733 if (!Pipeline || Pipeline->empty())
1736 return parseLoopPassPipeline(CGPM, *Pipeline, VerifyEachPass, DebugLogging);
1742 if (PipelineText ==
"default") {
1747 while (!PipelineText.
empty()) {
1749 std::tie(Name, PipelineText) = PipelineText.
split(
',');
1750 if (!parseAAPassName(AA, Name))
Super simple passes to force specific function attrs from the commandline into the IR for debugging p...
This file provides the interface for the pass responsible for both simplifying and canonicalizing the...
Analysis pass providing a never-invalidated alias analysis result.
std::enable_if< std::numeric_limits< T >::is_signed, bool >::type getAsInteger(unsigned Radix, T &Result) const
Parse the current string as an integer of the specified radix.
Computes function attributes in post-order over the call graph.
A simple loop rotation transformation.
A simple and fast domtree-based CSE pass.
void push_back(const T &Elt)
The profile annotation (profile-instr-use) pass for IR based PGO.
Thresholds to tune inline cost analysis.
Interfaces for registering analysis passes, producing common pass manager configurations, and parsing of pass pipelines.
AAManager buildDefaultAAPipeline()
Build the default AAManager with the default alias analysis pipeline registered.
Eliminate dead arguments (and return values) from functions.
This is the interface for LLVM's inclusion-based alias analysis implemented with CFL graph reachabili...
DevirtSCCRepeatedPass< PassT > createDevirtSCCRepeatedPass(PassT Pass, int MaxIterations, bool DebugLogging=false)
A function to deduce a function pass type and wrap it in the templated adaptor.
static Optional< int > parseRepeatPassName(StringRef Name)
This header provides classes for managing a pipeline of passes over loops in LLVM IR...
This is the interface for a simple mod/ref and alias analysis over globals.
A Module instance is used to store all the information related to an LLVM module. ...
This file provides the primary interface to the instcombine pass.
This is the interface to build a ModuleSummaryIndex for a module.
Uses an "inverted" value numbering to decide the similarity of expressions and sinks similar expressi...
InnerAnalysisManagerProxy< LoopAnalysisManager, Function > LoopAnalysisManagerFunctionProxy
A proxy from a LoopAnalysisManager to a Function.
This file provides the interface for LLVM's Scalar Replacement of Aggregates pass.
This file implements a simple N^2 alias analysis accuracy evaluator.
Implements a lazy call graph analysis and related passes for the new pass manager.
RepeatedPass< PassT > createRepeatedPass(int Count, PassT P)
void registerModuleAnalyses(ModuleAnalysisManager &MAM)
Registers all available module analysis passes.
This is the interface for a metadata-based scoped no-alias analysis.
void registerModuleAnalysis()
Register a specific AA result.
OuterAnalysisManagerProxy< CGSCCAnalysisManager, Function > CGSCCAnalysisManagerFunctionProxy
A proxy from a CGSCCAnalysisManager to a Function.
Pass to remove unused function declarations.
OptimizationLevel
LLVM-provided high-level optimization levels.
ModulePassManager buildThinLTOPreLinkDefaultPipeline(OptimizationLevel Level, bool DebugLogging=false)
Build a pre-link, ThinLTO-targeting default optimization pipeline to a pass manager.
This file provides the interface for LLVM's PGO Instrumentation lowering pass.
OuterAnalysisManagerProxy< FunctionAnalysisManager, Loop, LoopStandardAnalysisResults & > FunctionAnalysisManagerLoopProxy
A proxy from a FunctionAnalysisManager to a Loop.
static cl::opt< bool > EnableEarlyCSEMemSSA("enable-npm-earlycse-memssa", cl::init(true), cl::Hidden, cl::desc("Enable the EarlyCSE w/ MemorySSA pass for the new PM (default = on)"))
The adaptor from a function pass to a loop pass computes these analyses and makes them available to t...
Pass to perform split of global variables.
This pass transforms loops that contain branches on loop-invariant conditions to have multiple loops...
A DCE pass that assumes instructions are dead until proven otherwise.
A utility pass template to force an analysis result to be available.
static cl::opt< bool > EnableGVNHoist("enable-npm-gvn-hoist", cl::init(false), cl::Hidden, cl::desc("Enable the GVN hoisting pass for the new PM (default = off)"))
Reassociate commutative expressions.
Support structure for SCC passes to communicate updates the call graph back to the CGSCC pass manager...
OuterAnalysisManagerProxy< ModuleAnalysisManager, LazyCallGraph::SCC, LazyCallGraph & > ModuleAnalysisManagerCGSCCProxy
A proxy from a ModuleAnalysisManager to an SCC.
Export information to summary.
Pass to forward loads in a loop around the backedge to subsequent iterations.
A pass that transforms external global definitions into declarations.
A simple and fast domtree-based GVN pass to hoist common expressions from sibling branches...
This is the interface for a SCEV-based alias analysis.
A pass to do RPO deduction and propagation of function attributes.
Optional< int > HintThreshold
Threshold to use for callees with inline hint.
bool parseAAPipeline(AAManager &AA, StringRef PipelineText)
Parse a textual alias analysis pipeline into the provided AA manager.
LLVM_ATTRIBUTE_ALWAYS_INLINE bool consume_back(StringRef Suffix)
Returns true if this StringRef has the given suffix and removes that suffix.
Similar to O2 but tries to optimize for small code size instead of fast execution without triggering ...
Instrumentation based profiling lowering pass.
ModulePassManager buildLTODefaultPipeline(OptimizationLevel Level, bool DebugLogging=false)
Build an LTO default optimization pipeline to a pass manager.
static cl::opt< bool > EnableGVNSink("enable-npm-gvn-sink", cl::init(false), cl::Hidden, cl::desc("Enable the GVN hoisting pass for the new PM (default = off)"))
InnerAnalysisManagerProxy< FunctionAnalysisManager, Module > FunctionAnalysisManagerModuleProxy
Provide the FunctionAnalysisManager to Module proxy.
void registerLoopAnalyses(LoopAnalysisManager &LAM)
Registers all available loop analysis passes.
A very specialized mode that will optimize for code size at any and all costs.
This file provides interfaces used to build and manipulate a call graph, which is a very useful tool ...
The sample profiler data loader pass.
LLVM_ATTRIBUTE_ALWAYS_INLINE StringSwitch & Case(const char(&S)[N], const T &Value)
This file provides the interface for IR based instrumentation passes ( (profile-gen, and profile-use).
LLVM_ATTRIBUTE_ALWAYS_INLINE bool consume_front(StringRef Prefix)
Returns true if this StringRef has the given prefix and removes that prefix.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
static bool isModulePassName(StringRef Name, CallbacksT &Callbacks)
This file provides the interface for a simple, fast CSE pass.
This file provides the interface for the GCOV style profiler pass.
Performs Loop Invariant Code Motion Pass.
The core GVN pass object.
void crossRegisterProxies(LoopAnalysisManager &LAM, FunctionAnalysisManager &FAM, CGSCCAnalysisManager &CGAM, ModuleAnalysisManager &MAM)
Cross register the analysis managers through their proxies.
Pass to remove unused function declarations.
A lazily constructed view of the call graph of a module.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
A pass that does profile-guided sinking of instructions into loops.
FunctionPassManager buildFunctionSimplificationPipeline(OptimizationLevel Level, bool DebugLogging=false, bool PrepareForThinLTO=false)
Construct the core LLVM function canonicalization and simplification pipeline.
void registerFunctionAnalysis()
Register a specific AA result.
This class implements a trivial dead store elimination.
LLVM_NODISCARD char front() const
front - Get the first character in the string.
Pass to perform interprocedural constant propagation.
A pass which infers function attributes from the names and signatures of function declarations in a m...
static cl::opt< unsigned > MaxDevirtIterations("pm-max-devirt-iterations", cl::ReallyHidden, cl::init(4))
A switch()-like statement whose cases are string literals.
This is the interface for LLVM's unification-based alias analysis implemented with CFL graph reachabi...
initializer< Ty > init(const Ty &Val)
static bool isOptimizingForSize(PassBuilder::OptimizationLevel Level)
A set of analyses that are preserved following a run of a transformation pass.
This is the interface for a metadata-based TBAA.
static Regex DefaultAliasRegex("^(default|thinlto-pre-link|thinlto|lto-pre-link|lto)<(O[0123sz])>$")
ModuleToFunctionPassAdaptor< FunctionPassT > createModuleToFunctionPassAdaptor(FunctionPassT Pass)
A function to deduce a function pass type and wrap it in the templated adaptor.
CGSCCToFunctionPassAdaptor< FunctionPassT > createCGSCCToFunctionPassAdaptor(FunctionPassT Pass, bool DebugLogging=false)
A function to deduce a function pass type and wrap it in the templated adaptor.
This file provides the interface for LLVM's Global Value Numbering pass which eliminates fully redund...
bool registerPass(PassBuilderT &&PassBuilder)
Register an analysis pass with the manager.
Disable as many optimizations as possible.
A manager for alias analyses.
ModulePassManager buildLTOPreLinkDefaultPipeline(OptimizationLevel Level, bool DebugLogging=false)
Build a pre-link, LTO-targeting default optimization pipeline to a pass manager.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
A CRTP mix-in that provides informational APIs needed for analysis passes.
static bool isFunctionPassName(StringRef Name, CallbacksT &Callbacks)
The inliner pass for the new pass manager.
void registerFunctionAnalyses(FunctionAnalysisManager &FAM)
Registers all available function analysis passes.
Analysis pass providing a never-invalidated alias analysis result.
This file provides the interface for LLVM's Global Value Numbering pass.
Optimize for fast execution as much as possible.
ModulePassManager buildModuleOptimizationPipeline(OptimizationLevel Level, bool DebugLogging=false)
Construct the core LLVM module optimization pipeline.
static bool callbacksAcceptPassName(StringRef Name, CallbacksT &Callbacks)
Tests whether registered callbacks will accept a given pass name.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
std::string InstrProfileOutput
This file implements the PredicateInfo analysis, which creates an Extended SSA form for operations us...
This file provides the interface for LLVM's Loop Data Prefetching Pass.
Provides passes to inlining "always_inline" functions.
FunctionToLoopPassAdaptor< LoopPassT > createFunctionToLoopPassAdaptor(LoopPassT Pass)
A function to deduce a loop pass type and wrap it in the templated adaptor.
This class provides an interface for updating the loop pass manager based on mutations to the loop ne...
This header defines the LoopLoadEliminationPass object.
InlineParams getInlineParams()
Generate the parameters to tune the inline cost analysis based only on the commandline options...
static Optional< int > parseDevirtPassName(StringRef Name)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Optimize for fast execution as much as possible without triggering significant incremental compile ti...
This pass performs 'jump threading', which looks at blocks that have multiple predecessors and multip...
bool parsePassPipeline(ModulePassManager &MPM, StringRef PipelineText, bool VerifyEachPass=true, bool DebugLogging=false)
Parse a textual pass pipeline description into a ModulePassManager.
A pass to simplify and canonicalize the CFG of a function.
static InlineParams getInlineParamsFromOptLevel(PassBuilder::OptimizationLevel Level)
ModulePassManager buildModuleSimplificationPipeline(OptimizationLevel Level, bool DebugLogging=false, bool PrepareForThinLTO=false)
Construct the core LLVM module canonicalization and simplification pipeline.
The instrumentation (profile-instr-gen) pass for IR based PGO.
LLVM_NODISCARD std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
A pass that merges duplicate global constants into a single constant.
Analysis pass providing a never-invalidated alias analysis result.
Options for the frontend instrumentation based profiling pass.
static LoopUnrollPass create(int OptLevel=2)
Create an instance of the loop unroll pass that will support both full and partial unrolling...
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
This pass performs merges of loads and stores on both sides of a.
llvm_unreachable("Unknown RegBank!")
Interfaces for passes which infer implicit function attributes from the name and signature of functio...
Analysis pass providing a never-invalidated alias analysis result.
ModulePassManager buildThinLTODefaultPipeline(OptimizationLevel Level, bool DebugLogging=false)
Build an ThinLTO default optimization pipeline to a pass manager.
Represents a single loop in the control flow graph.
Pass which forces specific function attributes into the IR, primarily as a debugging tool...
LLVM_ATTRIBUTE_ALWAYS_INLINE size_type size() const
The header file for the LowerExpectIntrinsic pass as used by the new pass manager.
Provides passes for computing function attributes based on interprocedural analyses.
OuterAnalysisManagerProxy< ModuleAnalysisManager, Function > ModuleAnalysisManagerFunctionProxy
Provide the ModuleAnalysisManager to Function proxy.
This pass removes redundant instructions.
This header provides classes for managing passes over SCCs of the call graph.
This file defines passes to print out IR in various granularities.
ModuleToPostOrderCGSCCPassAdaptor< CGSCCPassT > createModuleToPostOrderCGSCCPassAdaptor(CGSCCPassT Pass, bool DebugLogging=false)
A function to deduce a function pass type and wrap it in the templated adaptor.
void registerCGSCCAnalyses(CGSCCAnalysisManager &CGAM)
Registers all available CGSCC analysis passes.
LLVM_NODISCARD size_t find_first_of(char C, size_t From=0) const
Find the first character in the string that is C, or npos if not found.
static bool startsWithDefaultPipelineAliasPrefix(StringRef Name)
Tests whether a pass name starts with a valid prefix for a default pipeline alias.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Optimize quickly without destroying debuggability.
See the comments on JumpThreadingPass.
An SCC of the call graph.
static bool isCGSCCPassName(StringRef Name, CallbacksT &Callbacks)
static LoopUnrollPass createFull(int OptLevel=2)
Create an instance of the loop unroll pass that only does full loop unrolling.
bool match(StringRef String, SmallVectorImpl< StringRef > *Matches=nullptr)
matches - Match the regex against a given String.
An optimization pass providing Scalar Replacement of Aggregates.
This file exposes an interface to building/using memory SSA to walk memory instructions using a use/d...
StringRef - Represent a constant reference to a string, i.e.
This is the interface for LLVM's primary stateless and local alias analysis.
ModulePassManager buildPerModuleDefaultPipeline(OptimizationLevel Level, bool DebugLogging=false)
Build a per-module default optimization pipeline.
A container for analyses that lazily runs them and caches their results.
static cl::opt< bool > RunPartialInlining("enable-npm-partial-inlining", cl::init(false), cl::Hidden, cl::ZeroOrMore, cl::desc("Run Partial inlinining pass"))
This pass performs function-level constant propagation and merging.
This header defines various interfaces for pass management in LLVM.
InnerAnalysisManagerProxy< CGSCCAnalysisManager, Module > CGSCCAnalysisManagerModuleProxy
A proxy from a CGSCCAnalysisManager to a Module.
static cl::opt< bool > RunNewGVN("enable-npm-newgvn", cl::init(false), cl::Hidden, cl::ZeroOrMore, cl::desc("Run NewGVN instead of GVN"))
A special type used by analysis passes to provide an address that identifies that particular analysis...
This file provides the interface for the sampled PGO loader pass.
Optional< int > HotCallSiteThreshold
Threshold to use when the callsite is considered hot.
int DefaultThreshold
The default threshold to start with for a callee.
Optimize globals that never have their address taken.
Performs Loop Idiom Recognize Pass.
static bool isLoopPassName(StringRef Name, CallbacksT &Callbacks)