Checks whether a loop is legal to vectorize and at what factor.
Declared in <llvm/Transforms/Vectorize/LoopVectorizationLegality.h>
class LoopVectorizationLegality;
This class does not look at the profitability of vectorization, only the legality. This class has two main kinds of checks: * Memory checks - The code in canVectorizeMemory checks if vectorization will change the order of memory accesses in a way that will change the correctness of the program. * Scalars checks - The code in canVectorizeInstrs and canVectorizeMemory checks for a number of different conditions, such as the availability of a single induction variable, that all types are supported and vectorize-able, etc. This code reflects the capabilities of InnerLoopVectorizer. This class is also used by InnerLoopVectorizer for identifying induction variable and the different reduction variables.
| Name | Description |
|---|---|
InductionList | InductionList saves induction variables and maps them to the induction descriptor. |
RecurrenceSet | RecurrenceSet contains the phi nodes that are recurrences other than inductions and reductions. |
ReductionList | ReductionList contains the reduction descriptors for all of the reductions that were found in the loop. |
| Name | Description |
|---|---|
LoopVectorizationLegality [constructor] | Construct legality analysis for loop L. |
blockNeedsPredication | Return true if the block BB needs to be predicated in order for the loop to be vectorized. |
canFoldTailByMasking | Return true if we can vectorize this loop while folding its tail by masking. |
canVectorize | Return true if it is legal to vectorize this loop. |
canVectorizeFPMath | Return true if FP math in this loop may be vectorized. |
collectUnitStridePredicates | Add unit stride predicates for memory accesses to PSE, if runtime checks are allowed and an inner loop is vectorized. |
getAssumptionCache | Return the assumption cache for the function. |
getCountableExitingBlocks | Returns all exiting blocks with a countable exit, i.e. the exit-not-taken count is known exactly at compile time. |
getDominatorTree | Return the dominator tree for the function. |
getFixedOrderRecurrences | Return the fixed-order recurrences found in the loop. |
getHistogramInfo | Return histogram info if I is part of a histogram sequence. |
getInductionVars | Returns the induction variables found in the loop. |
getLAI | Return the loop access analysis for this loop. |
getLoop | Return the loop being analyzed. |
getLoopInfo | Return the loop info analysis. |
getMaxSafeVectorWidthInBits | Return the maximum safe vector width in bits from dependence analysis. |
getMaxStoreLoadForwardSafeDistanceInBits | Return safe power-of-2 number of elements, which do not prevent store-load forwarding and safe to operate simultaneously. |
getNumLoads | Return the number of loads in the loop. |
getNumStores | Return the number of stores in the loop. |
getPredicatedScalarEvolution | Return the predicated scalar evolution analysis for this loop. |
getPrimaryInduction | Returns the primary induction variable. |
getRecurrenceDescriptor | Returns the recurrence descriptor associated with a given phi node PN, expecting one to exist. |
getReductionVars | Returns the reduction variables found in the loop. |
getRuntimePointerChecking | Returns the information that we collected about runtime memory check. |
getScalarEvolution | Return the scalar evolution analysis. |
getUncountableExitTrait | Return the uncountable-exit trait for this loop. |
getWidestInductionType | Returns the widest induction type. |
hasHistograms | Returns a list of all known histogram operations in the loop. |
hasUncountableEarlyExit | Returns true if the loop has uncountable early exits, i.e. uncountable exits that aren't the latch block. |
hasUncountableExitWithSideEffects | Return true if an uncountable exit requires side-effect-safe handling. |
hasVectorCallVariants | Returns true if there is at least one function call in the loop which has a vectorized variant available. |
isCastedInductionVariable | Return true if V is a redundant cast in an induction def-use chain. |
isConsecutivePtr | Return whether Ptr is consecutive when vectorizing AccessTy. |
isFixedOrderRecurrence | Returns True if Phi is a fixed-order recurrence in this loop. |
isInductionPhi | Returns True if V is a Phi node of an induction variable in this loop. |
isInductionVariable | Return true if V can be treated as an induction variable in this loop. |
isInvariant | Returns true if V is invariant across all loop iterations according to SCEV. |
isInvariantAddressOfReduction | Returns True if given address is invariant and is used to store recurrent expression |
isInvariantStoreOfReduction | Returns True if given store is a final invariant store of one of the reductions found in the loop. |
isMaskRequired | Return true if I requires a mask when vectorized. |
isReductionVariable | Returns True if PN is a reduction variable in this loop. |
isSafeForAnyStoreLoadForwardDistances | Return true if there is store-load forwarding dependencies. |
isSafeForAnyVectorWidth | Return true if dependence analysis allows any vector width. |
isUniform | Returns true if value V is uniform across VF lanes, when VF is provided, and otherwise if V is invariant across all loop iterations. |
isUniformMemOp | Return true if I is a uniform memory operation for VF. |
prepareToFoldTailByMasking | Mark all respective loads/stores for masking. Must only be called when tail-folding is possible. |