27 #ifndef LLVM_TRANSFORMS_VECTORIZE_LOOPVECTORIZATIONLEGALITY_H 28 #define LLVM_TRANSFORMS_VECTORIZE_LOOPVECTORIZATIONLEGALITY_H 47 Instruction *
I =
nullptr);
59 enum HintKind { HK_WIDTH, HK_UNROLL, HK_FORCE, HK_ISVECTORIZED };
67 Hint(
const char *Name,
unsigned Value, HintKind Kind)
68 :
Name(Name), Value(Value),
Kind(Kind) {}
70 bool validate(
unsigned Val);
86 static StringRef Prefix() {
return "llvm.loop."; }
89 bool PotentiallyUnsafe =
false;
103 IsVectorized.Value = 1;
104 Hint Hints[] = {IsVectorized};
105 writeHintsToMetadata(Hints);
144 void getHintsFromMetadata();
183 if (!UnsafeAlgebraInst)
184 UnsafeAlgebraInst =
I;
192 unsigned NumRuntimePointerChecks = 0;
220 : TheLoop(L), LI(LI), PSE(PSE), TLI(TLI), DT(DT), GetLAA(GetLAA),
221 ORE(ORE), Requirements(R), Hints(H), DB(DB), AC(AC) {}
242 bool canVectorize(
bool UseVPlanNativePath);
263 bool isInductionPhi(
const Value *V);
268 bool isCastedInductionVariable(
const Value *V);
273 bool isInductionVariable(
const Value *V);
279 bool isFirstOrderRecurrence(
const PHINode *Phi);
298 bool isUniform(
Value *V);
302 return LAI->getRuntimePointerChecking();
310 return LAI->getDepChecker().getMaxSafeRegisterWidth();
333 bool canVectorizeLoopNestCFG(
Loop *Lp,
bool UseVPlanNativePath);
341 bool canVectorizeLoopCFG(
Loop *Lp,
bool UseVPlanNativePath);
346 bool canVectorizeInstrs();
352 bool canVectorizeMemory();
356 bool canVectorizeWithIfConvert();
360 bool canVectorizeOuterLoop();
382 RemarkName, TheLoop,
I);
392 return LAI ? &LAI->getSymbolicStrides() :
nullptr;
415 std::function<const LoopAccessInfo &(Loop &)> *GetLAA;
428 PHINode *PrimaryInduction =
nullptr;
452 Type *WidestIndTy =
nullptr;
459 bool HasFunNoNaNAttr =
false;
482 #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.
Compute iterated dominance frontiers using a linear time algorithm.
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...
LoopVectorizeHints(const Loop *L, bool DisableInterleaving, OptimizationRemarkEmitter &ORE)
void addUnsafeAlgebraInst(Instruction *I)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
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.
LoopVectorizationLegality(Loop *L, PredicatedScalarEvolution &PSE, DominatorTree *DT, TargetLibraryInfo *TLI, AliasAnalysis *AA, Function *F, std::function< const LoopAccessInfo &(Loop &)> *GetLAA, LoopInfo *LI, OptimizationRemarkEmitter *ORE, LoopVectorizationRequirements *R, LoopVectorizeHints *H, DemandedBits *DB, AssumptionCache *AC)
The instances of the Type class are immutable: once they are created, they are never changed...
OptimizationRemarkAnalysis createLVMissedAnalysis(const char *PassName, StringRef RemarkName, Loop *TheLoop, Instruction *I=nullptr)
Create an analysis remark that explains why vectorization failed.
unsigned getNumLoads() const
bool hasFunNoNaNAttr() const
bool isReductionVariable(PHINode *PN)
Returns True if PN is a reduction variable in this loop.
const RuntimePointerChecking * getRuntimePointerChecking() const
Returns the information that we collected about runtime memory check.
bool allowVectorization(Function *F, Loop *L, bool AlwaysVectorize) const
unsigned getInterleave() const
unsigned getIsVectorized() 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 ...
amdgpu Simplify well known AMD library false Value Value * Arg
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.
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.