1//===- GenericLoopInfo - Generic Loop Info for graphs -----------*- C++ -*-===// 3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4// See https://llvm.org/LICENSE.txt for license information. 5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7//===----------------------------------------------------------------------===// 9// This file defines the LoopInfoBase class that is used to identify natural 10// loops and determine the loop depth of various nodes in a generic graph of 11// blocks. A natural loop has exactly one entry-point, which is called the 12// header. Note that natural loops may actually be several loops that share the 15// This analysis calculates the nesting structure of loops in a function. For 16// each natural loop identified, this analysis identifies natural loops 17// contained entirely within the loop and the basic blocks that make up the 20// It can calculate on the fly various bits of information, for example: 22// * whether there is a preheader for the loop 23// * the number of back edges to the header 24// * whether or not a particular block branches out of the loop 25// * the successor blocks of the loop 29// Note that this analysis specifically identifies *Loops* not cycles or SCCs 30// in the graph. There can be strongly connected components in the graph which 31// this analysis will not recognize and that will not be represented by a Loop 32// instance. In particular, a Loop might be inside such a non-loop SCC, or a 33// non-loop SCC might contain a sub-SCC which is a Loop. 35// For an overview of terminology used in this API (and thus all of our loop 36// analyses or transforms), see docs/LoopTerminology.rst. 38//===----------------------------------------------------------------------===// 40#ifndef LLVM_SUPPORT_GENERICLOOPINFO_H 41#define LLVM_SUPPORT_GENERICLOOPINFO_H 52template <
class N,
class M>
classLoopInfoBase;
53template <
class N,
class M>
classLoopBase;
55//===----------------------------------------------------------------------===// 56/// Instances of this class are used to represent loops that are detected in the 59template <
class BlockT,
class LoopT>
classLoopBase {
61// Loops contained entirely within this one. 62 std::vector<LoopT *> SubLoops;
64// The list of blocks in this loop. First entry is the header node. 65 std::vector<BlockT *> Blocks;
69#if LLVM_ENABLE_ABI_BREAKING_CHECKS 70 /// Indicator that this loop is no longer a valid loop. 79 /// Return the nesting level of this loop. An outer-most loop has depth 1, 80 /// for consistency with loop depth values used for basic blocks, where depth 81 /// 0 is used for blocks not inside any loops. 85for (
const LoopT *CurLoop = ParentLoop; CurLoop;
86 CurLoop = CurLoop->ParentLoop)
91 /// Return the parent loop if it exists or nullptr for top 94 /// A loop is either top-level in a function (that is, it is not 95 /// contained in any other loop) or it is entirely enclosed in 97 /// If a loop is top-level, it has no parent, otherwise its 98 /// parent is the innermost loop in which it is enclosed. 101 /// Get the outermost loop in which this loop is contained. 102 /// This may be the loop itself, if it already is the outermost loop. 104const LoopT *L =
static_cast<constLoopT *
>(
this);
111 LoopT *L =
static_cast<LoopT *
>(
this);
117 /// This is a raw interface for bypassing addChildLoop. 123 /// Return true if the specified loop is contained within in this loop. 133 /// Return true if the specified basic block is in this loop. 136return DenseBlockSet.
count(BB);
139 /// Return true if the specified instruction is in this loop. 140template <
class InstT>
boolcontains(
const InstT *Inst)
const{
144 /// Return the loops contained entirely within this loop. 153typedeftypename std::vector<LoopT *>::const_iterator
iterator;
161// LoopInfo does not detect irreducible control flow, just natural 162// loops. That is, it is possible that there is cyclic control 163// flow within the "innermost loop" or around the "outermost 166 /// Return true if the loop does not contain any (natural) loops. 168 /// Return true if the loop does not have a parent (natural) loop 169// (i.e. it is outermost, which is the same as top-level). 172 /// Get a list of the basic blocks which make up this loop. 185 /// Get the number of blocks in this loop in constant time. 186 /// Invalidate the loop, indicating that it is no longer a loop. 192 /// Return a direct, mutable handle to the blocks vector so that we can 193 /// mutate it efficiently with techniques like `std::remove`. 198 /// Return a direct, mutable handle to the blocks set so that we can 199 /// mutate it efficiently. 205 /// Return a direct, immutable handle to the blocks set. 211 /// Return true if this loop is no longer valid. The only valid use of this 212 /// helper is "assert(L.isInvalid())" or equivalent, since IsInvalid is set to 213 /// true by the destructor. In other words, if this accessor returns true, 214 /// the caller has already triggered UB by calling this accessor; and so it 215 /// can only be called in a context where a return value of true indicates a 216 /// programmer error. 218#if LLVM_ENABLE_ABI_BREAKING_CHECKS 225 /// True if terminator in the block can branch to another block that is 226 /// outside of the current loop. \p BB must be inside the loop. 230for (
constauto *Succ : children<const BlockT *>(BB)) {
237 /// Returns true if \p BB is a loop-latch. 238 /// A latch block is a block that contains a branch back to the header. 239 /// This function is useful when there are multiple latches in a loop 240 /// because \fn getLoopLatch will return nullptr in that case. 247 /// Calculate the number of back edges to the loop header. 251 [&](BlockT *Pred) {
returncontains(Pred); });
254//===--------------------------------------------------------------------===// 255// APIs for simple analysis of the loop. 257// Note that all of these methods can fail on general loops (ie, there may not 258// be a preheader, etc). For best success, the loop simplification and 259// induction variable canonicalization pass should be used to normalize loops 260// for easy analysis. These methods assume canonical loops. 262 /// Return all blocks inside the loop that have successors outside of the 263 /// loop. These are the blocks _inside of the current loop_ which branch out. 264 /// The returned list is always unique. 267 /// If getExitingBlocks would return exactly one block, return that block. 268 /// Otherwise return null. 271 /// Return all of the successor blocks of this loop. These are the blocks 272 /// _outside of the current loop_ which are branched to. 275 /// If getExitBlocks would return exactly one block, return that block. 276 /// Otherwise return null. 279 /// Return true if no exit block for the loop has a predecessor that is 280 /// outside the loop. 283 /// Return all unique successor blocks of this loop. 284 /// These are the blocks _outside of the current loop_ which are branched to. 287 /// Return all unique successor blocks of this loop except successors from 288 /// Latch block are not considered. If the exit comes from Latch has also 289 /// non Latch predecessor in a loop it will be added to ExitBlocks. 290 /// These are the blocks _outside of the current loop_ which are branched to. 293 /// If getUniqueExitBlocks would return exactly one block, return that block. 294 /// Otherwise return null. 297 /// Return the unique exit block for the latch, or null if there are multiple 298 /// different exit blocks or the latch is not exiting. 301 /// Return true if this loop does not have any exit blocks. 305typedef std::pair<BlockT *, BlockT *>
Edge;
307 /// Return all pairs of (_inside_block_,_outside_block_). 310 /// If there is a preheader for this loop, return it. A loop has a preheader 311 /// if there is only one edge to the header of the loop from outside of the 312 /// loop. If this is the case, the block branching to the header of the loop 313 /// is the preheader node. 315 /// This method returns null if there is no preheader for the loop. 318 /// If the given loop's header has exactly one unique predecessor outside the 319 /// loop, return it. Otherwise return null. 320 /// This is less strict that the loop "preheader" concept, which requires 321 /// the predecessor to have exactly one successor. 324 /// If there is a single latch block for this loop, return it. 325 /// A latch block is a block that contains a branch back to the header. 328 /// Return all loop latch blocks of this loop. A latch block is a block that 329 /// contains a branch back to the header. 333for (
constauto Pred : inverse_children<BlockT *>(
H))
338 /// Return all inner loops in the loop nest rooted by the loop in preorder, 339 /// with siblings in forward program order. 344 PreOrderWorklist.
append(L.rbegin(), L.rend());
346while (!PreOrderWorklist.
empty()) {
348// Sub-loops are stored in forward program order, but will process the 349// worklist backwards so append them in reverse order. 350 PreOrderWorklist.
append(L->rbegin(), L->rend());
355 /// Return all loops in the loop nest rooted by the loop in preorder, with 356 /// siblings in forward program order. 359const LoopT *CurLoop =
static_cast<constLoopT *
>(
this);
366 LoopT *CurLoop =
static_cast<LoopT *
>(
this);
372//===--------------------------------------------------------------------===// 373// APIs for updating loop information after changing the CFG 376 /// This method is used by other analyses to update loop information. 377 /// NewBB is set to be a new member of the current loop. 378 /// Because of this, it is added as a member of all parent loops, and is added 379 /// to the specified LoopInfo object as being in the current basic block. It 380 /// is not valid to replace the loop header with this method. 383 /// This is used when splitting loops up. It replaces the OldChild entry in 384 /// our children list with NewChild, and updates the parent pointer of 385 /// OldChild to be null and the NewChild to be this loop. 386 /// This updates the loop depth of the new child. 389 /// Add the specified loop to be a child of this loop. 390 /// This updates the loop depth of the new child. 393assert(!NewChild->ParentLoop &&
"NewChild already has a parent!");
394 NewChild->ParentLoop =
static_cast<LoopT *
>(
this);
395 SubLoops.push_back(NewChild);
398 /// This removes the specified child from being a subloop of this loop. The 399 /// loop is not deleted, as it will presumably be inserted into another loop. 402assert(
I != SubLoops.end() &&
"Cannot remove end iterator!");
404assert(Child->ParentLoop ==
this &&
"Child is not a child of this loop!");
405 SubLoops.erase(SubLoops.begin() + (
I -
begin()));
406 Child->ParentLoop =
nullptr;
410 /// This removes the specified child from being a subloop of this loop. The 411 /// loop is not deleted, as it will presumably be inserted into another loop. 416 /// This adds a basic block directly to the basic block list. 417 /// This should only be used by transformations that create new loops. Other 418 /// transformations should use addBasicBlockToLoop. 425 /// interface to reverse Blocks[from, end of loop] in this loop 431 /// interface to do reserve() for Blocks 437 /// This method is used to move BB (which must be part of this loop) to be the 438 /// loop header of the loop (the block that dominates all others). 443for (
unsigned i = 0;; ++i) {
453 /// This removes the specified basic block from the current loop, updating the 454 /// Blocks as appropriate. This does not update the mapping in the LoopInfo 462 DenseBlockSet.
erase(BB);
465 /// Verify loop structure 468 /// Verify loop structure of this loop and all nested loops. 471 /// Returns true if the loop is annotated parallel. 473 /// Derived classes can override this method using static template 477 /// Print loop with all the BBs inside it. 479unsignedDepth = 0)
const;
484 /// This creates an empty loop. 487explicitLoopBase(BlockT *BB) : ParentLoop(nullptr) {
492// Since loop passes like SCEV are allowed to key analysis results off of 493// `Loop` pointers, we cannot re-use pointers within a loop pass manager. 494// This means loop passes should not be `delete` ing `Loop` objects directly 495// (and risk a later `Loop` allocation re-using the address of a previous one) 496// but should be using LoopInfo::markAsRemoved, which keeps around the `Loop` 497// pointer till the end of the lifetime of the `LoopInfo` object. 499// To make it easier to follow this rule, we mark the destructor as 502for (
auto *SubLoop : SubLoops)
505#if LLVM_ENABLE_ABI_BREAKING_CHECKS 510 DenseBlockSet.
clear();
515template <
class BlockT,
class LoopT>
521//===----------------------------------------------------------------------===// 522/// This class builds and contains all of the top-level loop 523/// structures in the specified function. 527// BBMap - Mapping of basic blocks to the inner most loop they occur in 529 std::vector<LoopT *> TopLevelLoops;
544 TopLevelLoops(
std::
move(Arg.TopLevelLoops)),
545 LoopAllocator(
std::
move(Arg.LoopAllocator)) {
546// We have to clear the arguments top level loops as we've taken ownership. 547 Arg.TopLevelLoops.clear();
550 BBMap = std::move(
RHS.BBMap);
552for (
auto *L : TopLevelLoops)
555 TopLevelLoops = std::move(
RHS.TopLevelLoops);
556 LoopAllocator = std::move(
RHS.LoopAllocator);
557RHS.TopLevelLoops.clear();
564for (
auto *L : TopLevelLoops)
566 TopLevelLoops.clear();
567 LoopAllocator.
Reset();
571 LoopT *Storage = LoopAllocator.
Allocate<LoopT>();
572returnnew (Storage) LoopT(std::forward<ArgsTy>(Args)...);
575 /// iterator/begin/end - The interface to the top-level loops in the current 578typedeftypename std::vector<LoopT *>::const_iterator
iterator;
585boolempty()
const{
return TopLevelLoops.empty(); }
587 /// Return all of the loops in the function in preorder across the loop 588 /// nests, with siblings in forward program order. 590 /// Note that because loops form a forest of trees, preorder is equivalent to 591 /// reverse postorder. 594 /// Return all of the loops in the function in preorder across the loop 595 /// nests, with siblings in *reverse* program order. 597 /// Note that because loops form a forest of trees, preorder is equivalent to 598 /// reverse postorder. 600 /// Also note that this is *not* a reverse preorder. Only the siblings are in 601 /// reverse program order. 604 /// Return the inner most loop that BB lives in. If a basic block is in no 605 /// loop (for example the entry node), null is returned. 608 /// Same as getLoopFor. 611 /// Return the loop nesting level of the specified block. A depth of 0 means 612 /// the block is not inside any loop. 615return L ? L->getLoopDepth() : 0;
618// True if the block is a loop header node 621return L && L->getHeader() == BB;
624 /// Return the top-level loops. 627 /// Return the top-level loops. 630 /// This removes the specified top-level loop from this loop info object. 631 /// The loop is not deleted, as it will presumably be inserted into 634assert(
I !=
end() &&
"Cannot remove end iterator!");
636assert(L->isOutermost() &&
"Not a top-level loop!");
637 TopLevelLoops.erase(TopLevelLoops.begin() + (
I -
begin()));
641 /// Change the top-level loop that contains BB to the specified loop. 642 /// This should be used by transformations that restructure the loop hierarchy 652 /// Replace the specified loop in the top-level loops list with the indicated 655autoI =
find(TopLevelLoops, OldLoop);
656assert(
I != TopLevelLoops.end() &&
"Old loop not at top level!");
658assert(!NewLoop->ParentLoop && !OldLoop->ParentLoop &&
659"Loops already embedded into a subloop!");
662 /// This adds the specified loop to the collection of top-level loops. 664assert(New->isOutermost() &&
"Loop already in subloop!");
665 TopLevelLoops.push_back(New);
668 /// This method completely removes BB from all data structures, 669 /// including all of the Loop objects it is nested in and our mapping from 670 /// BasicBlocks to loops. 672autoI = BBMap.
find(BB);
673if (
I != BBMap.
end()) {
674for (LoopT *L =
I->second; L; L = L->getParentLoop())
675 L->removeBlockFromLoop(BB);
684const LoopT *ParentLoop) {
687if (SubLoop == ParentLoop)
692 /// Create the loop forest using a stable algorithm. 700 /// Destroy a loop that has been removed from the `LoopInfo` nest. 702 /// This runs the destructor of the loop object making it invalid to 703 /// reference afterward. The memory is retained so that the *pointer* to the 704 /// loop remains valid. 706 /// The caller is responsible for removing this loop from the loop nest and 707 /// otherwise disconnecting it from the broader `LoopInfo` data structures. 708 /// Callers that don't naturally handle this themselves should probably call 713// Since LoopAllocator is a BumpPtrAllocator, this Deallocate only poisons 714// \c L, but the pointer remains valid for non-dereferencing uses. 721#endif// LLVM_SUPPORT_GENERICLOOPINFO_H This file defines the BumpPtrAllocator interface.
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
This file defines the DenseSet and SmallDenseSet classes.
DenseMap< Block *, BlockRelaxAux > Blocks
This file defines a set of templates that efficiently compute a dominator tree over a generic graph.
This file builds on the ADT/GraphTraits.h file to build a generic graph post order iterator.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file contains some templates that are useful if you are working with the STL at all.
This file defines generic set operations that may be used on set's of different types,...
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Allocate memory in an ever growing pool, as if by bump-pointer.
LLVM_ATTRIBUTE_RETURNS_NONNULL void * Allocate(size_t Size, Align Alignment)
Allocate space at the specified alignment.
void Reset()
Deallocate all but the current slab and reset the current pointer to the beginning of it,...
void Deallocate(const void *Ptr, size_t Size, size_t)
ValueT lookup(const_arg_type_t< KeyT > Val) const
lookup - Return the entry for the specified key, or a default constructed value if no such entry exis...
iterator find(const_arg_type_t< KeyT > Val)
bool erase(const KeyT &Val)
Implements a dense probed hash-table based set.
Core dominator tree base class.
Instances of this class are used to represent loops that are detected in the flow graph.
bool isAnnotatedParallel() const
Returns true if the loop is annotated parallel.
bool contains(const LoopT *L) const
Return true if the specified loop is contained within in this loop.
SmallPtrSetImpl< const BlockT * > & getBlocksSet()
Return a direct, mutable handle to the blocks set so that we can mutate it efficiently.
static void getInnerLoopsInPreorder(const LoopT &L, SmallVectorImpl< Type > &PreOrderLoops)
Return all inner loops in the loop nest rooted by the loop in preorder, with siblings in forward prog...
bool isOutermost() const
Return true if the loop does not have a parent (natural) loop.
BlockT * getLoopLatch() const
If there is a single latch block for this loop, return it.
bool isInnermost() const
Return true if the loop does not contain any (natural) loops.
void removeBlockFromLoop(BlockT *BB)
This removes the specified basic block from the current loop, updating the Blocks as appropriate.
void getExitBlocks(SmallVectorImpl< BlockT * > &ExitBlocks) const
Return all of the successor blocks of this loop.
bool contains(const InstT *Inst) const
Return true if the specified instruction is in this loop.
unsigned getNumBlocks() const
Get the number of blocks in this loop in constant time.
void verifyLoop() const
Verify loop structure.
void verifyLoopNest(DenseSet< const LoopT * > *Loops) const
Verify loop structure of this loop and all nested loops.
SmallVector< LoopT *, 4 > getLoopsInPreorder()
unsigned getNumBackEdges() const
Calculate the number of back edges to the loop header.
void reverseBlock(unsigned from)
interface to reverse Blocks[from, end of loop] in this loop
SmallVector< const LoopT *, 4 > getLoopsInPreorder() const
Return all loops in the loop nest rooted by the loop in preorder, with siblings in forward program or...
BlockT * getUniqueLatchExitBlock() const
Return the unique exit block for the latch, or null if there are multiple different exit blocks or th...
void getExitingBlocks(SmallVectorImpl< BlockT * > &ExitingBlocks) const
Return all blocks inside the loop that have successors outside of the loop.
const std::vector< LoopT * > & getSubLoops() const
Return the loops contained entirely within this loop.
BlockT * getHeader() const
const LoopT * getOutermostLoop() const
Get the outermost loop in which this loop is contained.
void getLoopLatches(SmallVectorImpl< BlockT * > &LoopLatches) const
Return all loop latch blocks of this loop.
unsigned getLoopDepth() const
Return the nesting level of this loop.
LoopBase()
This creates an empty loop.
void print(raw_ostream &OS, bool Verbose=false, bool PrintNested=true, unsigned Depth=0) const
Print loop with all the BBs inside it.
void addBasicBlockToLoop(BlockT *NewBB, LoopInfoBase< BlockT, LoopT > &LI)
This method is used by other analyses to update loop information.
std::vector< BlockT * > & getBlocksVector()
Return a direct, mutable handle to the blocks vector so that we can mutate it efficiently with techni...
std::vector< LoopT * >::const_reverse_iterator reverse_iterator
LoopT * removeChildLoop(LoopT *Child)
This removes the specified child from being a subloop of this loop.
std::vector< LoopT * >::const_iterator iterator
void reserveBlocks(unsigned size)
interface to do reserve() for Blocks
iterator_range< block_iterator > blocks() const
block_iterator block_end() const
std::pair< BlockT *, BlockT * > Edge
Edge type.
bool isInvalid() const
Return true if this loop is no longer valid.
BlockT * getLoopPredecessor() const
If the given loop's header has exactly one unique predecessor outside the loop, return it.
bool contains(const BlockT *BB) const
Return true if the specified basic block is in this loop.
bool isLoopLatch(const BlockT *BB) const
void addChildLoop(LoopT *NewChild)
Add the specified loop to be a child of this loop.
void getExitEdges(SmallVectorImpl< Edge > &ExitEdges) const
Return all pairs of (inside_block,outside_block).
void addBlockEntry(BlockT *BB)
This adds a basic block directly to the basic block list.
ArrayRef< BlockT * >::const_iterator block_iterator
std::vector< LoopT * > & getSubLoopsVector()
reverse_iterator rbegin() const
BlockT * getExitBlock() const
If getExitBlocks would return exactly one block, return that block.
bool hasNoExitBlocks() const
Return true if this loop does not have any exit blocks.
void replaceChildLoopWith(LoopT *OldChild, LoopT *NewChild)
This is used when splitting loops up.
BlockT * getLoopPreheader() const
If there is a preheader for this loop, return it.
ArrayRef< BlockT * > getBlocks() const
Get a list of the basic blocks which make up this loop.
reverse_iterator rend() const
BlockT * getExitingBlock() const
If getExitingBlocks would return exactly one block, return that block.
LoopT * getOutermostLoop()
void getUniqueExitBlocks(SmallVectorImpl< BlockT * > &ExitBlocks) const
Return all unique successor blocks of this loop.
void setParentLoop(LoopT *L)
This is a raw interface for bypassing addChildLoop.
LoopT * getParentLoop() const
Return the parent loop if it exists or nullptr for top level loops.
bool hasDedicatedExits() const
Return true if no exit block for the loop has a predecessor that is outside the loop.
void getUniqueNonLatchExitBlocks(SmallVectorImpl< BlockT * > &ExitBlocks) const
Return all unique successor blocks of this loop except successors from Latch block are not considered...
const SmallPtrSetImpl< const BlockT * > & getBlocksSet() const
Return a direct, immutable handle to the blocks set.
bool isLoopExiting(const BlockT *BB) const
True if terminator in the block can branch to another block that is outside of the current loop.
block_iterator block_begin() const
void moveToHeader(BlockT *BB)
This method is used to move BB (which must be part of this loop) to be the loop header of the loop (t...
BlockT * getUniqueExitBlock() const
If getUniqueExitBlocks would return exactly one block, return that block.
LoopT * removeChildLoop(iterator I)
This removes the specified child from being a subloop of this loop.
This class builds and contains all of the top-level loop structures in the specified function.
const std::vector< LoopT * > & getTopLevelLoops() const
Return the top-level loops.
void addTopLevelLoop(LoopT *New)
This adds the specified loop to the collection of top-level loops.
void analyze(const DominatorTreeBase< BlockT, false > &DomTree)
Create the loop forest using a stable algorithm.
SmallVector< LoopT *, 4 > getLoopsInReverseSiblingPreorder() const
Return all of the loops in the function in preorder across the loop nests, with siblings in reverse p...
void print(raw_ostream &OS) const
reverse_iterator rend() const
void changeTopLevelLoop(LoopT *OldLoop, LoopT *NewLoop)
Replace the specified loop in the top-level loops list with the indicated loop.
void removeBlock(BlockT *BB)
This method completely removes BB from all data structures, including all of the Loop objects it is n...
LoopInfoBase(LoopInfoBase &&Arg)
LoopT * AllocateLoop(ArgsTy &&...Args)
const LoopT * operator[](const BlockT *BB) const
Same as getLoopFor.
bool isLoopHeader(const BlockT *BB) const
LoopT * removeLoop(iterator I)
This removes the specified top-level loop from this loop info object.
SmallVector< LoopT *, 4 > getLoopsInPreorder() const
Return all of the loops in the function in preorder across the loop nests, with siblings in forward p...
void changeLoopFor(BlockT *BB, LoopT *L)
Change the top-level loop that contains BB to the specified loop.
unsigned getLoopDepth(const BlockT *BB) const
Return the loop nesting level of the specified block.
std::vector< LoopT * > & getTopLevelLoopsVector()
Return the top-level loops.
static bool isNotAlreadyContainedIn(const LoopT *SubLoop, const LoopT *ParentLoop)
std::vector< LoopT * >::const_reverse_iterator reverse_iterator
reverse_iterator rbegin() const
LoopT * getLoopFor(const BlockT *BB) const
Return the inner most loop that BB lives in.
LoopInfoBase & operator=(LoopInfoBase &&RHS)
void destroy(LoopT *L)
Destroy a loop that has been removed from the LoopInfo nest.
std::vector< LoopT * >::const_iterator iterator
iterator/begin/end - The interface to the top-level loops in the current function.
Represents a single loop in the control flow graph.
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
bool erase(PtrType Ptr)
Remove pointer from the set.
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void append(ItTy in_start, ItTy in_end)
Add the specified range to the end of the SmallVector.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
A range adaptor for a pair of iterators.
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.
auto find(R &&Range, const T &Val)
Provide wrappers to std::find which take ranges instead of having to pass begin/end explicitly.
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
auto count_if(R &&Range, UnaryPredicate P)
Wrapper function around std::count_if to count the number of times an element satisfying a given pred...
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
Implement std::hash so that hash_code can be used in STL containers.