23 #define LV_NAME "loop-vectorize" 24 #define DEBUG_TYPE LV_NAME 28 cl::desc(
"Enable if-conversion during vectorization."));
32 cl::desc(
"The maximum allowed number of runtime memory checks with a " 33 "vectorize(enable) pragma."));
37 cl::desc(
"The maximum number of SCEV checks allowed."));
41 cl::desc(
"The maximum number of SCEV checks allowed with a " 42 "vectorize(enable) pragma"));
65 R <<
"loop not vectorized: ";
69 bool LoopVectorizeHints::Hint::validate(
unsigned Val) {
78 return (Val == 0 || Val == 1);
86 Interleave(
"interleave.count", DisableInterleaving, HK_UNROLL),
87 Force(
"vectorize.enable", FK_Undefined, HK_FORCE),
88 IsVectorized(
"isvectorized", 0, HK_ISVECTORIZED), TheLoop(L), ORE(ORE) {
90 getHintsFromMetadata();
96 if (IsVectorized.Value != 1)
100 IsVectorized.Value = Width.Value == 1 && Interleave.Value == 1;
101 LLVM_DEBUG(
if (DisableInterleaving && Interleave.Value == 1)
dbgs()
102 <<
"LV: Interleaving disabled by the pass manager\n");
106 bool AlwaysVectorize)
const {
108 LLVM_DEBUG(
dbgs() <<
"LV: Not vectorizing: #pragma vectorize disable.\n");
114 LLVM_DEBUG(
dbgs() <<
"LV: Not vectorizing: No #pragma vectorize enable.\n");
120 LLVM_DEBUG(
dbgs() <<
"LV: Not vectorizing: Disabled/already vectorized.\n");
128 <<
"loop not vectorized: vectorization and interleaving are " 129 "explicitly disabled, or the loop has already been " 144 TheLoop->getStartLoc(),
145 TheLoop->getHeader())
146 <<
"loop not vectorized: vectorization is explicitly disabled";
149 TheLoop->getStartLoc(), TheLoop->getHeader());
150 R <<
"loop not vectorized";
152 R <<
" (Force=" <<
NV(
"Force",
true);
153 if (Width.Value != 0)
154 R <<
", Vector Width=" <<
NV(
"VectorWidth", Width.Value);
155 if (Interleave.Value != 0)
156 R <<
", Interleave Count=" <<
NV(
"InterleaveCount", Interleave.Value);
174 void LoopVectorizeHints::getHintsFromMetadata() {
175 MDNode *LoopID = TheLoop->getLoopID();
183 for (
unsigned i = 1, ie = LoopID->
getNumOperands(); i < ie; ++i) {
190 if (!MD || MD->getNumOperands() == 0)
193 for (
unsigned i = 1, ie = MD->getNumOperands(); i < ie; ++i)
197 assert(Args.
size() == 0 &&
"too many arguments for MDString");
205 if (Args.
size() == 1)
206 setHint(Name, Args[0]);
220 Hint *Hints[] = {&Width, &Interleave, &Force, &IsVectorized};
221 for (
auto H : Hints) {
222 if (Name ==
H->Name) {
223 if (
H->validate(Val))
226 LLVM_DEBUG(
dbgs() <<
"LV: ignoring invalid hint '" << Name <<
"'\n");
241 bool LoopVectorizeHints::matchesHintMetadataName(
MDNode *Node,
247 for (
auto H : HintTypes)
253 void LoopVectorizeHints::writeHintsToMetadata(
ArrayRef<Hint> HintTypes) {
254 if (HintTypes.
empty())
260 MDNode *LoopID = TheLoop->getLoopID();
262 for (
unsigned i = 1, ie = LoopID->
getNumOperands(); i < ie; ++i) {
265 if (!matchesHintMetadataName(Node, HintTypes))
271 for (
auto H : HintTypes)
280 TheLoop->setLoopID(NewLoopID);
290 PassName,
"CantReorderFPOps", UnsafeAlgebraInst->getDebugLoc(),
291 UnsafeAlgebraInst->getParent())
292 <<
"loop not vectorized: cannot prove it is safe to reorder " 293 "floating-point operations";
299 bool PragmaThresholdReached =
301 bool ThresholdReached =
304 PragmaThresholdReached) {
309 <<
"loop not vectorized: cannot prove it is safe to reorder " 360 if (!LatchBr || LatchBr->isUnconditional()) {
369 dbgs() <<
"LV: Loop latch condition is not a compare instruction.\n");
373 Value *CondOp0 = LatchCmp->getOperand(0);
374 Value *CondOp1 = LatchCmp->getOperand(1);
375 Value *IVUpdate = IV->getIncomingValueForBlock(Latch);
378 LLVM_DEBUG(
dbgs() <<
"LV: Loop latch condition is not uniform.\n");
392 for (
Loop *SubLp : *Lp)
405 for (
Value *V : Phi.incoming_values())
406 if (
auto *
C = dyn_cast<Constant>(V))
439 if (!AllowedExit.
count(Inst))
445 LLVM_DEBUG(
dbgs() <<
"LV: Found an outside user for : " << *UI <<
'\n');
456 int Stride =
getPtrStride(PSE, Ptr, TheLoop, Strides,
true,
false);
457 if (Stride == 1 || Stride == -1)
463 return LAI->isUniform(V);
466 bool LoopVectorizationLegality::canVectorizeOuterLoop() {
467 assert(!TheLoop->empty() &&
"We are not vectorizing an outer loop.");
471 bool DoExtraAnalysis = ORE->allowExtraAnalysis(
DEBUG_TYPE);
478 LLVM_DEBUG(
dbgs() <<
"LV: Unsupported basic block terminator.\n");
479 ORE->emit(createMissedAnalysis(
"CFGNotUnderstood")
480 <<
"loop control flow is not understood by vectorizer");
490 if (Br && Br->isConditional() &&
491 !TheLoop->isLoopInvariant(Br->getCondition()) &&
492 !LI->isLoopHeader(Br->getSuccessor(0)) &&
493 !LI->isLoopHeader(Br->getSuccessor(1))) {
495 ORE->emit(createMissedAnalysis(
"CFGNotUnderstood")
496 <<
"loop control flow is not understood by vectorizer");
510 <<
"LV: Not vectorizing: Outer loop contains divergent loops.\n");
511 ORE->emit(createMissedAnalysis(
"CFGNotUnderstood")
512 <<
"loop control flow is not understood by vectorizer");
522 void LoopVectorizationLegality::addInductionPhi(
525 Inductions[Phi] =
ID;
533 InductionCastsToIgnore.insert(*Casts.
begin());
556 if (!PrimaryInduction || PhiTy == WidestIndTy)
557 PrimaryInduction = Phi;
565 if (PSE.getUnionPredicate().isAlwaysTrue()) {
573 bool LoopVectorizationLegality::canVectorizeInstrs() {
585 if (
auto *Phi = dyn_cast<PHINode>(&
I)) {
590 ORE->emit(createMissedAnalysis(
"CFGNotUnderstood", Phi)
591 <<
"loop control flow is not understood by vectorizer");
604 ORE->emit(createMissedAnalysis(
"NeitherInductionNorReduction", Phi)
605 <<
"value could not be identified as " 606 "an induction or reduction variable");
612 ORE->emit(createMissedAnalysis(
"CFGNotUnderstood", Phi)
613 <<
"control flow not understood by vectorizer");
624 Reductions[Phi] = RedDes;
630 addInductionPhi(Phi, ID, AllowedExit);
638 FirstOrderRecurrences.insert(Phi);
645 addInductionPhi(Phi, ID, AllowedExit);
649 ORE->emit(createMissedAnalysis(
"NonReductionValueUsedOutsideLoop", Phi)
650 <<
"value that could not be identified as " 651 "reduction is used outside the loop");
652 LLVM_DEBUG(
dbgs() <<
"LV: Found an unidentified PHI." << *Phi <<
"\n");
662 !isa<DbgInfoIntrinsic>(CI) &&
663 !(CI->getCalledFunction() && TLI &&
664 TLI->isFunctionVectorizable(CI->getCalledFunction()->getName()))) {
665 ORE->emit(createMissedAnalysis(
"CantVectorizeCall", CI)
666 <<
"call instruction cannot be vectorized");
668 dbgs() <<
"LV: Found a non-intrinsic, non-libfunc callsite.\n");
676 auto *SE = PSE.getSE();
677 if (!SE->isLoopInvariant(PSE.getSCEV(CI->getOperand(1)), TheLoop)) {
678 ORE->emit(createMissedAnalysis(
"CantVectorizeIntrinsic", CI)
679 <<
"intrinsic instruction cannot be vectorized");
681 <<
"LV: Found unvectorizable intrinsic " << *CI <<
"\n");
689 !
I.getType()->isVoidTy()) ||
690 isa<ExtractElementInst>(
I)) {
691 ORE->emit(createMissedAnalysis(
"CantVectorizeInstructionReturnType", &
I)
692 <<
"instruction return type cannot be vectorized");
698 if (
auto *
ST = dyn_cast<StoreInst>(&
I)) {
699 Type *
T =
ST->getValueOperand()->getType();
701 ORE->emit(createMissedAnalysis(
"CantVectorizeStore",
ST)
702 <<
"store instruction cannot be vectorized");
711 }
else if (
I.getType()->isFloatingPointTy() && (CI ||
I.isBinaryOp()) &&
714 Hints->setPotentiallyUnsafe();
720 ORE->emit(createMissedAnalysis(
"ValueUsedOutsideLoop", &
I)
721 <<
"value cannot be used outside the loop");
727 if (!PrimaryInduction) {
728 LLVM_DEBUG(
dbgs() <<
"LV: Did not find one integer induction var.\n");
729 if (Inductions.empty()) {
730 ORE->emit(createMissedAnalysis(
"NoInductionVariable")
731 <<
"loop induction variable could not be identified");
739 if (PrimaryInduction && WidestIndTy != PrimaryInduction->getType())
740 PrimaryInduction =
nullptr;
745 bool LoopVectorizationLegality::canVectorizeMemory() {
746 LAI = &(*GetLAA)(*TheLoop);
751 "loop not vectorized: ", *LAR);
754 if (!LAI->canVectorizeMemory())
757 if (LAI->hasStoreToLoopInvariantAddress()) {
758 ORE->emit(createMissedAnalysis(
"CantVectorizeStoreToLoopInvariantAddress")
759 <<
"write to a loop invariant address could not be vectorized");
760 LLVM_DEBUG(
dbgs() <<
"LV: We don't allow storing to uniform addresses\n");
764 Requirements->addRuntimePointerChecks(LAI->getNumRuntimePointerChecks());
765 PSE.addPredicate(LAI->getPSE().getUnionPredicate());
772 PHINode *PN = dyn_cast_or_null<PHINode>(In0);
776 return Inductions.count(PN);
781 return (Inst && InductionCastsToIgnore.count(Inst));
785 return isInductionPhi(V) || isCastedInductionVariable(V);
789 return FirstOrderRecurrences.count(Phi);
796 bool LoopVectorizationLegality::blockCanBePredicated(
798 const bool IsAnnotatedParallel = TheLoop->isAnnotatedParallel();
802 for (
Value *Operand :
I.operands()) {
803 if (
auto *
C = dyn_cast<Constant>(Operand))
808 if (
I.mayReadFromMemory()) {
812 if (!SafePtrs.
count(LI->getPointerOperand())) {
816 if (!IsAnnotatedParallel)
822 if (
I.mayWriteToMemory()) {
841 bool LoopVectorizationLegality::canVectorizeWithIfConvert() {
843 ORE->emit(createMissedAnalysis(
"IfConversionDisabled")
844 <<
"if-conversion is disabled");
848 assert(TheLoop->getNumBlocks() > 1 &&
"Single block loops are vectorizable");
855 if (blockNeedsPredication(BB))
868 ORE->emit(createMissedAnalysis(
"LoopContainsSwitch", BB->
getTerminator())
869 <<
"loop contains a switch statement");
874 if (blockNeedsPredication(BB)) {
875 if (!blockCanBePredicated(BB, SafePointes)) {
876 ORE->emit(createMissedAnalysis(
"NoCFGForSelect", BB->
getTerminator())
877 <<
"control flow cannot be substituted for a select");
881 ORE->emit(createMissedAnalysis(
"NoCFGForSelect", BB->
getTerminator())
882 <<
"control flow cannot be substituted for a select");
892 bool LoopVectorizationLegality::canVectorizeLoopCFG(
Loop *Lp,
893 bool UseVPlanNativePath) {
895 "VPlan-native path is not enabled.");
905 bool DoExtraAnalysis = ORE->allowExtraAnalysis(
DEBUG_TYPE);
910 LLVM_DEBUG(
dbgs() <<
"LV: Loop doesn't have a legal pre-header.\n");
911 ORE->emit(createMissedAnalysis(
"CFGNotUnderstood")
912 <<
"loop control flow is not understood by vectorizer");
921 ORE->emit(createMissedAnalysis(
"CFGNotUnderstood")
922 <<
"loop control flow is not understood by vectorizer");
931 ORE->emit(createMissedAnalysis(
"CFGNotUnderstood")
932 <<
"loop control flow is not understood by vectorizer");
943 ORE->emit(createMissedAnalysis(
"CFGNotUnderstood")
944 <<
"loop control flow is not understood by vectorizer");
954 bool LoopVectorizationLegality::canVectorizeLoopNestCFG(
955 Loop *Lp,
bool UseVPlanNativePath) {
959 bool DoExtraAnalysis = ORE->allowExtraAnalysis(
DEBUG_TYPE);
960 if (!canVectorizeLoopCFG(Lp, UseVPlanNativePath)) {
969 for (
Loop *SubLp : *Lp)
970 if (!canVectorizeLoopNestCFG(SubLp, UseVPlanNativePath)) {
985 bool DoExtraAnalysis = ORE->allowExtraAnalysis(
DEBUG_TYPE);
988 if (!canVectorizeLoopNestCFG(TheLoop, UseVPlanNativePath)) {
996 LLVM_DEBUG(
dbgs() <<
"LV: Found a loop: " << TheLoop->getHeader()->getName()
1001 if (!TheLoop->empty()) {
1002 assert(UseVPlanNativePath &&
"VPlan-native path is not enabled.");
1004 if (!canVectorizeOuterLoop()) {
1005 LLVM_DEBUG(
dbgs() <<
"LV: Not vectorizing: Unsupported outer loop.\n");
1015 assert(TheLoop->empty() &&
"Inner loop expected.");
1017 unsigned NumBlocks = TheLoop->getNumBlocks();
1018 if (NumBlocks != 1 && !canVectorizeWithIfConvert()) {
1020 if (DoExtraAnalysis)
1027 if (!canVectorizeInstrs()) {
1028 LLVM_DEBUG(
dbgs() <<
"LV: Can't vectorize the instructions or CFG\n");
1029 if (DoExtraAnalysis)
1036 if (!canVectorizeMemory()) {
1037 LLVM_DEBUG(
dbgs() <<
"LV: Can't vectorize due to memory conflicts\n");
1038 if (DoExtraAnalysis)
1045 << (LAI->getRuntimePointerChecking()->Need
1046 ?
" (with a runtime bound check)" 1054 if (PSE.getUnionPredicate().getComplexity() > SCEVThreshold) {
1055 ORE->emit(createMissedAnalysis(
"TooManySCEVRunTimeChecks")
1056 <<
"Too many SCEV assumptions need to be made and checked " 1059 if (DoExtraAnalysis)
static bool isUniformLoop(Loop *Lp, Loop *OuterLp)
static unsigned RuntimeMemoryCheckThreshold
performing memory disambiguation checks at runtime do not make more than this number of comparisons...
void push_back(const T &Elt)
A parsed version of the target data layout string in and methods for querying it. ...
This class is the base class for the comparison instructions.
unsigned getWidth() const
bool allowReordering() const
BlockT * getLoopLatch() const
If there is a single latch block for this loop, return it.
static Type * getWiderType(const DataLayout &DL, Type *Ty0, Type *Ty1)
DiagnosticInfoOptimizationBase::Argument NV
Compute iterated dominance frontiers using a linear time algorithm.
Instruction * getUnsafeAlgebraInst()
Returns first unsafe algebra instruction in the PHI node's use-chain.
bool isCastedInductionVariable(const Value *V)
Returns True if V is a cast that is part of an induction def-use chain, and had been proven to be red...
static bool isInductionPHI(PHINode *Phi, const Loop *L, ScalarEvolution *SE, InductionDescriptor &D, const SCEV *Expr=nullptr, SmallVectorImpl< Instruction *> *CastsToIgnore=nullptr)
Returns true if Phi is an induction in the loop L.
void replaceOperandWith(unsigned I, Metadata *New)
Replace a specific operand.
static MDString * get(LLVMContext &Context, StringRef Str)
ConstantInt * getConstIntStepValue() const
bool isUniform(Value *V)
Returns true if the value V is uniform within the loop.
TODO: The following VectorizationFactor was pulled out of LoopVectorizationCostModel class...
This class represents a function call, abstracting a target machine's calling convention.
int64_t getPtrStride(PredicatedScalarEvolution &PSE, Value *Ptr, const Loop *Lp, const ValueToValueMap &StridesMap=ValueToValueMap(), bool Assume=false, bool ShouldCheckWrap=true)
If the pointer has a constant stride return it in units of its element size.
BlockT * getLoopPreheader() const
If there is a preheader for this loop, return it.
InductionKind getKind() const
const MDOperand & getOperand(unsigned I) const
An instruction for reading from memory.
Value * getStartValue() const
const char * vectorizeAnalysisPassName() const
If hints are provided that force vectorization, use the AlwaysPrint pass name to force the frontend t...
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
LoopVectorizeHints(const Loop *L, bool DisableInterleaving, OptimizationRemarkEmitter &ORE)
Intrinsic::ID getVectorIntrinsicIDForCall(const CallInst *CI, const TargetLibraryInfo *TLI)
Returns intrinsic ID for call.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool endswith(StringRef Suffix) const
Check if this string ends with the given Suffix.
bool hasUnsafeAlgebra()
Returns true if the recurrence has unsafe algebra which requires a relaxed floating-point model...
unsigned getNumBackEdges() const
Calculate the number of back edges to the loop header.
This file defines the LoopVectorizationLegality class.
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
static const unsigned MaxVectorWidth
Maximum SIMD width.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
bool isFloatingPointTy() const
Return true if this is one of the six floating-point types.
static cl::opt< bool > EnableIfConversion("enable-if-conversion", cl::init(true), cl::Hidden, cl::desc("Enable if-conversion during vectorization."))
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
bool isIntegerTy() const
True if this is an instance of IntegerType.
BlockT * getHeader() const
int isConsecutivePtr(Value *Ptr)
Check if this pointer is consecutive when vectorizing.
bool isOne() const
This is just a convenience method to make client code smaller for a common case.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
Type * getType() const
All values are typed, get the type of this value.
bool isInductionVariable(const Value *V)
Returns True if V can be considered as an induction variable in this loop.
static bool isValidElementType(Type *ElemTy)
Return true if the specified type is valid as a element type.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Value * getLoadStorePointerOperand(Value *V)
A helper function that returns the pointer operand of a load or store instruction.
An instruction for storing to memory.
static cl::opt< unsigned > PragmaVectorizeMemoryCheckThreshold("pragma-vectorize-memory-check-threshold", cl::init(128), cl::Hidden, cl::desc("The maximum allowed number of runtime memory checks with a " "vectorize(enable) pragma."))
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
bool blockNeedsPredication(BasicBlock *BB)
Return true if the block BB needs to be predicated in order for the loop to be vectorized.
StringRef getString() const
IntegerType * getIntPtrType(LLVMContext &C, unsigned AddressSpace=0) const
Returns an integer type with size at least as big as that of a pointer in the given address space...
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata *> MDs)
enum ForceKind getForce() const
initializer< Ty > init(const Ty &Val)
Integer induction variable. Step = C.
uint64_t getZExtValue() const
Return the constant as a 64-bit unsigned integer value after it has been zero extended as appropriate...
static bool hasOutsideLoopUser(const Loop *TheLoop, Instruction *Inst, SmallPtrSetImpl< Value *> &AllowedExit)
Check that the instruction has outside loop users and is not an identified reduction variable...
constexpr bool isPowerOf2_32(uint32_t Value)
Return true if the argument is a power of two > 0.
LLVM Basic Block Representation.
The instances of the Type class are immutable: once they are created, they are never changed...
This is an important class for using LLVM in a threaded context.
Conditional or Unconditional Branch instruction.
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator begin()
Instruction * getUnsafeAlgebraInst()
Returns induction operator that does not have "fast-math" property and requires FP unsafe mode...
Value * getIncomingValueForBlock(const BasicBlock *BB) const
bool isPointerTy() const
True if this is an instance of PointerType.
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
OptimizationRemarkAnalysis createLVMissedAnalysis(const char *PassName, StringRef RemarkName, Loop *TheLoop, Instruction *I=nullptr)
Create an analysis remark that explains why vectorization failed.
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
static bool isReductionPHI(PHINode *Phi, Loop *TheLoop, RecurrenceDescriptor &RedDes, DemandedBits *DB=nullptr, AssumptionCache *AC=nullptr, DominatorTree *DT=nullptr)
Returns true if Phi is a reduction in TheLoop.
bool allowVectorization(Function *F, Loop *L, bool AlwaysVectorize) const
static bool isUniformLoopNest(Loop *Lp, Loop *OuterLp)
bool doesNotMeet(Function *F, Loop *L, const LoopVectorizeHints &Hints)
DebugLoc getStartLoc() const
Return the debug location of the start of this loop.
static bool isFirstOrderRecurrence(PHINode *Phi, Loop *TheLoop, DenseMap< Instruction *, Instruction *> &SinkAfter, DominatorTree *DT)
Returns true if Phi is a first-order recurrence.
bool isLoopInvariant(const Value *V) const
Return true if the specified value is loop invariant.
unsigned getIsVectorized() const
The RecurrenceDescriptor is used to identify recurrences variables in a loop.
bool contains(const LoopT *L) const
Return true if the specified loop is contained within in this loop.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
This is the shared class of boolean and integer constants.
auto size(R &&Range, typename std::enable_if< std::is_same< typename std::iterator_traits< decltype(Range.begin())>::iterator_category, std::random_access_iterator_tag >::value, void >::type *=nullptr) -> decltype(std::distance(Range.begin(), Range.end()))
Get the size of a range.
A struct for saving information about induction variables.
testing::Matcher< const detail::ErrorHolder & > Failed()
unsigned getScalarSizeInBits() const LLVM_READONLY
If this is a vector type, return the getPrimitiveSizeInBits value for the element type...
DenseMap< const Value *, Value * > ValueToValueMap
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
bool isFirstOrderRecurrence(const PHINode *Phi)
Returns True if Phi is a first-order recurrence in this loop.
static Constant * get(Type *Ty, uint64_t V, bool isSigned=false)
If Ty is a vector type, return a Constant with a splat of the given value.
static const unsigned MaxInterleaveFactor
Maximum vectorization interleave count.
bool hasVectorInstrinsicScalarOpd(Intrinsic::ID ID, unsigned ScalarOpdIdx)
Identifies if the intrinsic has a scalar operand.
unsigned getNumIncomingValues() const
Return the number of incoming edges.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
PHINode * getCanonicalInductionVariable() const
Check to see if the loop has a canonical induction variable: an integer recurrence that starts at 0 a...
static bool canIfConvertPHINodes(BasicBlock *BB)
Check whether it is safe to if-convert this phi node.
const Module * getModule() const
Return the module owning the function this instruction belongs to or nullptr it the function does not...
bool isInductionPhi(const Value *V)
Returns True if V is a Phi node of an induction variable in this loop.
iterator_range< user_iterator > users()
bool hasUnsafeAlgebra()
Returns true if the induction type is FP and the binary operator does not have the "fast-math" proper...
amdgpu Simplify well known AMD library false Value Value * Arg
const SmallVectorImpl< Instruction * > & getCastInsts() const
Returns a reference to the type cast instructions in the induction update chain, that are redundant w...
const DebugLoc & getDebugLoc() const
Return the debug location for this node as a DebugLoc.
static IntegerType * getInt32Ty(LLVMContext &C)
LLVM_NODISCARD bool empty() const
Instruction * getLoopExitInstr()
StringRef getValueAsString() const
Return the attribute's value as a string.
Represents a single loop in the control flow graph.
const Function * getParent() const
Return the enclosing method, or null if none.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
iterator_range< const_phi_iterator > phis() const
Returns a range that iterates over the phis in the basic block.
Collection of parameters shared beetween the Loop Vectorizer and the Loop Access Analysis.
bool canVectorize(bool UseVPlanNativePath)
Returns true if it is legal to vectorize this loop.
std::string str() const
Return the twine contents as a std::string.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
static bool blockNeedsPredication(BasicBlock *BB, Loop *TheLoop, DominatorTree *DT)
Return true if the block BB needs to be predicated in order for the loop to be vectorized.
Attribute getFnAttribute(Attribute::AttrKind Kind) const
Return the attribute for the given attribute kind.
static unsigned VectorizationInterleave
Interleave factor as overridden by the user.
static Type * convertPointerToIntegerType(const DataLayout &DL, Type *Ty)
StringRef - Represent a constant reference to a string, i.e.
static cl::opt< unsigned > VectorizeSCEVCheckThreshold("vectorize-scev-check-threshold", cl::init(16), cl::Hidden, cl::desc("The maximum number of SCEV checks allowed."))
static cl::opt< unsigned > PragmaVectorizeSCEVCheckThreshold("pragma-vectorize-scev-check-threshold", cl::init(128), cl::Hidden, cl::desc("The maximum number of SCEV checks allowed with a " "vectorize(enable) pragma"))
const TerminatorInst * getTerminator() const LLVM_READONLY
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
Utility class for getting and setting loop vectorizer hints in the form of loop metadata.
static bool isInterleaveForced()
True if force-vector-interleave was specified by the user.
unsigned getNumOperands() const
Return number of MDNode operands.
BlockT * getExitingBlock() const
If getExitingBlocks would return exactly one block, return that block.
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
void emitRemarkWithHints() const
Dumps all the hint information.
bool empty() const
empty - Check if the array is empty.
const BasicBlock * getParent() const