LLVM 22.0.0git
|
#include "llvm/Analysis/IVDescriptors.h"
#include "llvm/Analysis/LoopAccessAnalysis.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Transforms/Utils/ValueMapper.h"
Go to the source code of this file.
Classes | |
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 | |
namespace | llvm |
This is an optimization pass for GlobalISel generic memory operations. |
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::UnusedIndVarInLoop , llvm::AlwaysRepl } |
Functions | |
LLVM_ABI BasicBlock * | llvm::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. | |
LLVM_ABI bool | llvm::formDedicatedExitBlocks (Loop *L, DominatorTree *DT, LoopInfo *LI, MemorySSAUpdater *MSSAU, bool PreserveLCSSA) |
Ensure that all exit blocks of the loop are dedicated exits. | |
LLVM_ABI bool | llvm::formLCSSAForInstructions (SmallVectorImpl< Instruction * > &Worklist, const DominatorTree &DT, const LoopInfo &LI, ScalarEvolution *SE, SmallVectorImpl< PHINode * > *PHIsToRemove=nullptr, SmallVectorImpl< PHINode * > *InsertedPHIs=nullptr) |
Ensures LCSSA form for every instruction from the Worklist in the scope of innermost containing loop. | |
LLVM_ABI bool | llvm::formLCSSA (Loop &L, const DominatorTree &DT, const LoopInfo *LI, ScalarEvolution *SE) |
Put loop into LCSSA form. | |
LLVM_ABI bool | llvm::formLCSSARecursively (Loop &L, const DominatorTree &DT, const LoopInfo *LI, ScalarEvolution *SE) |
Put a loop nest into LCSSA form. | |
LLVM_ABI bool | llvm::sinkRegion (DomTreeNode *, AAResults *, LoopInfo *, DominatorTree *, TargetLibraryInfo *, TargetTransformInfo *, Loop *CurLoop, MemorySSAUpdater &, ICFLoopSafetyInfo *, SinkAndHoistLICMFlags &, OptimizationRemarkEmitter *, Loop *OutermostLoop=nullptr) |
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. | |
LLVM_ABI bool | llvm::sinkRegionForLoopNest (DomTreeNode *, AAResults *, LoopInfo *, DominatorTree *, TargetLibraryInfo *, TargetTransformInfo *, Loop *, MemorySSAUpdater &, ICFLoopSafetyInfo *, SinkAndHoistLICMFlags &, OptimizationRemarkEmitter *) |
Call sinkRegion on loops contained within the specified loop in order from innermost to outermost. | |
LLVM_ABI bool | llvm::hoistRegion (DomTreeNode *, AAResults *, LoopInfo *, DominatorTree *, AssumptionCache *, TargetLibraryInfo *, Loop *, MemorySSAUpdater &, ScalarEvolution *, ICFLoopSafetyInfo *, SinkAndHoistLICMFlags &, OptimizationRemarkEmitter *, bool, bool AllowSpeculation) |
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. | |
LLVM_ABI bool | llvm::isAlmostDeadIV (PHINode *IV, BasicBlock *LatchBlock, Value *Cond) |
Return true if the induction variable IV in a Loop whose latch is LatchBlock would become dead if the exit test Cond were removed. | |
LLVM_ABI void | llvm::deleteDeadLoop (Loop *L, DominatorTree *DT, ScalarEvolution *SE, LoopInfo *LI, MemorySSA *MSSA=nullptr) |
This function deletes dead loops. | |
LLVM_ABI void | llvm::breakLoopBackedge (Loop *L, DominatorTree &DT, ScalarEvolution &SE, LoopInfo &LI, MemorySSA *MSSA) |
Remove the backedge of the specified loop. | |
LLVM_ABI bool | llvm::promoteLoopAccessesToScalars (const SmallSetVector< Value *, 8 > &, SmallVectorImpl< BasicBlock * > &, SmallVectorImpl< BasicBlock::iterator > &, SmallVectorImpl< MemoryAccess * > &, PredIteratorCache &, LoopInfo *, DominatorTree *, AssumptionCache *AC, const TargetLibraryInfo *, TargetTransformInfo *, Loop *, MemorySSAUpdater &, ICFLoopSafetyInfo *, OptimizationRemarkEmitter *, bool AllowSpeculation, bool HasReadsOutsideSet) |
Try to promote memory values to scalars by sinking stores out of the loop and moving loads to before the loop. | |
LLVM_ABI SmallVector< BasicBlock *, 16 > | llvm::collectChildrenInLoop (DominatorTree *DT, DomTreeNode *N, const Loop *CurLoop) |
Does a BFS from a given node to all of its children inside a given loop. | |
LLVM_ABI SmallVector< Instruction *, 8 > | llvm::findDefsUsedOutsideOfLoop (Loop *L) |
Returns the instructions that use values defined in the loop. | |
LLVM_ABI std::optional< ElementCount > | llvm::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. | |
LLVM_ABI std::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. | |
LLVM_ABI bool | llvm::hasDisableAllTransformsHint (const Loop *L) |
Look for the loop attribute that disables all transformation heuristic. | |
LLVM_ABI bool | llvm::hasDisableLICMTransformsHint (const Loop *L) |
Look for the loop attribute that disables the LICM transformation heuristics. | |
LLVM_ABI void | llvm::addStringMetadataToLoop (Loop *TheLoop, const char *MDString, unsigned V=0) |
Set input string into loop metadata by keeping other values intact. | |
LLVM_ABI std::optional< unsigned > | llvm::getLoopEstimatedTripCount (Loop *L, unsigned *EstimatedLoopInvocationWeight=nullptr) |
Return either: | |
LLVM_ABI bool | llvm::setLoopEstimatedTripCount (Loop *L, unsigned EstimatedTripCount, std::optional< unsigned > EstimatedLoopInvocationWeight=std::nullopt) |
Set llvm.loop.estimated_trip_count with the value EstimatedTripCount in the loop metadata of L . | |
LLVM_ABI 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. | |
LLVM_ABI void | llvm::getLoopAnalysisUsage (AnalysisUsage &AU) |
Helper to consistently add the set of standard passes to a loop pass's AnalysisUsage . | |
LLVM_ABI bool | llvm::canSinkOrHoistInst (Instruction &I, AAResults *AA, DominatorTree *DT, Loop *CurLoop, MemorySSAUpdater &MSSAU, bool TargetExecutesOncePerLoop, SinkAndHoistLICMFlags &LICMFlags, OptimizationRemarkEmitter *ORE=nullptr) |
Returns true if is legal to hoist or sink this instruction disregarding the possible introduction of faults. | |
LLVM_ABI constexpr Intrinsic::ID | llvm::getReductionIntrinsicID (RecurKind RK) |
Returns the llvm.vector.reduce intrinsic that corresponds to the recurrence kind. | |
LLVM_ABI Intrinsic::ID | llvm::getMinMaxReductionIntrinsicID (Intrinsic::ID IID) |
Returns the llvm.vector.reduce min/max intrinsic that corresponds to the intrinsic op. | |
LLVM_ABI unsigned | llvm::getArithmeticReductionInstruction (Intrinsic::ID RdxID) |
Returns the arithmetic instruction opcode used when expanding a reduction. | |
LLVM_ABI Intrinsic::ID | llvm::getReductionForBinop (Instruction::BinaryOps Opc) |
Returns the reduction intrinsic id corresponding to the binary operation. | |
LLVM_ABI Intrinsic::ID | llvm::getMinMaxReductionIntrinsicOp (Intrinsic::ID RdxID) |
Returns the min/max intrinsic used when expanding a min/max reduction. | |
LLVM_ABI Intrinsic::ID | llvm::getMinMaxReductionIntrinsicOp (RecurKind RK) |
Returns the min/max intrinsic used when expanding a min/max reduction. | |
LLVM_ABI RecurKind | llvm::getMinMaxReductionRecurKind (Intrinsic::ID RdxID) |
Returns the recurence kind used when expanding a min/max reduction. | |
LLVM_ABI CmpInst::Predicate | llvm::getMinMaxReductionPredicate (RecurKind RK) |
Returns the comparison predicate used when expanding a min/max reduction. | |
LLVM_ABI Value * | llvm::getReductionIdentity (Intrinsic::ID RdxID, Type *Ty, FastMathFlags FMF) |
Given information about an @llvm.vector.reduce. | |
LLVM_ABI Value * | llvm::getRecurrenceIdentity (RecurKind K, Type *Tp, FastMathFlags FMF) |
Given information about an recurrence kind, return the identity for the @llvm.vector.reduce. | |
LLVM_ABI Value * | llvm::createMinMaxOp (IRBuilderBase &Builder, RecurKind RK, Value *Left, Value *Right) |
Returns a Min/Max operation corresponding to MinMaxRecurrenceKind. | |
LLVM_ABI Value * | llvm::getOrderedReduction (IRBuilderBase &Builder, Value *Acc, Value *Src, unsigned Op, RecurKind MinMaxKind=RecurKind::None) |
Generates an ordered vector reduction using extracts to reduce the value. | |
LLVM_ABI Value * | llvm::getShuffleReduction (IRBuilderBase &Builder, Value *Src, unsigned Op, TargetTransformInfo::ReductionShuffle RS, RecurKind MinMaxKind=RecurKind::None) |
Generates a vector reduction using shufflevectors to reduce the value. | |
LLVM_ABI Value * | llvm::createSimpleReduction (IRBuilderBase &B, Value *Src, RecurKind RdxKind) |
Create a reduction of the given vector. | |
LLVM_ABI Value * | llvm::createSimpleReduction (IRBuilderBase &B, Value *Src, RecurKind RdxKind, Value *Mask, Value *EVL) |
Overloaded function to generate vector-predication intrinsics for reduction. | |
LLVM_ABI Value * | llvm::createAnyOfReduction (IRBuilderBase &B, Value *Src, Value *InitVal, PHINode *OrigPhi) |
Create a reduction of the given vector Src for a reduction of kind RecurKind::AnyOf. | |
LLVM_ABI Value * | llvm::createFindLastIVReduction (IRBuilderBase &B, Value *Src, RecurKind RdxKind, Value *Start, Value *Sentinel) |
Create a reduction of the given vector Src for a reduction of the kind RecurKind::FindLastIV. | |
LLVM_ABI Value * | llvm::createOrderedReduction (IRBuilderBase &B, RecurKind RdxKind, Value *Src, Value *Start) |
Create an ordered reduction intrinsic using the given recurrence kind RdxKind . | |
LLVM_ABI Value * | llvm::createOrderedReduction (IRBuilderBase &B, RecurKind RdxKind, Value *Src, Value *Start, Value *Mask, Value *EVL) |
Overloaded function to generate vector-predication intrinsics for ordered reduction. | |
LLVM_ABI void | llvm::propagateIRFlags (Value *I, ArrayRef< Value * > VL, Value *OpValue=nullptr, bool IncludeWrapFlags=true) |
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). | |
LLVM_ABI 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 . | |
LLVM_ABI 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 . | |
LLVM_ABI bool | llvm::isKnownPositiveInLoop (const SCEV *S, const Loop *L, ScalarEvolution &SE) |
Returns true if we can prove that S is defined and always positive in loop L . | |
LLVM_ABI bool | llvm::isKnownNonPositiveInLoop (const SCEV *S, const Loop *L, ScalarEvolution &SE) |
Returns true if we can prove that S is defined and always non-positive in loop L . | |
LLVM_ABI 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. | |
LLVM_ABI 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. | |
LLVM_ABI 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. | |
template<typename RangeT> | |
LLVM_TEMPLATE_ABI void | llvm::appendLoopsToWorklist (RangeT &&, SmallPriorityWorklist< Loop *, 4 > &) |
Utility that implements appending of loops onto a worklist given a range. | |
template<typename RangeT> | |
void | llvm::appendReversedLoopsToWorklist (RangeT &&, SmallPriorityWorklist< Loop *, 4 > &) |
Utility that implements appending of loops onto a worklist given a range. | |
template LLVM_TEMPLATE_ABI void | llvm::appendLoopsToWorklist< ArrayRef< Loop * > & > (ArrayRef< Loop * > &Loops, SmallPriorityWorklist< Loop *, 4 > &Worklist) |
template LLVM_TEMPLATE_ABI void | llvm::appendLoopsToWorklist< Loop & > (Loop &L, SmallPriorityWorklist< Loop *, 4 > &Worklist) |
LLVM_ABI void | llvm::appendLoopsToWorklist (LoopInfo &, SmallPriorityWorklist< Loop *, 4 > &) |
Utility that implements appending of loops onto a worklist given LoopInfo. | |
LLVM_ABI Loop * | llvm::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. | |
LLVM_ABI Value * | llvm::addRuntimeChecks (Instruction *Loc, Loop *TheLoop, const SmallVectorImpl< RuntimePointerCheck > &PointerChecks, SCEVExpander &Expander, bool HoistRuntimeChecks=false) |
Add code that checks at runtime if the accessed arrays in PointerChecks overlap. | |
LLVM_ABI Value * | llvm::addDiffRuntimeChecks (Instruction *Loc, ArrayRef< PointerDiffInfo > Checks, SCEVExpander &Expander, function_ref< Value *(IRBuilderBase &, unsigned)> GetVF, unsigned IC) |
LLVM_ABI std::optional< IVConditionInfo > | llvm::hasPartialIVCondition (const Loop &L, unsigned MSSAThreshold, const MemorySSA &MSSA, AAResults &AA) |
Check if the loop header has a conditional branch that is not loop-invariant, because it involves load instructions. | |
LLVM_ABI TransformationMode | llvm::hasUnrollTransformation (const Loop *L) |
LLVM_ABI TransformationMode | llvm::hasUnrollAndJamTransformation (const Loop *L) |
LLVM_ABI TransformationMode | llvm::hasVectorizeTransformation (const Loop *L) |
LLVM_ABI TransformationMode | llvm::hasDistributeTransformation (const Loop *L) |
LLVM_ABI TransformationMode | llvm::hasLICMVersioningTransformation (const Loop *L) |