27 #include "llvm/Config/llvm-config.h" 49 #ifdef EXPENSIVE_CHECKS 52 bool llvm::VerifyLoopInfo =
false;
129 assert(PI !=
pred_end(H) &&
"Loop must have at least one backedge!");
144 assert(Incoming && Backedge &&
"expected non-null incoming and backedges");
151 BasicBlock *Incoming =
nullptr, *Backedge =
nullptr;
164 if (
ConstantInt *CI = dyn_cast<ConstantInt>(Inc->getOperand(1)))
174 if (
BranchInst *BI = dyn_cast_or_null<BranchInst>(Latch->getTerminator()))
175 if (BI->isConditional())
176 return dyn_cast<ICmpInst>(BI->getCondition());
190 if (Op0 == &IndVar || Op0 == &StepInst)
193 if (Op1 == &IndVar || Op1 == &StepInst)
208 if (!InitialIVValue || !StepInst)
214 Value *StepValue =
nullptr;
215 if (SE.
getSCEV(StepInstOp1) == Step)
216 StepValue = StepInstOp1;
217 else if (SE.
getSCEV(StepInstOp0) == Step)
218 StepValue = StepInstOp0;
224 return LoopBounds(L, *InitialIVValue, *StepInst, StepValue, *FinalIVValue,
232 assert(Latch &&
"Expecting valid latch");
239 "Expecting the latch compare instruction to be a CmpInst");
244 ? LatchCmpInst->getPredicate()
245 : LatchCmpInst->getInversePredicate();
247 if (LatchCmpInst->getOperand(0) == &getFinalIVValue())
252 if (LatchCmpInst->getOperand(0) == &getStepInst() ||
253 LatchCmpInst->getOperand(1) == &getStepInst())
261 if (D == Direction::Increasing)
264 if (D == Direction::Decreasing)
274 dyn_cast<SCEVAddRecExpr>(SE.getSCEV(&getStepInst())))
275 if (
const SCEV *StepRecur = StepAddRecExpr->getStepRecurrence(SE)) {
276 if (SE.isKnownPositive(StepRecur))
277 return Direction::Increasing;
278 if (SE.isKnownNegative(StepRecur))
279 return Direction::Decreasing;
297 assert(Header &&
"Expected a valid loop header");
316 if (StepInst == LatchCmpOp0 || StepInst == LatchCmpOp1)
323 if (&IndVar == LatchCmpOp0 || &IndVar == LatchCmpOp1)
370 "Expecting a loop with valid preheader and latch");
383 if (!ExitFromLatchSucc)
393 if (!GuardBI || GuardBI->isUnconditional())
396 BasicBlock *GuardOtherSucc = (GuardBI->getSuccessor(0) == Preheader)
397 ? GuardBI->getSuccessor(1)
398 : GuardBI->getSuccessor(0);
399 return (GuardOtherSucc == ExitFromLatchSucc) ? GuardBI :
nullptr;
408 if (!Init || !Init->
isZero())
415 if (!Step || !Step->
isOne())
428 if (
I.getType()->isTokenTy())
431 for (
const Use &U :
I.uses()) {
432 const Instruction *UI = cast<Instruction>(U.getUser());
434 if (
const PHINode *
P = dyn_cast<PHINode>(UI))
435 UserBB =
P->getIncomingBlock(U);
441 if (UserBB != &BB && !L.
contains(UserBB) &&
478 if (isa<IndirectBrInst>(BB->getTerminator()) ||
479 isa<CallBrInst>(BB->getTerminator()))
484 if (CS.cannotDuplicate())
505 else if (MD != LoopID)
516 "Loop ID needs at least one operand");
518 "Loop ID should refer to itself");
523 BB->getTerminator()->setMetadata(LLVMContext::MD_loop, LoopID);
533 Context, LoopID, {
"llvm.loop.unroll."}, {DisableUnrollMD});
540 if (!DesiredLoopIdMetadata)
543 MDNode *ParallelAccesses =
546 ParallelAccessGroups;
547 if (ParallelAccesses) {
549 MDNode *AccGroup = cast<MDNode>(MD.get());
551 "List item must be an access group");
552 ParallelAccessGroups.
insert(AccGroup);
563 if (!
I.mayReadOrWriteMemory())
566 if (
MDNode *AccessGroup =
I.getMetadata(LLVMContext::MD_access_group)) {
567 auto ContainsAccessGroup = [&ParallelAccessGroups](
MDNode *AG) ->
bool {
568 if (AG->getNumOperands() == 0) {
570 return ParallelAccessGroups.
count(AG);
573 for (
const MDOperand &AccessListItem : AG->operands()) {
574 MDNode *AccGroup = cast<MDNode>(AccessListItem.get());
576 "List item must be an access group");
577 if (ParallelAccessGroups.
count(AccGroup))
583 if (ContainsAccessGroup(AccessGroup))
592 I.getMetadata(LLVMContext::MD_mem_parallel_loop_access);
597 bool LoopIdMDFound =
false;
599 if (MDOp == DesiredLoopIdMetadata) {
600 LoopIdMDFound =
true;
621 for (
unsigned i = 1, ie = LoopID->getNumOperands(); i < ie; ++i) {
622 if (
DILocation *L = dyn_cast<DILocation>(LoopID->getOperand(i))) {
636 if (
DebugLoc DL = PHeadBB->getTerminator()->getDebugLoc())
642 return LocRange(HeadBB->getTerminator()->getDebugLoc());
647 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) 662 class UnloopUpdater {
680 : Unloop(*UL), LI(LInfo),
DFS(UL), FoundIB(
false) {}
682 void updateBlockParents();
684 void removeBlocksFromAncestors();
686 void updateSubloopParents();
695 void UnloopUpdater::updateBlockParents() {
696 if (Unloop.getNumBlocks()) {
702 Loop *L = LI->getLoopFor(POI);
703 Loop *NL = getNearestLoop(POI, L);
708 "uninitialized successor");
709 LI->changeLoopFor(POI, NL);
713 assert((FoundIB || Unloop.contains(L)) &&
"uninitialized successor");
719 bool Changed = FoundIB;
720 for (
unsigned NIters = 0; Changed; ++NIters) {
721 assert(NIters < Unloop.getNumBlocks() &&
"runaway iterative algorithm");
727 POE =
DFS.endPostorder();
730 Loop *L = LI->getLoopFor(*POI);
731 Loop *NL = getNearestLoop(*POI, L);
734 "uninitialized successor");
735 LI->changeLoopFor(*POI, NL);
743 void UnloopUpdater::removeBlocksFromAncestors() {
748 Loop *OuterParent = LI->getLoopFor(*BI);
749 if (Unloop.contains(OuterParent)) {
752 OuterParent = SubloopParents[OuterParent];
758 assert(OldParent &&
"new loop is not an ancestor of the original");
759 OldParent->removeBlockFromLoop(*BI);
765 void UnloopUpdater::updateSubloopParents() {
766 while (!Unloop.empty()) {
767 Loop *Subloop = *std::prev(Unloop.end());
770 assert(SubloopParents.count(Subloop) &&
"DFS failed to visit subloop");
771 if (
Loop *Parent = SubloopParents[Subloop])
772 Parent->addChildLoop(Subloop);
774 LI->addTopLevelLoop(Subloop);
787 Loop *NearLoop = BBLoop;
789 Loop *Subloop =
nullptr;
790 if (NearLoop != &Unloop && Unloop.
contains(NearLoop)) {
795 assert(Subloop &&
"subloop is not an ancestor of the original loop");
798 NearLoop = SubloopParents.insert({Subloop, &Unloop}).
first->second;
803 assert(!Subloop &&
"subloop blocks must have a successor");
806 for (; I !=
E; ++
I) {
810 Loop *L = LI->getLoopFor(*I);
814 assert((FoundIB || !
DFS.hasPostorder(*I)) &&
"should have seen IB");
817 if (L != &Unloop && Unloop.
contains(L)) {
826 L = SubloopParents[L];
837 if (NearLoop == &Unloop || !NearLoop || NearLoop->
contains(L))
841 SubloopParents[Subloop] = NearLoop;
871 if (getLoopFor(*
I) != Unloop)
876 changeLoopFor(*
I,
nullptr);
889 while (!Unloop->
empty())
897 UnloopUpdater Updater(Unloop,
this);
898 Updater.updateBlockParents();
901 Updater.removeBlocksFromAncestors();
904 Updater.updateSubloopParents();
909 assert(
I != ParentLoop->
end() &&
"Couldn't find loop");
941 OS << Banner <<
" (loop: ";
954 OS <<
"\n; Preheader:";
955 PreHeader->print(OS);
959 for (
auto *Block : L.
blocks())
963 OS <<
"Printing <null> block";
967 if (!ExitBlocks.
empty()) {
968 OS <<
"\n; Exit blocks";
969 for (
auto *Block : ExitBlocks)
973 OS <<
"Printing <null> block";
1025 for (
unsigned i = 1, ie = OrigLoopID->
getNumOperands(); i < ie; ++i) {
1026 bool IsVectorMetadata =
false;
1028 if (
MDNode *MD = dyn_cast<MDNode>(Op)) {
1036 if (!IsVectorMetadata)
1068 LI.
analyze(getAnalysis<DominatorTreeWrapperPass>().getDomTree());
1079 auto &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree();
1111 POE = Traversal.
end();
Tracking metadata reference owned by Metadata.
LoopInfo run(Function &F, FunctionAnalysisManager &AM)
This class is the base class for the comparison instructions.
bool forcePrintModuleIR()
forcePrintModuleIR - returns true if IR printing passes should
static Value * findFinalIVValue(const Loop &L, const PHINode &IndVar, const Instruction &StepInst)
Return the final value of the loop induction variable if found.
auto drop_begin(T &&RangeOrContainer, size_t N) -> iterator_range< decltype(adl_begin(RangeOrContainer))>
Return a range covering RangeOrContainer with the first N elements excluded.
BinaryOperator * getInductionBinOp() const
BlockT * getLoopLatch() const
If there is a single latch block for this loop, return it.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
This class represents lattice values for constants.
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds...
static bool isInductionPHI(PHINode *Phi, const Loop *L, ScalarEvolution *SE, InductionDescriptor &D, const SCEV *Expr=nullptr, SmallVectorImpl< Instruction *> *CastsToIgnore=nullptr)
Returns true if Phi is an induction in the loop L.
A Module instance is used to store all the information related to an LLVM module. ...
void dropUnknownNonDebugMetadata(ArrayRef< unsigned > KnownIDs)
Drop all unknown metadata except for debug locations.
void replaceOperandWith(unsigned I, Metadata *New)
Replace a specific operand.
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
static MDString * get(LLVMContext &Context, StringRef Str)
bool hasDedicatedExits() const
Return true if no exit block for the loop has a predecessor that is outside the loop.
bool isRecursivelyLCSSAForm(DominatorTree &DT, const LoopInfo &LI) const
Return true if this Loop and all inner subloops are in LCSSA form.
ConstantInt * getConstIntStepValue() const
bool isLCSSAForm(DominatorTree &DT) const
Return true if the Loop is in LCSSA form.
LLVM_NODISCARD bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
Instruction::BinaryOps getInductionOpcode() const
Returns binary opcode of the induction operator.
void push_back(const T &Elt)
llvm::MDNode * makePostTransformationMetadata(llvm::LLVMContext &Context, MDNode *OrigLoopID, llvm::ArrayRef< llvm::StringRef > RemovePrefixes, llvm::ArrayRef< llvm::MDNode *> AddAttrs)
Create a new LoopID after the loop has been transformed.
LoopT * removeChildLoop(iterator I)
This removes the specified child from being a subloop of this loop.
The main scalar evolution driver.
bool isRotatedForm() const
Return true if the loop is in rotated form.
BasicBlock * getLoopPreheader() const
If there is a preheader for this loop, return it.
Direction getDirection() const
Get the direction of the loop.
LLVM_NODISCARD detail::scope_exit< typename std::decay< Callable >::type > make_scope_exit(Callable &&F)
bool isLoopInvariant(const SCEV *S, const Loop *L)
Return true if the value of the given SCEV is unchanging in the specified loop.
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly...
BasicBlock * getSuccessor(unsigned i) const
Analysis pass which computes a DominatorTree.
const MDOperand & getOperand(unsigned I) const
Value * getCondition() const
const Instruction * getTerminator() const LLVM_READONLY
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
Value * getStartValue() const
LLVMContext & getContext() const
Get the context in which this basic block lives.
bool isReachableFromEntry(const Use &U) const
Provide an overload for a Use.
bool hasLoopInvariantOperands(const Instruction *I) const
Return true if all the operands of the specified instruction are loop invariant.
bool isInvalid() const
Return true if this loop is no longer valid.
void verify(const DominatorTreeBase< BlockT, false > &DomTree) const
void print(raw_ostream &OS, unsigned Depth=0, bool Verbose=false) const
Print loop with all the BBs inside it.
iterator begin()
Instruction iterator methods.
PreservedAnalysisChecker getChecker() const
Build a checker for this PreservedAnalyses and the specified analysis type.
const Module * getModule() const
Return the module owning the function this basic block belongs to, or nullptr if the function does no...
#define INITIALIZE_PASS_DEPENDENCY(depName)
Traverse the blocks in a loop using a depth-first search.
MemorySSA * getMemorySSA() const
Get handle on MemorySSA.
static cl::opt< bool, true > VerifyLoopInfoX("verify-loop-info", cl::location(VerifyLoopInfo), cl::Hidden, cl::desc("Verify loop info (time consuming)"))
void initializeLoopInfoWrapperPassPass(PassRegistry &)
LoopT * getLoopFor(const BlockT *BB) const
Return the inner most loop that BB lives in.
A Use represents the edge between a Value definition and its users.
PHINode * getInductionVariable(ScalarEvolution &SE) const
Return the loop induction variable if found, else return nullptr.
bool isAuxiliaryInductionVariable(PHINode &AuxIndVar, ScalarEvolution &SE) const
Return true if the given PHINode AuxIndVar is.
POTIterator begin()
Postorder traversal over the graph.
std::vector< Loop *>::const_iterator iterator
iterator/begin/end - The interface to the top-level loops in the current function.
void getLoopLatches(SmallVectorImpl< BasicBlock * > &LoopLatches) const
Return all loop latch blocks of this loop.
void erase(Loop *L)
Update LoopInfo after removing the last backedge from a loop.
Direction
An enum for the direction of the loop.
static TempMDTuple getTemporary(LLVMContext &Context, ArrayRef< Metadata *> MDs)
Analysis pass that exposes the LoopInfo for a function.
void print(raw_ostream &O, const Module *M=nullptr) const override
print - Print out the internal state of the pass.
BranchInst * getLoopGuardBranch() const
Return the loop guard branch, if it exists.
BasicBlock * getHeader() const
Interval::succ_iterator succ_begin(Interval *I)
succ_begin/succ_end - define methods so that Intervals may be used just like BasicBlocks can with the...
void getExitBlocks(SmallVectorImpl< BlockT *> &ExitBlocks) const
Return all of the successor blocks of this loop.
std::vector< Loop *>::const_iterator iterator
bool isOne() const
This is just a convenience method to make client code smaller for a common case.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
MemoryUseOrDef * getMemoryAccess(const Instruction *I) const
Given a memory Mod/Ref'ing instruction, get the MemorySSA access associated with it.
This node represents a polynomial recurrence on the trip count of the specified loop.
op_range operands() const
void setLoopID(MDNode *LoopID) const
Set the llvm.loop loop id metadata for this loop.
const BasicBlock * getUniquePredecessor() const
Return the predecessor of this block if it has a unique predecessor block.
MDNode * findOptionMDForLoop(const Loop *TheLoop, StringRef Name)
Find string metadata for a loop.
MDNode * getMetadata(unsigned KindID) const
Get the metadata of given kind attached to this Instruction.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
ICmpInst::Predicate getCanonicalPredicate() const
Return the canonical predicate for the latch compare instruction, if able to be calcuated.
void perform(LoopInfo *LI)
Traverse the loop blocks and store the DFS result.
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree...
void releaseMemory() override
releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memo...
Value * getOperand(unsigned i) const
Interval::succ_iterator succ_end(Interval *I)
StringRef getString() const
Core dominator tree base class.
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata *> MDs)
Optional< LoopBounds > getBounds(ScalarEvolution &SE) const
Return the struct LoopBounds collected if all struct members are found, else None.
INITIALIZE_PASS_BEGIN(LoopInfoWrapperPass, "loops", "Natural Loop Information", true, true) INITIALIZE_PASS_END(LoopInfoWrapperPass
A set of analyses that are preserved following a run of a transformation pass.
LLVM Basic Block Representation.
This is an important class for using LLVM in a threaded context.
Conditional or Unconditional Branch instruction.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static MDTuple * getDistinct(LLVMContext &Context, ArrayRef< Metadata *> MDs)
const SCEV * getStep() const
Value * getIncomingValueForBlock(const BasicBlock *BB) const
This file contains the declarations for the subclasses of Constant, which represent the different fla...
void setLoopAlreadyUnrolled()
Add llvm.loop.unroll.disable to this loop's loop id metadata.
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
void analyze(const DominatorTreeBase< BlockT, false > &DomTree)
Create the loop forest using a stable algorithm.
Interval::pred_iterator pred_begin(Interval *I)
pred_begin/pred_end - define methods so that Intervals may be used just like BasicBlocks can with the...
Represent the analysis usage information of a pass.
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly...
This instruction compares its operands according to the predicate given to the constructor.
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
FunctionPass class - This class is used to implement most global optimizations.
Interval::pred_iterator pred_end(Interval *I)
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
BasicBlock * getUniqueExitBlock() const
If getUniqueExitBlocks would return exactly one block, return that block.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
DebugLoc getStartLoc() const
Return the debug location of the start of this loop.
A range representing the start and end location of a loop.
void printAsOperand(raw_ostream &O, bool PrintType=true, const Module *M=nullptr) const
Print the name of this Value out to the specified raw_ostream.
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE, "Assign register bank of generic virtual registers", false, false) RegBankSelect
void moveToPlace(MemoryUseOrDef *What, BasicBlock *BB, MemorySSA::InsertionPlace Where)
bool isLoopInvariant(const Value *V) const
Return true if the specified value is loop invariant.
bool contains(const Loop *L) const
Return true if the specified loop is contained within in this loop.
Iterator for intrusive lists based on ilist_node.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
void print(raw_ostream &OS) const
This is the shared class of boolean and integer constants.
A struct for saving information about induction variables.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
MDNode * findOptionMDForLoopID(MDNode *LoopID, StringRef Name)
Find and return the loop attribute node for the attribute Name in LoopID.
static Optional< Loop::LoopBounds > getBounds(const Loop &L, PHINode &IndVar, ScalarEvolution &SE)
Return the LoopBounds object if.
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
bool isConditional() const
bool VerifyLoopInfo
Enables verification of loop info.
Predicate getFlippedStrictnessPredicate() const
For predicate of kind "is X or equal to 0" returns the predicate "is X".
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
PHINode * getCanonicalInductionVariable() const
Check to see if the loop has a canonical induction variable: an integer recurrence that starts at 0 a...
Store the result of a depth first search within basic blocks contained by a single loop...
LocRange getLocRange() const
Return the source code span of the loop.
void setPreservesAll()
Set by analyses that do not transform their input at all.
iterator_range< user_iterator > users()
Represents analyses that only rely on functions' control flow.
bool getIncomingAndBackEdge(BasicBlock *&Incoming, BasicBlock *&Backedge) const
Obtain the unique incoming and back edge.
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
LLVM_NODISCARD bool equals(StringRef RHS) const
equals - Check for string equality, this is more efficient than compare() when the relative ordering ...
bool invalidate(Function &F, const PreservedAnalyses &PA, FunctionAnalysisManager::Invalidator &)
Handle invalidation explicitly.
LoopT * getParentLoop() const
This file provides various utilities for inspecting and working with the control flow graph in LLVM I...
bool isLoopSimplifyForm() const
Return true if the Loop is in the form that the LoopSimplify form transforms loops to...
MDNode * getLoopID() const
Return the llvm.loop loop id metadata node for this loop if it is present.
const DebugLoc & getStart() const
This class represents an analyzed expression in the program.
LLVM_NODISCARD bool empty() const
Represents a single loop in the control flow graph.
Below are some utilities to get the loop guard, loop bounds and induction variable, and to check if a given phinode is an auxiliary induction variable, if the loop is guarded, and if the loop is canonical.
bool mayReadFromMemory() const
Return true if this instruction may read memory.
bool isZero() const
This is just a convenience method to make client code smaller for a common code.
std::vector< BasicBlock * >::const_iterator POIterator
Postorder list iterators.
bool runOnFunction(Function &F) override
Calculate the natural loop information for a given function.
static ICmpInst * getLatchCmpInst(const Loop &L)
Get the latch condition instruction.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
block_iterator block_end() const
iterator_range< const_phi_iterator > phis() const
Returns a range that iterates over the phis in the basic block.
bool isSafeToClone() const
Return true if the loop body is safe to clone in practice.
AnalysisUsage & addRequiredTransitive()
API to communicate dependencies between analyses during invalidation.
This file defines passes to print out IR in various granularities.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This templated class represents "all analyses that operate over <a particular IR unit>" (e...
bool isCanonical(ScalarEvolution &SE) const
Return true if the loop induction variable starts at zero and increments by one each time through the...
bool isAnnotatedParallel() const
Returns true if the loop is annotated parallel.
bool isSafeToSpeculativelyExecute(const Value *V, const Instruction *CtxI=nullptr, const DominatorTree *DT=nullptr)
Return true if the instruction does not have any effects besides calculating the result and does not ...
LLVM Value Representation.
const SCEV * getSCEV(Value *V)
Return a SCEV expression for the full generality of the specified expression.
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
void moveBefore(Instruction *MovePos)
Unlink this instruction from its current basic block and insert it into the basic block that MovePos ...
This class implements an extremely fast bulk output stream that can only output to a stream...
bool isEHPad() const
Return true if the instruction is a variety of EH-block.
This file exposes an interface to building/using memory SSA to walk memory instructions using a use/d...
The legacy pass manager's analysis pass to compute loop information.
StringRef - Represent a constant reference to a string, i.e.
Predicate getSwappedPredicate() const
For example, EQ->EQ, SLE->SGE, ULT->UGT, OEQ->OEQ, ULE->UGE, OLT->OGT, etc.
A container for analyses that lazily runs them and caches their results.
Legacy analysis pass which computes a DominatorTree.
This header defines various interfaces for pass management in LLVM.
unsigned getNumOperands() const
Return number of MDNode operands.
bool getInductionDescriptor(ScalarEvolution &SE, InductionDescriptor &IndDesc) const
Get the loop induction descriptor for the loop induction variable.
iterator_range< block_iterator > blocks() const
void printLoop(Loop &L, raw_ostream &OS, const std::string &Banner="")
Function to print a loop's contents as LLVM's text IR assembly.
block_iterator block_begin() const
A special type used by analysis passes to provide an address that identifies that particular analysis...
LocationClass< Ty > location(Ty &L)
bool isValidAsAccessGroup(MDNode *AccGroup)
Return whether an MDNode might represent an access group.
const BasicBlock * getParent() const
static bool isBlockInLCSSAForm(const Loop &L, const BasicBlock &BB, DominatorTree &DT)
void verifyAnalysis() const override
verifyAnalysis() - This member can be implemented by a analysis pass to check state of analysis infor...
const BasicBlock * getUniqueSuccessor() const
Return the successor of this block if it has a unique successor.
bool makeLoopInvariant(Value *V, bool &Changed, Instruction *InsertPt=nullptr, MemorySSAUpdater *MSSAU=nullptr) const
If the given value is an instruction inside of the loop and it can be hoisted, do so to make it trivi...