LLVM  6.0.0svn
Public Types | Public Member Functions | Protected Member Functions | Friends | List of all members
llvm::LoopBase< BlockT, LoopT > Class Template Reference

Instances of this class are used to represent loops that are detected in the flow graph. More...

#include "llvm/Analysis/LoopInfo.h"

Inheritance diagram for llvm::LoopBase< BlockT, LoopT >:
Inheritance graph
[legend]

Public Types

typedef std::vector< LoopT * >::const_iterator iterator
 
typedef std::vector< LoopT * >::const_reverse_iterator reverse_iterator
 
typedef std::vector< BlockT * >::const_iterator block_iterator
 
typedef std::pair< const BlockT *, const BlockT * > Edge
 Edge type. More...
 

Public Member Functions

 LoopBase ()
 This creates an empty loop. More...
 
unsigned getLoopDepth () const
 Return the nesting level of this loop. More...
 
BlockT * getHeader () const
 
LoopT * getParentLoop () const
 
void setParentLoop (LoopT *L)
 This is a raw interface for bypassing addChildLoop. More...
 
bool contains (const LoopT *L) const
 Return true if the specified loop is contained within in this loop. More...
 
bool contains (const BlockT *BB) const
 Return true if the specified basic block is in this loop. More...
 
template<class InstT >
bool contains (const InstT *Inst) const
 Return true if the specified instruction is in this loop. More...
 
const std::vector< LoopT * > & getSubLoops () const
 Return the loops contained entirely within this loop. More...
 
std::vector< LoopT * > & getSubLoopsVector ()
 
iterator begin () const
 
iterator end () const
 
reverse_iterator rbegin () const
 
reverse_iterator rend () const
 
bool empty () const
 
const std::vector< BlockT * > & getBlocks () const
 Get a list of the basic blocks which make up this loop. More...
 
block_iterator block_begin () const
 
block_iterator block_end () const
 
iterator_range< block_iteratorblocks () const
 
unsigned getNumBlocks () const
 Get the number of blocks in this loop in constant time. More...
 
bool isInvalid () const
 Return true if this loop is no longer valid. More...
 
bool isLoopExiting (const BlockT *BB) const
 True if terminator in the block can branch to another block that is outside of the current loop. More...
 
bool isLoopLatch (const BlockT *BB) const
 
unsigned getNumBackEdges () const
 Calculate the number of back edges to the loop header. More...
 
void getExitingBlocks (SmallVectorImpl< BlockT *> &ExitingBlocks) const
 Return all blocks inside the loop that have successors outside of the loop. More...
 
BlockT * getExitingBlock () const
 If getExitingBlocks would return exactly one block, return that block. More...
 
void getExitBlocks (SmallVectorImpl< BlockT *> &ExitBlocks) const
 Return all of the successor blocks of this loop. More...
 
BlockT * getExitBlock () const
 If getExitBlocks would return exactly one block, return that block. More...
 
void getExitEdges (SmallVectorImpl< Edge > &ExitEdges) const
 Return all pairs of (inside_block,outside_block). More...
 
BlockT * getLoopPreheader () const
 If there is a preheader for this loop, return it. More...
 
BlockT * getLoopPredecessor () const
 If the given loop's header has exactly one unique predecessor outside the loop, return it. More...
 
BlockT * getLoopLatch () const
 If there is a single latch block for this loop, return it. More...
 
void getLoopLatches (SmallVectorImpl< BlockT *> &LoopLatches) const
 Return all loop latch blocks of this loop. More...
 
void addBasicBlockToLoop (BlockT *NewBB, LoopInfoBase< BlockT, LoopT > &LI)
 This method is used by other analyses to update loop information. More...
 
void replaceChildLoopWith (LoopT *OldChild, LoopT *NewChild)
 This is used when splitting loops up. More...
 
void addChildLoop (LoopT *NewChild)
 Add the specified loop to be a child of this loop. More...
 
LoopT * removeChildLoop (iterator I)
 This removes the specified child from being a subloop of this loop. More...
 
void addBlockEntry (BlockT *BB)
 This adds a basic block directly to the basic block list. More...
 
void reverseBlock (unsigned from)
 interface to reverse Blocks[from, end of loop] in this loop More...
 
void reserveBlocks (unsigned size)
 interface to do reserve() for Blocks More...
 
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 (the block that dominates all others). More...
 
void removeBlockFromLoop (BlockT *BB)
 This removes the specified basic block from the current loop, updating the Blocks as appropriate. More...
 
void verifyLoop () const
 Verify loop structure. More...
 
void verifyLoopNest (DenseSet< const LoopT *> *Loops) const
 Verify loop structure of this loop and all nested loops. More...
 
void print (raw_ostream &OS, unsigned Depth=0, bool Verbose=false) const
 Print loop with all the BBs inside it. More...
 

Protected Member Functions

 LoopBase (BlockT *BB)
 
 ~LoopBase ()
 

Friends

class LoopInfoBase< BlockT, LoopT >
 

Detailed Description

template<class BlockT, class LoopT>
class llvm::LoopBase< BlockT, LoopT >

Instances of this class are used to represent loops that are detected in the flow graph.

Definition at line 61 of file LoopInfo.h.

Member Typedef Documentation

◆ block_iterator

template<class BlockT, class LoopT>
typedef std::vector<BlockT *>::const_iterator llvm::LoopBase< BlockT, LoopT >::block_iterator

Definition at line 160 of file LoopInfo.h.

◆ Edge

template<class BlockT, class LoopT>
typedef std::pair<const BlockT *, const BlockT *> llvm::LoopBase< BlockT, LoopT >::Edge

Edge type.

Definition at line 242 of file LoopInfo.h.

◆ iterator

template<class BlockT, class LoopT>
typedef std::vector<LoopT *>::const_iterator llvm::LoopBase< BlockT, LoopT >::iterator

Definition at line 146 of file LoopInfo.h.

◆ reverse_iterator

template<class BlockT, class LoopT>
typedef std::vector<LoopT *>::const_reverse_iterator llvm::LoopBase< BlockT, LoopT >::reverse_iterator

Definition at line 148 of file LoopInfo.h.

Constructor & Destructor Documentation

◆ LoopBase() [1/2]

template<class BlockT, class LoopT>
llvm::LoopBase< BlockT, LoopT >::LoopBase ( )
inline

This creates an empty loop.

Definition at line 94 of file LoopInfo.h.

◆ LoopBase() [2/2]

template<class BlockT, class LoopT>
llvm::LoopBase< BlockT, LoopT >::LoopBase ( BlockT *  BB)
inlineexplicitprotected

Definition at line 373 of file LoopInfo.h.

◆ ~LoopBase()

template<class BlockT, class LoopT>
llvm::LoopBase< BlockT, LoopT >::~LoopBase ( )
inlineprotected

Definition at line 387 of file LoopInfo.h.

Member Function Documentation

◆ addBasicBlockToLoop()

template<class BlockT, class LoopT>
void llvm::LoopBase< BlockT, LoopT >::addBasicBlockToLoop ( BlockT *  NewBB,
LoopInfoBase< BlockT, LoopT > &  LIB 
)

This method is used by other analyses to update loop information.

addBasicBlockToLoop - This method is used by other analyses to update loop information.

NewBB is set to be a new member of the current loop. Because of this, it is added as a member of all parent loops, and is added to the specified LoopInfo object as being in the current basic block. It is not valid to replace the loop header with this method.

Definition at line 183 of file LoopInfoImpl.h.

Referenced by llvm::addClonedBlockToLoopInfo(), CloneLoop(), cloneLoopBlocks(), llvm::cloneLoopWithPreheader(), llvm::InnerLoopVectorizer::createVectorizedLoopSkeleton(), llvm::InnerLoopVectorizer::emitMemRuntimeChecks(), llvm::InnerLoopVectorizer::emitMinimumIterationCountCheck(), llvm::InnerLoopVectorizer::emitSCEVChecks(), llvm::VPBasicBlock::execute(), llvm::VPlan::execute(), llvm::LoopBase< BasicBlock, Loop >::getLoopLatches(), insertUniqueBackedgeBlock(), isImmValidForOpcode(), isProfitableForVectorization(), mayLoopAccessLocation(), SumCanReachMin(), and UpdateAnalysisInformation().

◆ addBlockEntry()

template<class BlockT, class LoopT>
void llvm::LoopBase< BlockT, LoopT >::addBlockEntry ( BlockT *  BB)
inline

This adds a basic block directly to the basic block list.

This should only be used by transformations that create new loops. Other transformations should use addBasicBlockToLoop.

Definition at line 316 of file LoopInfo.h.

Referenced by separateNestedLoop().

◆ addChildLoop()

template<class BlockT, class LoopT>
void llvm::LoopBase< BlockT, LoopT >::addChildLoop ( LoopT *  NewChild)
inline

Add the specified loop to be a child of this loop.

This updates the loop depth of the new child.

Definition at line 294 of file LoopInfo.h.

Referenced by llvm::addClonedBlockToLoopInfo(), CloneLoop(), llvm::cloneLoopWithPreheader(), llvm::InnerLoopVectorizer::createVectorizedLoopSkeleton(), isProfitableForVectorization(), separateNestedLoop(), and SumCanReachMin().

◆ begin()

template<class BlockT, class LoopT>
iterator llvm::LoopBase< BlockT, LoopT >::begin ( ) const
inline

◆ block_begin()

template<class BlockT, class LoopT>
block_iterator llvm::LoopBase< BlockT, LoopT >::block_begin ( ) const
inline

◆ block_end()

template<class BlockT, class LoopT>
block_iterator llvm::LoopBase< BlockT, LoopT >::block_end ( ) const
inline

◆ blocks()

template<class BlockT, class LoopT>
iterator_range<block_iterator> llvm::LoopBase< BlockT, LoopT >::blocks ( ) const
inline

◆ contains() [1/3]

template<class BlockT, class LoopT>
bool llvm::LoopBase< BlockT, LoopT >::contains ( const LoopT *  L) const
inline

Return true if the specified loop is contained within in this loop.

Definition at line 117 of file LoopInfo.h.

Referenced by llvm::RecurrenceDescriptor::AddReductionVar(), analyzeLoopUnrollCost(), asmClobbersCTR(), llvm::LoopAccessInfo::blockNeedsPredication(), BuildConstantFromSCEV(), canConstantEvolve(), canFoldIVIncExpr(), CloneLoop(), cloneLoopBlocks(), llvm::collectChildrenInLoop(), llvm::CodeMetrics::collectEphemeralValues(), computeBlocksDominatingExits(), ConnectEpilog(), ConnectProlog(), llvm::LoopBase< BasicBlock, Loop >::contains(), ConvertToSInt(), llvm::ScalarEvolution::createAddRecFromPHIWithCasts(), llvm::createHexagonHardwareLoops(), llvm::createSeparateConstOffsetFromGEPPass(), llvm::createWebAssemblyFixIrreducibleControlFlow(), DeleteTriviallyDeadInstructions(), dependsOnLocalPhi(), llvm::Loop::dumpVerbose(), expandBounds(), llvm::findDefsUsedOutsideOfLoop(), FindLIVLoopCondition(), findPHIToPartitionLoops(), llvm::ScalarEvolution::forgetValue(), llvm::formDedicatedExitBlocks(), genLoopLimit(), llvm::ScalarEvolution::getAddRecExpr(), getIncrmentFactorSCEV(), getLayoutSuccessorProbThreshold(), llvm::ScalarEvolution::getLoopDisposition(), llvm::LoopBase< BasicBlock, Loop >::getLoopLatches(), llvm::LoopBase< BasicBlock, Loop >::getNumBackEdges(), getSingleSchedPred(), hasOutsideLoopUser(), hasUsesOutsideLoop(), insertDebugValues(), llvm::InsertPreheaderForLoop(), InstructionStoresToFI(), inSubLoop(), IsAvailableOnEntry(), isBlockInLCSSAForm(), isExitingLoop(), llvm::RecurrenceDescriptor::isFirstOrderRecurrence(), llvm::InductionDescriptor::isFPInductionPHI(), IsIncrementNUW(), isInteresting(), llvm::LoopBase< BasicBlock, Loop >::isLoopExiting(), llvm::LoopBase< BasicBlock, Loop >::isLoopLatch(), isNotUsedInLoop(), isSafeToExecuteUnconditionally(), isSourceDefinedByImplicitDef(), isTrivialLoopExitBlockHelper(), IVUseShouldUsePostIncValue(), llvm::LPMUpdater::markLoopAsDeleted(), mayLoadFromGOTOrConstantPool(), llvm::LoopInfo::movementPreservesLCSSAForm(), needToInsertPhisForLCSSA(), llvm::LoopBodyTraits::LoopBodyFilter::operator()(), llvm::slpvectorizer::BoUpSLP::optimizeGatherSequence(), llvm::peelLoop(), PickMostRelevantLoop(), placeSplitBlockCarefully(), llvm::promoteLoopAccessesToScalars(), replaceLoopUsesWithConstant(), llvm::LoopInfo::replacementPreservesLCSSAForm(), ReplaceUsesOfWith(), scanInlinedCode(), separateNestedLoop(), shouldSpeculateInstrs(), SimplifyLoopInst(), simplifyOneLoop(), sinkInstruction(), SortBlocks(), SumCanReachMin(), truncateIVUse(), llvm::UnrollLoop(), llvm::UnrollRuntimeLoopRemainder(), unswitchAllTrivialConditions(), unswitchTrivialBranch(), UpdateAnalysisInformation(), llvm::LoopVersioning::versionLoop(), and llvm::LoopBlocksTraversal::visitPreorder().

◆ contains() [2/3]

template<class BlockT, class LoopT>
bool llvm::LoopBase< BlockT, LoopT >::contains ( const BlockT *  BB) const
inline

Return true if the specified basic block is in this loop.

Definition at line 127 of file LoopInfo.h.

◆ contains() [3/3]

template<class BlockT, class LoopT>
template<class InstT >
bool llvm::LoopBase< BlockT, LoopT >::contains ( const InstT *  Inst) const
inline

Return true if the specified instruction is in this loop.

Definition at line 133 of file LoopInfo.h.

◆ empty()

template<class BlockT, class LoopT>
bool llvm::LoopBase< BlockT, LoopT >::empty ( ) const
inline

◆ end()

template<class BlockT, class LoopT>
iterator llvm::LoopBase< BlockT, LoopT >::end ( ) const
inline

◆ getBlocks()

template<class BlockT, class LoopT>
const std::vector<BlockT *>& llvm::LoopBase< BlockT, LoopT >::getBlocks ( ) const
inline

◆ getExitBlock()

template<class BlockT , class LoopT >
BlockT * llvm::LoopBase< BlockT, LoopT >::getExitBlock ( ) const

If getExitBlocks would return exactly one block, return that block.

getExitBlock - If getExitBlocks would return exactly one block, return that block.

Otherwise return null.

Definition at line 76 of file LoopInfoImpl.h.

Referenced by llvm::InnerLoopVectorizer::createInductionVariable(), genLoopLimit(), llvm::LoopBase< BasicBlock, Loop >::getNumBackEdges(), llvm::LoopVersioning::LoopVersioning(), and llvm::LoopVersioning::versionLoop().

◆ getExitBlocks()

template<class BlockT, class LoopT >
void llvm::LoopBase< BlockT, LoopT >::getExitBlocks ( SmallVectorImpl< BlockT *> &  ExitBlocks) const

Return all of the successor blocks of this loop.

getExitBlocks - Return all of the successor blocks of this loop.

These are the blocks outside of the current loop which are branched to.

Definition at line 63 of file LoopInfoImpl.h.

Referenced by llvm::createWebAssemblyFixIrreducibleControlFlow(), llvm::formLCSSA(), llvm::formLCSSAForInstructions(), llvm::LoopBase< BasicBlock, Loop >::getNumBackEdges(), INITIALIZE_PASS(), llvm::isGuaranteedToExecute(), LoopIsOuterMostWithPredecessor(), SimplifyLoopInst(), llvm::UnrollLoop(), unswitchTrivialBranch(), and unswitchTrivialSwitch().

◆ getExitEdges()

template<class BlockT , class LoopT >
void llvm::LoopBase< BlockT, LoopT >::getExitEdges ( SmallVectorImpl< Edge > &  ExitEdges) const

Return all pairs of (inside_block,outside_block).

getExitEdges - Return all pairs of (inside_block,outside_block).

Definition at line 87 of file LoopInfoImpl.h.

◆ getExitingBlock()

template<class BlockT , class LoopT >
BlockT * llvm::LoopBase< BlockT, LoopT >::getExitingBlock ( ) const

◆ getExitingBlocks()

template<class BlockT, class LoopT >
void llvm::LoopBase< BlockT, LoopT >::getExitingBlocks ( SmallVectorImpl< BlockT *> &  ExitingBlocks) const

Return all blocks inside the loop that have successors outside of the loop.

getExitingBlocks - Return all blocks inside the loop that have successors outside of the loop.

These are the blocks inside of the current loop which branch out. The returned list is always unique.

Definition at line 35 of file LoopInfoImpl.h.

Referenced by asmClobbersCTR(), canProfitablyUnrollMultiExitLoop(), ConvertToSInt(), deleteLoopIfDead(), llvm::ScalarEvolution::forgetValue(), llvm::LoopBase< BasicBlock, Loop >::getNumBackEdges(), llvm::SCEVExpander::getRelatedExistingExpansion(), InstructionStoresToFI(), isAlwaysFoldable(), llvm::LoopSimplifyPass::run(), and simplifyOneLoop().

◆ getHeader()

template<class BlockT, class LoopT>
BlockT* llvm::LoopBase< BlockT, LoopT >::getHeader ( ) const
inline

Definition at line 107 of file LoopInfo.h.

Referenced by llvm::addClonedBlockToLoopInfo(), llvm::InnerLoopVectorizer::addMetadata(), llvm::RecurrenceDescriptor::AddReductionVar(), llvm::LoopAccessInfo::addRuntimeChecks(), AddRuntimeUnrollDisableMetaData(), llvm::addStringMetadataToLoop(), analyzeLoopUnrollCost(), llvm::LoopVersioning::annotateInstWithNoAlias(), asmClobbersCTR(), llvm::LoopBlocksTraversal::begin(), llvm::LoopAccessInfo::blockNeedsPredication(), BuildConstantFromSCEV(), calculateIterationsToInvariance(), canConstantEvolve(), canFoldIVIncExpr(), CloneLoop(), cloneLoopBlocks(), CloneLoopBlocks(), llvm::cloneLoopWithPreheader(), CollectSubexprs(), computeBlocksDominatingExits(), llvm::computeLoopSafetyInfo(), llvm::computePeelCount(), computeUnrollCount(), ConvertToSInt(), llvm::ScalarEvolution::createAddRecFromPHIWithCasts(), llvm::createHexagonHardwareLoops(), llvm::InnerLoopVectorizer::createInductionVariable(), llvm::createLICMPass(), createMissedAnalysis(), createStringMetadata(), llvm::createWebAssemblyFixIrreducibleControlFlow(), deleteDeadInstruction(), deleteDeadLoop(), DFS(), DisableAllLoopOptsOnLoop(), DoInitialMatch(), emitBasicBlockLoopComments(), llvm::LoopBlocksTraversal::end(), llvm::SystemZPostRASchedStrategy::enterMBB(), EqualityPropUnSafe(), EvaluateConstantChrecAtConstant(), llvm::SCEVExpander::expandCodeFor(), FindLIVLoopCondition(), FindLoopCounter(), llvm::MachineLoopInfo::findLoopPreheader(), findPHIToPartitionLoops(), llvm::ScalarEvolution::forgetValue(), gatherUnrollingPreferences(), genLoopLimit(), llvm::ScalarEvolution::getAddExpr(), llvm::ScalarEvolution::getAddRecExpr(), llvm::ScalarEvolution::getBlockDisposition(), llvm::getDebugLocString(), llvm::LoopBodyTraits::getEntryNode(), getIncrmentFactorSCEV(), getLayoutSuccessorProbThreshold(), llvm::getLoopEstimatedTripCount(), llvm::LoopBase< BasicBlock, Loop >::getLoopLatches(), getLoopLatchExitBlock(), getLoopPhiForCounter(), llvm::Loop::getName(), llvm::LoopBase< BasicBlock, Loop >::getNumBackEdges(), llvm::InnerLoopVectorizer::getOrCreateTripCount(), llvm::SCEVExpander::getOrInsertCanonicalInductionVariable(), getOtherIncomingValue(), GetPointerOperand(), llvm::getPtrStride(), getRangeForAffineARHelper(), llvm::SCEVExpander::getRelatedExistingExpansion(), getSingleSchedPred(), getUnderlyingObjects(), INITIALIZE_PASS(), insertDebugValues(), llvm::InsertPreheaderForLoop(), insertUniqueBackedgeBlock(), InstructionStoresToFI(), IntersectRange(), is_empty(), isAlwaysFoldable(), llvm::ScalarEvolution::isAvailableAtLoopEntry(), isEpilogProfitable(), isExistingPhi(), isExitingLoop(), llvm::RecurrenceDescriptor::isFirstOrderRecurrence(), llvm::InductionDescriptor::isFPInductionPHI(), llvm::isGuaranteedToExecute(), llvm::isGuaranteedToExecuteForEveryIteration(), isIgnorableInst(), isImmValidForOpcode(), IsIncrementNUW(), isIntegerLoopHeaderPHI(), isLoadInvariantInLoop(), llvm::ScalarEvolution::isLoopBackedgeGuardedByCond(), llvm::ScalarEvolution::isLoopEntryGuardedByCond(), isLoopIncrement(), isLoopInvariant(), llvm::LoopBase< BasicBlock, Loop >::isLoopLatch(), isProfitableChain(), isProfitableForVectorization(), isProperBackedge(), llvm::RecurrenceDescriptor::isReductionPHI(), isSimplifiedLoopNest(), isSourceDefinedByImplicitDef(), isTrivialLoopExitBlock(), llvm::IVUsers::IVUsers(), llvm::LoopBottom(), LoopIsOuterMostWithPredecessor(), mayLoadFromGOTOrConstantPool(), mayLoopAccessLocation(), mergeOperations(), moveBBContents(), llvm::LoopBodyTraits::LoopBodyFilter::operator()(), llvm::SplitEditor::overlapIntv(), llvm::peelLoop(), PickMostRelevantLoop(), PlaceLoopMarker(), preheader(), llvm::LoopVersioning::prepareNoAliasMetadata(), llvm::SCEV::print(), llvm::IVUsers::print(), llvm::MemoryDepChecker::Dependence::print(), PrintParentLoopComment(), llvm::LoopVectorizePass::processLoop(), profitImm(), pushDepHeight(), PushLoopPHIs(), readsVCCZ(), ReduceLoopStrength(), llvm::SCEVExpander::replaceCongruentIVs(), ReplaceUsesOfWith(), llvm::LoopAccessInfoPrinterPass::run(), llvm::IndVarSimplifyPass::run(), llvm::LoopRotatePass::run(), llvm::LoopDataPrefetchPass::run(), llvm::LoopIdiomRecognizePass::run(), llvm::SimpleLoopUnswitchPass::run(), llvm::LoopSimplifyPass::run(), llvm::LPPassManager::runOnFunction(), llvm::IVUsersWrapperPass::runOnLoop(), scanInlinedCode(), separateNestedLoop(), SetLoopAlreadyUnrolled(), shouldSpeculateInstrs(), llvm::ScalarEvolution::SimplifyICmpOperands(), simplifyLoopCFG(), SimplifyLoopInst(), llvm::simplifyLoopIVs(), simplifyOneLoop(), llvm::LoopPass::skipLoop(), SolveQuadraticEquation(), SortBlocks(), SortCallTargets(), SumCanReachMin(), truncateIVUse(), tryToUnrollLoop(), llvm::UnrollLoop(), llvm::UnrollRuntimeLoopRemainder(), unswitchAllTrivialConditions(), unswitchTrivialBranch(), unswitchTrivialSwitch(), updateLoopExitIDom(), llvm::LoopVersioning::versionLoop(), and visitIVCast().

◆ getLoopDepth()

template<class BlockT, class LoopT>
unsigned llvm::LoopBase< BlockT, LoopT >::getLoopDepth ( ) const
inline

Return the nesting level of this loop.

An outer-most loop has depth 1, for consistency with loop depth values used for basic blocks, where depth 0 is used for blocks not inside any loops.

Definition at line 99 of file LoopInfo.h.

Referenced by emitBasicBlockLoopComments(), llvm::ScalarEvolution::getAddRecExpr(), getPointerOperand(), llvm::AMDGPUTTIImpl::getUnrollingPreferences(), llvm::AArch64TTIImpl::getUnrollingPreferences(), llvm::SplitEditor::overlapIntv(), PrintParentLoopComment(), and UpdateAnalysisInformation().

◆ getLoopLatch()

template<class BlockT , class LoopT >
BlockT * llvm::LoopBase< BlockT, LoopT >::getLoopLatch ( ) const

If there is a single latch block for this loop, return it.

getLoopLatch - If there is a single latch block for this loop, return it.

A latch block is a block that contains a branch back to the header.

Definition at line 157 of file LoopInfoImpl.h.

Referenced by llvm::addStringMetadataToLoop(), analyzeLoopUnrollCost(), llvm::LoopAccessInfo::blockNeedsPredication(), calculateIterationsToInvariance(), canPeel(), cloneLoopBlocks(), CloneLoopBlocks(), llvm::computePeelCount(), ConnectEpilog(), ConnectProlog(), llvm::createHexagonHardwareLoops(), llvm::InnerLoopVectorizer::createInductionVariable(), EvaluateConstantChrecAtConstant(), FindLoopCounter(), llvm::MachineLoopInfo::findLoopPreheader(), llvm::ScalarEvolution::forgetValue(), genLoopLimit(), llvm::getLoopEstimatedTripCount(), getLoopLatchExitBlock(), getLoopTest(), getOtherIncomingValue(), GetPointerOperand(), getRangeForAffineARHelper(), getReductionValue(), llvm::ARMTTIImpl::getUnrollingPreferences(), insertDebugValues(), is_empty(), isAlwaysFoldable(), llvm::RecurrenceDescriptor::isFirstOrderRecurrence(), isImmValidForOpcode(), IsIncrementNUW(), llvm::ScalarEvolution::isLoopBackedgeGuardedByCond(), isProfitableChain(), isProfitableForVectorization(), IVUseShouldUsePostIncValue(), moveBBContents(), needsLFTR(), llvm::peelLoop(), llvm::MemoryDepChecker::Dependence::print(), profitImm(), llvm::SCEVExpander::replaceCongruentIVs(), ReplaceUsesOfWith(), llvm::LoopSimplifyPass::run(), shouldSpeculateInstrs(), simplifyOneLoop(), SumCanReachMin(), truncateIVUse(), tryToUnrollLoop(), llvm::UnrollLoop(), and llvm::UnrollRuntimeLoopRemainder().

◆ getLoopLatches()

template<class BlockT, class LoopT>
void llvm::LoopBase< BlockT, LoopT >::getLoopLatches ( SmallVectorImpl< BlockT *> &  LoopLatches) const
inline

Return all loop latch blocks of this loop.

A latch block is a block that contains a branch back to the header.

Definition at line 267 of file LoopInfo.h.

Referenced by scanInlinedCode().

◆ getLoopPredecessor()

template<class BlockT , class LoopT >
BlockT * llvm::LoopBase< BlockT, LoopT >::getLoopPredecessor ( ) const

If the given loop's header has exactly one unique predecessor outside the loop, return it.

getLoopPredecessor - If the given loop's header has exactly one unique predecessor outside the loop, return it.

Otherwise return null. This is less strict that the loop "preheader" concept, which requires the predecessor to have exactly one successor.

Definition at line 134 of file LoopInfoImpl.h.

Referenced by EvaluateConstantChrecAtConstant(), GetPointerOperand(), llvm::ScalarEvolution::isLoopEntryGuardedByCond(), mayLoadFromGOTOrConstantPool(), and SolveQuadraticEquation().

◆ getLoopPreheader()

template<class BlockT , class LoopT >
BlockT * llvm::LoopBase< BlockT, LoopT >::getLoopPreheader ( ) const

If there is a preheader for this loop, return it.

getLoopPreheader - If there is a preheader for this loop, return it.

A loop has a preheader if there is only one edge to the header of the loop from outside of the loop. If this is the case, the block branching to the header of the loop is the preheader node.

This method returns null if there is no preheader for the loop.

A loop has a preheader if there is only one edge to the header of the loop from outside of the loop and it is legal to hoist instructions into the predecessor. If this is the case, the block branching to the header of the loop is the preheader node.

This method returns null if there is no preheader for the loop.

Definition at line 106 of file LoopInfoImpl.h.

Referenced by llvm::RecurrenceDescriptor::AddReductionVar(), analyzeLoopUnrollCost(), asmClobbersCTR(), cloneLoopBlocks(), llvm::cloneLoopWithPreheader(), ConvertToSInt(), llvm::createHexagonHardwareLoops(), llvm::InnerLoopVectorizer::createInductionVariable(), llvm::createLICMPass(), llvm::InnerLoopVectorizer::createVectorizedLoopSkeleton(), deleteDeadInstruction(), deleteDeadLoop(), deleteLoopIfDead(), detectPopcountIdiom(), llvm::InnerLoopVectorizer::emitMemRuntimeChecks(), llvm::InnerLoopVectorizer::emitMinimumIterationCountCheck(), llvm::InnerLoopVectorizer::emitSCEVChecks(), llvm::SCEVExpander::expandCodeFor(), findBBsToSinkInto(), findIBRPredecessor(), llvm::MachineLoopInfo::findLoopPreheader(), genLoopLimit(), getLoopLatchExitBlock(), llvm::InnerLoopVectorizer::getOrCreateTripCount(), llvm::InnerLoopVectorizer::getOrCreateVectorTripCount(), hasDataDependence(), hoist(), llvm::SCEVExpander::hoistIVInc(), llvm::hoistRegion(), insertDebugValues(), IntersectRange(), isAlwaysFoldable(), isEpilogProfitable(), llvm::RecurrenceDescriptor::isFirstOrderRecurrence(), isIgnorableInst(), IsIncrementNUW(), llvm::InductionDescriptor::isInductionPHI(), isLoopInvariant(), isLoopNeverExecuted(), isProfitableForVectorization(), mayLoadFromGOTOrConstantPool(), mayLoopAccessLocation(), moveBBContents(), llvm::slpvectorizer::BoUpSLP::optimizeGatherSequence(), llvm::peelLoop(), preheader(), llvm::promoteLoopAccessesToScalars(), llvm::LoopSimplifyPass::run(), simplifyOneLoop(), sinkLoopInvariantInstructions(), SumCanReachMin(), llvm::UnrollLoop(), llvm::UnrollRuntimeLoopRemainder(), unswitchTrivialBranch(), unswitchTrivialSwitch(), and llvm::LoopVersioning::versionLoop().

◆ getNumBackEdges()

template<class BlockT, class LoopT>
unsigned llvm::LoopBase< BlockT, LoopT >::getNumBackEdges ( ) const
inline

Calculate the number of back edges to the loop header.

Definition at line 204 of file LoopInfo.h.

Referenced by insertUniqueBackedgeBlock(), llvm::MemoryDepChecker::Dependence::print(), and simplifyOneLoop().

◆ getNumBlocks()

template<class BlockT, class LoopT>
unsigned llvm::LoopBase< BlockT, LoopT >::getNumBlocks ( ) const
inline

Get the number of blocks in this loop in constant time.

Invalidate the loop, indicating that it is no longer a loop.

Definition at line 170 of file LoopInfo.h.

Referenced by llvm::LoopBlocksTraversal::begin(), getLayoutSuccessorProbThreshold(), llvm::ARMTTIImpl::getUnrollingPreferences(), llvm::LoopBlocksDFS::isComplete(), isIgnorableInst(), llvm::LoopBlocksDFS::LoopBlocksDFS(), and MaybeUpdateTerminator().

◆ getParentLoop()

template<class BlockT, class LoopT>
LoopT* llvm::LoopBase< BlockT, LoopT >::getParentLoop ( ) const
inline

◆ getSubLoops()

template<class BlockT, class LoopT>
const std::vector<LoopT *>& llvm::LoopBase< BlockT, LoopT >::getSubLoops ( ) const
inline

◆ getSubLoopsVector()

template<class BlockT, class LoopT>
std::vector<LoopT *>& llvm::LoopBase< BlockT, LoopT >::getSubLoopsVector ( )
inline

Definition at line 142 of file LoopInfo.h.

◆ isInvalid()

template<class BlockT, class LoopT>
bool llvm::LoopBase< BlockT, LoopT >::isInvalid ( ) const
inline

◆ isLoopExiting()

template<class BlockT, class LoopT>
bool llvm::LoopBase< BlockT, LoopT >::isLoopExiting ( const BlockT *  BB) const
inline

◆ isLoopLatch()

template<class BlockT, class LoopT>
bool llvm::LoopBase< BlockT, LoopT >::isLoopLatch ( const BlockT *  BB) const
inline

Definition at line 193 of file LoopInfo.h.

◆ moveToHeader()

template<class BlockT, class LoopT>
void llvm::LoopBase< BlockT, LoopT >::moveToHeader ( BlockT *  BB)
inline

This method is used to move BB (which must be part of this loop) to be the loop header of the loop (the block that dominates all others).

Definition at line 336 of file LoopInfo.h.

Referenced by insertDebugValues(), separateNestedLoop(), simplifyLoopCFG(), and UpdateAnalysisInformation().

◆ print()

template<class BlockT , class LoopT >
void llvm::LoopBase< BlockT, LoopT >::print ( raw_ostream OS,
unsigned  Depth = 0,
bool  Verbose = false 
) const

◆ rbegin()

template<class BlockT, class LoopT>
reverse_iterator llvm::LoopBase< BlockT, LoopT >::rbegin ( ) const
inline

Definition at line 151 of file LoopInfo.h.

◆ removeBlockFromLoop()

template<class BlockT, class LoopT>
void llvm::LoopBase< BlockT, LoopT >::removeBlockFromLoop ( BlockT *  BB)
inline

This removes the specified basic block from the current loop, updating the Blocks as appropriate.

This does not update the mapping in the LoopInfo class.

Definition at line 353 of file LoopInfo.h.

Referenced by separateNestedLoop().

◆ removeChildLoop()

template<class BlockT, class LoopT>
LoopT* llvm::LoopBase< BlockT, LoopT >::removeChildLoop ( iterator  I)
inline

This removes the specified child from being a subloop of this loop.

The loop is not deleted, as it will presumably be inserted into another loop.

Definition at line 303 of file LoopInfo.h.

Referenced by llvm::Loop::dumpVerbose(), llvm::LoopInfo::erase(), isProfitableForVectorization(), and separateNestedLoop().

◆ rend()

template<class BlockT, class LoopT>
reverse_iterator llvm::LoopBase< BlockT, LoopT >::rend ( ) const
inline

Definition at line 152 of file LoopInfo.h.

◆ replaceChildLoopWith()

template<class BlockT , class LoopT>
void llvm::LoopBase< BlockT, LoopT >::replaceChildLoopWith ( LoopT *  OldChild,
LoopT *  NewChild 
)

This is used when splitting loops up.

replaceChildLoopWith - This is used when splitting loops up.

It replaces the OldChild entry in our children list with NewChild, and updates the parent pointer of OldChild to be null and the NewChild to be this loop. This updates the loop depth of the new child.

Definition at line 213 of file LoopInfoImpl.h.

Referenced by llvm::LoopBase< BasicBlock, Loop >::getLoopLatches().

◆ reserveBlocks()

template<class BlockT, class LoopT>
void llvm::LoopBase< BlockT, LoopT >::reserveBlocks ( unsigned  size)
inline

interface to do reserve() for Blocks

Definition at line 329 of file LoopInfo.h.

◆ reverseBlock()

template<class BlockT, class LoopT>
void llvm::LoopBase< BlockT, LoopT >::reverseBlock ( unsigned  from)
inline

interface to reverse Blocks[from, end of loop] in this loop

Definition at line 323 of file LoopInfo.h.

◆ setParentLoop()

template<class BlockT, class LoopT>
void llvm::LoopBase< BlockT, LoopT >::setParentLoop ( LoopT *  L)
inline

This is a raw interface for bypassing addChildLoop.

Definition at line 111 of file LoopInfo.h.

◆ verifyLoop()

template<class BlockT , class LoopT >
void llvm::LoopBase< BlockT, LoopT >::verifyLoop ( ) const

◆ verifyLoopNest()

template<class BlockT , class LoopT>
void llvm::LoopBase< BlockT, LoopT >::verifyLoopNest ( DenseSet< const LoopT *> *  Loops) const

Verify loop structure of this loop and all nested loops.

verifyLoop - Verify loop structure of this loop and all nested loops.

Definition at line 313 of file LoopInfoImpl.h.

Referenced by llvm::LoopBase< BasicBlock, Loop >::removeBlockFromLoop().

Friends And Related Function Documentation

◆ LoopInfoBase< BlockT, LoopT >

template<class BlockT, class LoopT>
friend class LoopInfoBase< BlockT, LoopT >
friend

Definition at line 372 of file LoopInfo.h.


The documentation for this class was generated from the following files: