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);
109 bool VectorizeOnlyWhenForced)
const;
150 void getHintsFromMetadata();
189 if (!UnsafeAlgebraInst)
190 UnsafeAlgebraInst =
I;
198 unsigned NumRuntimePointerChecks = 0;
226 : TheLoop(L), LI(LI), PSE(PSE), TLI(TLI), DT(DT), GetLAA(GetLAA),
227 ORE(ORE), Requirements(R), Hints(H), DB(DB), AC(AC) {}
248 bool canVectorize(
bool UseVPlanNativePath);
252 bool canFoldTailByMasking();
273 bool isInductionPhi(
const Value *V);
278 bool isCastedInductionVariable(
const Value *V);
283 bool isInductionVariable(
const Value *V);
289 bool isFirstOrderRecurrence(
const PHINode *Phi);
305 int isConsecutivePtr(
Value *Ptr);
308 bool isUniform(
Value *V);
312 return LAI->getRuntimePointerChecking();
320 return LAI->getDepChecker().getMaxSafeRegisterWidth();
343 bool canVectorizeLoopNestCFG(
Loop *Lp,
bool UseVPlanNativePath);
348 bool setupOuterLoopInductions();
356 bool canVectorizeLoopCFG(
Loop *Lp,
bool UseVPlanNativePath);
361 bool canVectorizeInstrs();
367 bool canVectorizeMemory();
371 bool canVectorizeWithIfConvert();
375 bool canVectorizeOuterLoop();
397 RemarkName, TheLoop,
I);
407 return LAI ? &LAI->getSymbolicStrides() :
nullptr;
430 std::function<const LoopAccessInfo &(Loop &)> *GetLAA;
443 PHINode *PrimaryInduction =
nullptr;
467 Type *WidestIndTy =
nullptr;
474 bool HasFunNoNaNAttr =
false;
497 #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.
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...
amdgpu Simplify well known AMD library false Value Value const Twine & Name
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...
bool allowVectorization(Function *F, Loop *L, bool VectorizeOnlyWhenForced) const
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.
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
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.