26 #ifndef LLVM_TRANSFORMS_VECTORIZE_LOOPVECTORIZATIONLEGALITY_H 27 #define LLVM_TRANSFORMS_VECTORIZE_LOOPVECTORIZATIONLEGALITY_H 46 enum HintKind { HK_WIDTH, HK_UNROLL, HK_FORCE, HK_ISVECTORIZED,
55 Hint(
const char *Name,
unsigned Value, HintKind Kind)
77 static StringRef Prefix() {
return "llvm.loop."; }
80 bool PotentiallyUnsafe =
false;
96 bool VectorizeOnlyWhenForced)
const;
138 void getHintsFromMetadata();
168 if (!UnsafeAlgebraInst)
169 UnsafeAlgebraInst =
I;
177 unsigned NumRuntimePointerChecks = 0;
206 : TheLoop(L), LI(LI), PSE(PSE), TTI(TTI), TLI(TLI), DT(DT),
207 GetLAA(GetLAA), ORE(ORE), Requirements(R), Hints(H), DB(DB), AC(AC) {}
228 bool canVectorize(
bool UseVPlanNativePath);
232 bool prepareToFoldTailByMasking();
253 bool isInductionPhi(
const Value *V);
258 bool isCastedInductionVariable(
const Value *V);
263 bool isInductionVariable(
const Value *V);
269 bool isFirstOrderRecurrence(
const PHINode *Phi);
285 int isConsecutivePtr(
Value *Ptr);
288 bool isUniform(
Value *V);
292 return LAI->getRuntimePointerChecking();
300 return LAI->getDepChecker().getMaxSafeRegisterWidth();
323 bool canVectorizeLoopNestCFG(
Loop *Lp,
bool UseVPlanNativePath);
328 bool setupOuterLoopInductions();
336 bool canVectorizeLoopCFG(
Loop *Lp,
bool UseVPlanNativePath);
341 bool canVectorizeInstrs();
347 bool canVectorizeMemory();
351 bool canVectorizeWithIfConvert();
355 bool canVectorizeOuterLoop();
367 bool PreserveGuards =
false);
382 return LAI ? &LAI->getSymbolicStrides() :
nullptr;
408 std::function<const LoopAccessInfo &(Loop &)> *GetLAA;
421 PHINode *PrimaryInduction =
nullptr;
445 Type *WidestIndTy =
nullptr;
452 bool HasFunNoNaNAttr =
false;
475 #endif // LLVM_TRANSFORMS_VECTORIZE_LOOPVECTORIZATIONLEGALITY_H
Type * getWidestInductionType()
Returns the widest induction type.
unsigned getWidth() const
bool allowReordering() const
bool isMaskRequired(const Instruction *I)
Returns true if vector representation of the instruction I requires mask.
This class represents lattice values for constants.
LoopVectorizationLegality(Loop *L, PredicatedScalarEvolution &PSE, DominatorTree *DT, TargetTransformInfo *TTI, TargetLibraryInfo *TLI, AliasAnalysis *AA, Function *F, std::function< const LoopAccessInfo &(Loop &)> *GetLAA, LoopInfo *LI, OptimizationRemarkEmitter *ORE, LoopVectorizationRequirements *R, LoopVectorizeHints *H, DemandedBits *DB, AssumptionCache *AC)
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
A cache of @llvm.assume calls within a function.
LoopVectorizationLegality checks if it is legal to vectorize a loop, and to what vectorization factor...
const char * vectorizeAnalysisPassName() const
If hints are provided that force vectorization, use the AlwaysPrint pass name to force the frontend t...
void addUnsafeAlgebraInst(Instruction *I)
ReductionList * getReductionVars()
Returns the reduction variables found in the loop.
PHINode * getPrimaryInduction()
Returns the primary induction variable.
LoopVectorizationRequirements(OptimizationRemarkEmitter &ORE)
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree...
enum ForceKind getForce() const
void setPotentiallyUnsafe()
LLVM Basic Block Representation.
The instances of the Type class are immutable: once they are created, they are never changed...
bool allowVectorization(Function *F, Loop *L, bool VectorizeOnlyWhenForced) const
unsigned getNumLoads() const
bool hasFunNoNaNAttr() const
bool isReductionVariable(PHINode *PN)
Returns True if PN is a reduction variable in this loop.
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
const RuntimePointerChecking * getRuntimePointerChecking() const
Returns the information that we collected about runtime memory check.
unsigned getInterleave() const
unsigned getIsVectorized() const
unsigned getPredicate() const
A struct for saving information about induction variables.
bool isPotentiallyUnsafe() const
This holds vectorization requirements that must be verified late in the process.
Provides information about what library functions are available for the current target.
An interface layer with SCEV used to manage how we see SCEV expressions for values in the context of ...
unsigned getMaxSafeDepDistBytes()
Drive the analysis of memory accesses in the loop.
const LoopAccessInfo * getLAI() const
Holds information about the memory runtime legality checks to verify that a group of pointers do not ...
LoopVectorizeHints(const Loop *L, bool InterleaveOnlyWhenForced, OptimizationRemarkEmitter &ORE)
uint64_t getMaxSafeRegisterWidth() const
Represents a single loop in the control flow graph.
InductionList * getInductionVars()
Returns the induction variables found in the loop.
RecurrenceSet * getFirstOrderRecurrences()
Return the first-order recurrences found in the loop.
void setAlreadyVectorized()
Mark the loop L as already vectorized by setting the width to 1.
LLVM Value Representation.
void addRuntimePointerChecks(unsigned Num)
print Print MemDeps of function
StringRef - Represent a constant reference to a string, i.e.
bool hasDisableAllTransformsHint(const Loop *L)
Look for the loop attribute that disables all transformation heuristic.
Utility class for getting and setting loop vectorizer hints in the form of loop metadata.
unsigned getNumStores() const
DenseMap< Instruction *, Instruction * > & getSinkAfter()
Return the set of instructions to sink to handle first-order recurrences.
void emitRemarkWithHints() const
Dumps all the hint information.
void validate(const Triple &TT, const FeatureBitset &FeatureBits)