LLVM  14.0.0git
Classes | Namespaces | Enumerations | Functions
LoopUtils.h File Reference
#include "llvm/ADT/StringRef.h"
#include "llvm/Analysis/IVDescriptors.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/Transforms/Utils/ValueMapper.h"
Include dependency graph for LoopUtils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  llvm::DomTreeNodeBase< NodeT >
 Base class for the actual dominator tree node. More...
 
class  llvm::Optional< T >
 
class  llvm::SmallSetVector< T, N >
 A SetVector that performs no allocations if smaller than a certain size. More...
 
class  llvm::SmallVector< T, N >
 This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small. More...
 
class  llvm::SmallVectorImpl< T >
 This class consists of common code factored out of the SmallVector class to reduce code duplication based on the SmallVector 'N' template parameter. More...
 
class  llvm::SmallPriorityWorklist< T, N >
 A version of PriorityWorklist that selects small size optimized data structures for the vector and map. More...
 
class  llvm::SinkAndHoistLICMFlags
 Flags controlling how much is checked when sinking or hoisting instructions. More...
 
struct  llvm::IVConditionInfo
 Struct to hold information about a partially invariant condition. More...
 

Namespaces

 llvm
 ---------------------— PointerInfo ------------------------------------—
 

Enumerations

enum  llvm::TransformationMode {
  llvm::TM_Unspecified, llvm::TM_Enable, llvm::TM_Disable, llvm::TM_Force = 0x04,
  llvm::TM_ForcedByUser = TM_Enable | TM_Force, llvm::TM_SuppressedByUser = TM_Disable | TM_Force
}
 The mode sets how eager a transformation should be applied. More...
 
enum  llvm::ReplaceExitVal { llvm::NeverRepl, llvm::OnlyCheapRepl, llvm::NoHardUse, llvm::AlwaysRepl }
 

Functions

BasicBlockllvm::InsertPreheaderForLoop (Loop *L, DominatorTree *DT, LoopInfo *LI, MemorySSAUpdater *MSSAU, bool PreserveLCSSA)
 InsertPreheaderForLoop - Once we discover that a loop doesn't have a preheader, this method is called to insert one. More...
 
bool llvm::formDedicatedExitBlocks (Loop *L, DominatorTree *DT, LoopInfo *LI, MemorySSAUpdater *MSSAU, bool PreserveLCSSA)
 Ensure that all exit blocks of the loop are dedicated exits. More...
 
bool llvm::formLCSSAForInstructions (SmallVectorImpl< Instruction * > &Worklist, const DominatorTree &DT, const LoopInfo &LI, ScalarEvolution *SE, IRBuilderBase &Builder, SmallVectorImpl< PHINode * > *PHIsToRemove=nullptr)
 Ensures LCSSA form for every instruction from the Worklist in the scope of innermost containing loop. More...
 
bool llvm::formLCSSA (Loop &L, const DominatorTree &DT, const LoopInfo *LI, ScalarEvolution *SE)
 Put loop into LCSSA form. More...
 
bool llvm::formLCSSARecursively (Loop &L, const DominatorTree &DT, const LoopInfo *LI, ScalarEvolution *SE)
 Put a loop nest into LCSSA form. More...
 
bool llvm::sinkRegion (DomTreeNode *, AAResults *, LoopInfo *, DominatorTree *, BlockFrequencyInfo *, TargetLibraryInfo *, TargetTransformInfo *, Loop *, AliasSetTracker *, MemorySSAUpdater *, ICFLoopSafetyInfo *, SinkAndHoistLICMFlags &, OptimizationRemarkEmitter *)
 Walk the specified region of the CFG (defined by all blocks dominated by the specified block, and that are in the current loop) in reverse depth first order w.r.t the DominatorTree. More...
 
bool llvm::hoistRegion (DomTreeNode *, AAResults *, LoopInfo *, DominatorTree *, BlockFrequencyInfo *, TargetLibraryInfo *, Loop *, AliasSetTracker *, MemorySSAUpdater *, ScalarEvolution *, ICFLoopSafetyInfo *, SinkAndHoistLICMFlags &, OptimizationRemarkEmitter *, bool)
 Walk the specified region of the CFG (defined by all blocks dominated by the specified block, and that are in the current loop) in depth first order w.r.t the DominatorTree. More...
 
void llvm::deleteDeadLoop (Loop *L, DominatorTree *DT, ScalarEvolution *SE, LoopInfo *LI, MemorySSA *MSSA=nullptr)
 This function deletes dead loops. More...
 
void llvm::breakLoopBackedge (Loop *L, DominatorTree &DT, ScalarEvolution &SE, LoopInfo &LI, MemorySSA *MSSA)
 Remove the backedge of the specified loop. More...
 
bool llvm::promoteLoopAccessesToScalars (const SmallSetVector< Value *, 8 > &, SmallVectorImpl< BasicBlock * > &, SmallVectorImpl< Instruction * > &, SmallVectorImpl< MemoryAccess * > &, PredIteratorCache &, LoopInfo *, DominatorTree *, const TargetLibraryInfo *, Loop *, AliasSetTracker *, MemorySSAUpdater *, ICFLoopSafetyInfo *, OptimizationRemarkEmitter *)
 Try to promote memory values to scalars by sinking stores out of the loop and moving loads to before the loop. More...
 
SmallVector< DomTreeNode *, 16 > llvm::collectChildrenInLoop (DomTreeNode *N, const Loop *CurLoop)
 Does a BFS from a given node to all of its children inside a given loop. More...
 
SmallVector< Instruction *, 8 > llvm::findDefsUsedOutsideOfLoop (Loop *L)
 Returns the instructions that use values defined in the loop. More...
 
Optional< ElementCountllvm::getOptionalElementCountLoopAttribute (const Loop *TheLoop)
 Find a combination of metadata ("llvm.loop.vectorize.width" and "llvm.loop.vectorize.scalable.enable") for a loop and use it to construct a ElementCount. More...
 
Optional< MDNode * > llvm::makeFollowupLoopID (MDNode *OrigLoopID, ArrayRef< StringRef > FollowupAttrs, const char *InheritOptionsAttrsPrefix="", bool AlwaysNew=false)
 Create a new loop identifier for a loop created from a loop transformation. More...
 
bool llvm::hasDisableAllTransformsHint (const Loop *L)
 Look for the loop attribute that disables all transformation heuristic. More...
 
bool llvm::hasDisableLICMTransformsHint (const Loop *L)
 Look for the loop attribute that disables the LICM transformation heuristics. More...
 
void llvm::addStringMetadataToLoop (Loop *TheLoop, const char *MDString, unsigned V=0)
 Set input string into loop metadata by keeping other values intact. More...
 
Optional< unsigned > llvm::getLoopEstimatedTripCount (Loop *L, unsigned *EstimatedLoopInvocationWeight=nullptr)
 Returns a loop's estimated trip count based on branch weight metadata. More...
 
bool llvm::setLoopEstimatedTripCount (Loop *L, unsigned EstimatedTripCount, unsigned EstimatedLoopInvocationWeight)
 Set a loop's branch weight metadata to reflect that loop has EstimatedTripCount iterations and EstimatedLoopInvocationWeight exits through latch. More...
 
bool llvm::hasIterationCountInvariantInParent (Loop *L, ScalarEvolution &SE)
 Check inner loop (L) backedge count is known to be invariant on all iterations of its outer loop. More...
 
void llvm::getLoopAnalysisUsage (AnalysisUsage &AU)
 Helper to consistently add the set of standard passes to a loop pass's AnalysisUsage. More...
 
bool llvm::canSinkOrHoistInst (Instruction &I, AAResults *AA, DominatorTree *DT, Loop *CurLoop, AliasSetTracker *CurAST, MemorySSAUpdater *MSSAU, bool TargetExecutesOncePerLoop, SinkAndHoistLICMFlags *LICMFlags=nullptr, OptimizationRemarkEmitter *ORE=nullptr)
 Returns true if is legal to hoist or sink this instruction disregarding the possible introduction of faults. More...
 
Valuellvm::createMinMaxOp (IRBuilderBase &Builder, RecurKind RK, Value *Left, Value *Right)
 Returns a Min/Max operation corresponding to MinMaxRecurrenceKind. More...
 
Valuellvm::getOrderedReduction (IRBuilderBase &Builder, Value *Acc, Value *Src, unsigned Op, RecurKind MinMaxKind=RecurKind::None, ArrayRef< Value * > RedOps=None)
 Generates an ordered vector reduction using extracts to reduce the value. More...
 
Valuellvm::getShuffleReduction (IRBuilderBase &Builder, Value *Src, unsigned Op, RecurKind MinMaxKind=RecurKind::None, ArrayRef< Value * > RedOps=None)
 Generates a vector reduction using shufflevectors to reduce the value. More...
 
Valuellvm::createSimpleTargetReduction (IRBuilderBase &B, const TargetTransformInfo *TTI, Value *Src, RecurKind RdxKind, ArrayRef< Value * > RedOps=None)
 Create a target reduction of the given vector. More...
 
Valuellvm::createTargetReduction (IRBuilderBase &B, const TargetTransformInfo *TTI, const RecurrenceDescriptor &Desc, Value *Src)
 Create a generic target reduction using a recurrence descriptor Desc The target is queried to determine if intrinsics or shuffle sequences are required to implement the reduction. More...
 
Valuellvm::createOrderedReduction (IRBuilderBase &B, const RecurrenceDescriptor &Desc, Value *Src, Value *Start)
 Create an ordered reduction intrinsic using the given recurrence descriptor Desc. More...
 
void llvm::propagateIRFlags (Value *I, ArrayRef< Value * > VL, Value *OpValue=nullptr)
 Get the intersection (logical and) of all of the potential IR flags of each scalar operation (VL) that will be converted into a vector (I). More...
 
bool llvm::isKnownNegativeInLoop (const SCEV *S, const Loop *L, ScalarEvolution &SE)
 Returns true if we can prove that S is defined and always negative in loop L. More...
 
bool llvm::isKnownNonNegativeInLoop (const SCEV *S, const Loop *L, ScalarEvolution &SE)
 Returns true if we can prove that S is defined and always non-negative in loop L. More...
 
bool llvm::cannotBeMaxInLoop (const SCEV *S, const Loop *L, ScalarEvolution &SE, bool Signed)
 Returns true if S is defined and never is equal to signed/unsigned max. More...
 
bool llvm::cannotBeMinInLoop (const SCEV *S, const Loop *L, ScalarEvolution &SE, bool Signed)
 Returns true if S is defined and never is equal to signed/unsigned min. More...
 
int llvm::rewriteLoopExitValues (Loop *L, LoopInfo *LI, TargetLibraryInfo *TLI, ScalarEvolution *SE, const TargetTransformInfo *TTI, SCEVExpander &Rewriter, DominatorTree *DT, ReplaceExitVal ReplaceExitValue, SmallVector< WeakTrackingVH, 16 > &DeadInsts)
 If the final value of any expressions that are recurrent in the loop can be computed, substitute the exit values from the loop into any instructions outside of the loop that use the final values of the current expressions. More...
 
void llvm::setProfileInfoAfterUnrolling (Loop *OrigLoop, Loop *UnrolledLoop, Loop *RemainderLoop, uint64_t UF)
 Set weights for UnrolledLoop and RemainderLoop based on weights for OrigLoop and the following distribution of OrigLoop iteration among UnrolledLoop and RemainderLoop. More...
 
template<typename RangeT >
void llvm::appendLoopsToWorklist (RangeT &&, SmallPriorityWorklist< Loop *, 4 > &)
 Utility that implements appending of loops onto a worklist given a range. More...
 
template<typename RangeT >
void llvm::appendReversedLoopsToWorklist (RangeT &&, SmallPriorityWorklist< Loop *, 4 > &)
 Utility that implements appending of loops onto a worklist given a range. More...
 
void llvm::appendLoopsToWorklist (LoopInfo &, SmallPriorityWorklist< Loop *, 4 > &)
 Utility that implements appending of loops onto a worklist given LoopInfo. More...
 
Loopllvm::cloneLoop (Loop *L, Loop *PL, ValueToValueMapTy &VM, LoopInfo *LI, LPPassManager *LPM)
 Recursively clone the specified loop and all of its children, mapping the blocks with the specified map. More...
 
std::pair< Instruction *, Instruction * > llvm::addRuntimeChecks (Instruction *Loc, Loop *TheLoop, const SmallVectorImpl< RuntimePointerCheck > &PointerChecks, SCEVExpander &Expander)
 Add code that checks at runtime if the accessed arrays in PointerChecks overlap. More...
 
Optional< IVConditionInfollvm::hasPartialIVCondition (Loop &L, unsigned MSSAThreshold, MemorySSA &MSSA, AAResults &AA)
 Check if the loop header has a conditional branch that is not loop-invariant, because it involves load instructions. More...
 
TransformationMode llvm::hasUnrollTransformation (const Loop *L)
 
TransformationMode llvm::hasUnrollAndJamTransformation (const Loop *L)
 
TransformationMode llvm::hasVectorizeTransformation (const Loop *L)
 
TransformationMode llvm::hasDistributeTransformation (const Loop *L)
 
TransformationMode llvm::hasLICMVersioningTransformation (const Loop *L)
 
TransformationMode llvm::hasUnrollTransformation (const Loop *L)
 
TransformationMode llvm::hasUnrollAndJamTransformation (const Loop *L)
 
TransformationMode llvm::hasVectorizeTransformation (const Loop *L)
 
TransformationMode llvm::hasDistributeTransformation (const Loop *L)
 
TransformationMode llvm::hasLICMVersioningTransformation (const Loop *L)